# Relationship

Capturing relationships enables autonomous systems to navigate complex scenes (such as road environments) effectively, ensuring safety, efficiency, and a better user experience.

{% hint style="success" %} <img src="/files/qchq9tcQpS8cX7YBw03I" alt="" data-size="line"> User can create relationship across sensors, if needed.
{% endhint %}

***

## Benefits

* **Collision Avoidance and Safety:** Understanding which object is leading and which is following helps autonomous vehicles maintain safe following distances and prevent rear-end collisions.
* **Accurate Behavior Prediction:** Identifying leading and following objects enables the system to predict their behaviors, such as when the leading vehicle might slow down or stop, allowing the following vehicle to adjust accordingly.
  * Knowing which object is leading and following helps plan evasive actions during emergencies, such as sudden braking or unexpected obstacles.

***

## Steps to use Relationship

1. It is important to create the relations in the recipe to invoke this feature on the tool. In the recipe section, user will [create the relation](/project-setup/create-recipe/4.-associations.md#create-relations).
2. The tool is launched and the expert will create the two objects which are in a relationship. Upon creating the second object, the Relationship tab is enabled.

***

### Use Case 1 : One-way Relations

{% hint style="success" %} <img src="/files/qchq9tcQpS8cX7YBw03I" alt="" data-size="line"> Most (if not all) use cases fall under this category. Examples would be a cars atop a trailer, a rider sitting on a two wheeler, stroller being pushed by a pedestrian, trailer connected to the cabin of a truck etc.
{% endhint %}

#### A. Select the Subject to Create a Relation

Consider the following example&#x20;

**Relationship 1** Subject **->** Rider **;** Object **->** TwoWheeler

<figure><img src="/files/a5egkmY7evhvD3O1nTLf" alt=""><figcaption></figcaption></figure>

1. User is prompted to select a relation on the tool
2. Based on the relation, the selected annotation becomes the Subject (i.e. child) in the relationship and is displayed on the left side across the tool:
   * under the relationship tab
   * in the attribute list

<figure><img src="/files/UvMXgnrNDRAF3D4ywdX5" alt=""><figcaption></figcaption></figure>

3. As a visual cue, on the point cloud, the **subject** will always have the **small** **sphere** and the **object** will always have the **big** **sphere**.

<figure><img src="/files/MdvDSOLYGzTLG93tCCjc" alt=""><figcaption></figcaption></figure>

#### B. Select the Object to Create a Relation

In this use case, the above recipe was used,&#x20;

1. User is prompted to select a relation on the tool
2. Based on the relation, the selected annotation becomes the Object (i.e. parent) in the relationship and is displayed on the right side across the tool:
   * under the relationship tab
   * in the attribute list
3. As a visual cue, on the point cloud, the **subject** will always have the **small** **sphere** and the **object** will always have the **big** **sphere**.

***

### Use Case 2 : Class Has Multiple Relations

{% hint style="success" %} <img src="/files/qchq9tcQpS8cX7YBw03I" alt="" data-size="line">  A common example would be various categories of vehicles can be towed by a tow-truck.
{% endhint %}

In this use case, the following recipe was used,&#x20;

**Relationship 1** Subject **->** Rider **;** Object **->** TwoWheeler

**Relationship 2** Subject **->** Rider **;** Object **->** Bicycle

<figure><img src="/files/7faOjFptxxyxkh739vQ5" alt=""><figcaption></figcaption></figure>

1. User is prompted to select a relation on the tool since the selected annotation can be in a relationship with 2 annotations. &#x20;

<figure><img src="/files/oErWmJStPwWFlWR6R71F" alt="" width="359"><figcaption></figcaption></figure>

2. In the above example, *Rider* (subject) can be in a relationship with either *TwoWheeler* or *Bicycle* (two objects). The tool prompt will appear with multiple relations.
3. However, in this example, had the user selected the object (either *TwoWheeler* or *Bicycle*), the user would not have had to choose,

<figure><img src="/files/qTtnmr7dyxYIrPddPx6j" alt="" width="355"><figcaption></figcaption></figure>

4. The relationship is displayed on the tool uniformly, where left is subject and right is object:
   * under the relationship tab
   * in the attribute list
5. As a visual cue, on the point cloud, the **subject** will always have the **small** **sphere** and the **object** will always have the **big** **sphere**.

***

### Use Case 3 : Cyclic Relations

#### A. A Class Category is both Subject and Object&#x20;

{% hint style="success" %} <img src="/files/qchq9tcQpS8cX7YBw03I" alt="" data-size="line"> A common example is a pedestrian is holding hands with another pedestrian.
{% endhint %}

In this use case, the following recipe was used,&#x20;

**Relationship 1** Subject **->** PassengerCar **;** Object **->** PassengerCar

<figure><img src="/files/kdr8oDpPg5D0fTPcVPTy" alt=""><figcaption></figcaption></figure>

1. User is prompted to select a relation on the tool.  Since the subject and object are identical (i.e. *PassengerCar)*, the tool prompt for relation will appear with options,

<figure><img src="/files/9vUxmghKXhvA1Fgzw4m5" alt="" width="374"><figcaption></figcaption></figure>

2. The selected annotation can become the Subject (i.e. child) in the relationship or the Object (i.e. parent) depending on whether the relation (i.e. *isAttachedTo*) selected was from Outgoing or the Incoming.
   * Outgoing - Selected annotation becomes the object
   * Incoming - Selected annotation becomes the subject

<figure><img src="/files/MxIcIsP8tAEG8DottpFZ" alt="" width="374"><figcaption></figcaption></figure>

3. The relationship is displayed on the tool uniformly, where left is subject and right is object:
   * under the relationship tab
   * in the attribute list
4. As a visual cue, on the point cloud, the **subject** will always have the **small** **sphere** and the **object** will always have the **big** **sphere**.

#### B. A Class Category is an Object in one Relationship and Subject in Another

{% hint style="success" %} <img src="/files/qchq9tcQpS8cX7YBw03I" alt="" data-size="line"> A common example is a bi-articulated bus, where the centre is both a subject and an object entity.
{% endhint %}

In this use case, the following recipe was used,&#x20;

**Relationship 1** Subject **->** Rider **;** Object **->** TwoWheeler

**Relationship 2** Subject **->** Rider **;** Object **->** Bicycle

<figure><img src="/files/Bj7JWofa3HBgv1Blq9aA" alt=""><figcaption></figcaption></figure>

1. User is prompted to select a relation on the tool.  Since the subject and object are identical (i.e. *PassengerCar)*, the tool prompt for relation will appear with options,

<figure><img src="/files/N1wYpVsP280kZ3l9qtrs" alt="" width="358"><figcaption></figcaption></figure>

2. The selected annotation can become the Subject (i.e. child) in the relationship or the Object (i.e. parent) depending on whether the relation (i.e. *isAttachedTo*) selected was from Outgoing or the Incoming.
   * Outgoing - Selected annotation becomes the object
   * Incoming - Selected annotation becomes the subject
3. The relationship is displayed on the tool uniformly, where left is subject and right is object:
   * under the relationship tab
   * in the attribute list
4. As a visual cue, on the point cloud, the **subject** will always have the **small** **sphere** and the **object** will always have the **big** **sphere**.

{% hint style="success" %} <img src="/files/qchq9tcQpS8cX7YBw03I" alt="" data-size="line"> The expert can select either the object or the subject and proceed to creating the relation in all Use Cases.
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.imerit-prod.io/annotation-tool/key-features/relationship.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
