> For the complete documentation index, see [llms.txt](https://docs.imerit-prod.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.imerit-prod.io/annotation-tool/key-features/relationship.md).

# 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="https://254647936-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzGccvqLYeyaJ6Dgazh7K%2Fuploads%2FPtR8n6k8SV8lfeETLAEz%2FBulb.png?alt=media&amp;token=ec7271f0-1bef-4992-8c04-b668b1e44ea6" 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="https://254647936-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzGccvqLYeyaJ6Dgazh7K%2Fuploads%2FPtR8n6k8SV8lfeETLAEz%2FBulb.png?alt=media&amp;token=ec7271f0-1bef-4992-8c04-b668b1e44ea6" 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="https://254647936-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzGccvqLYeyaJ6Dgazh7K%2Fuploads%2FRwHFYgVhaoYC2BwHOzAW%2Fimage.png?alt=media&amp;token=6a60a2a1-d835-41cc-bdf8-7f8859dd46cf" 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="https://254647936-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzGccvqLYeyaJ6Dgazh7K%2Fuploads%2FKWoW4SCa7sMFaufaTFhN%2Fimage.png?alt=media&amp;token=15bbd5c0-4dcc-4047-98ad-6aef3420e6c1" 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="https://254647936-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzGccvqLYeyaJ6Dgazh7K%2Fuploads%2F7z353G44uvui65AJMks9%2Fimage.png?alt=media&amp;token=db2e943a-9250-40b3-bd3c-3701ed66f6cc" 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="https://254647936-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzGccvqLYeyaJ6Dgazh7K%2Fuploads%2FPtR8n6k8SV8lfeETLAEz%2FBulb.png?alt=media&amp;token=ec7271f0-1bef-4992-8c04-b668b1e44ea6" 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="https://254647936-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzGccvqLYeyaJ6Dgazh7K%2Fuploads%2FIOEFA6OygGrCGJsTI4Se%2Fimage.png?alt=media&amp;token=12b16d8e-82f7-4225-afdb-32df4519ef52" 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="https://254647936-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzGccvqLYeyaJ6Dgazh7K%2Fuploads%2FKzHTpigzNzLqJtpfndTw%2Fimage.png?alt=media&amp;token=6f7a2ea1-026d-410a-9c67-569411928bec" 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="https://254647936-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzGccvqLYeyaJ6Dgazh7K%2Fuploads%2FTL1pcbNwHB5yTQkChiWl%2Fimage.png?alt=media&amp;token=0f2bafed-d890-4a00-b7d0-68c25f8ffa3c" 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="https://254647936-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzGccvqLYeyaJ6Dgazh7K%2Fuploads%2FPtR8n6k8SV8lfeETLAEz%2FBulb.png?alt=media&amp;token=ec7271f0-1bef-4992-8c04-b668b1e44ea6" 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="https://254647936-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzGccvqLYeyaJ6Dgazh7K%2Fuploads%2Fn0LS45Wdt52dO6CWPBaj%2Fimage.png?alt=media&amp;token=7878f0cb-f2f9-4dc4-821c-4bd688593de0" 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="https://254647936-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzGccvqLYeyaJ6Dgazh7K%2Fuploads%2F8zyU4kldGWZCaxXsAOEP%2Fimage.png?alt=media&amp;token=57a64bcf-c534-4b83-83b2-7392052b63b3" 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="https://254647936-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzGccvqLYeyaJ6Dgazh7K%2Fuploads%2F5WKVo3zOfbsxtOaUf01q%2Fimage.png?alt=media&amp;token=71c4fe47-b0bc-40f0-b5aa-7e677050d6c8" 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="https://254647936-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzGccvqLYeyaJ6Dgazh7K%2Fuploads%2FPtR8n6k8SV8lfeETLAEz%2FBulb.png?alt=media&amp;token=ec7271f0-1bef-4992-8c04-b668b1e44ea6" 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="https://254647936-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzGccvqLYeyaJ6Dgazh7K%2Fuploads%2FF9LXWzQYmKDNwjybTtDn%2Fimage.png?alt=media&amp;token=04d7f0b1-8df3-424b-bbe9-9f098948b656" 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="https://254647936-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzGccvqLYeyaJ6Dgazh7K%2Fuploads%2FO2bvPPHg1XB3K9pyCKNr%2Fimage.png?alt=media&amp;token=7c24c349-5346-45fc-8aa7-bcaa59d83737" 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="https://254647936-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzGccvqLYeyaJ6Dgazh7K%2Fuploads%2FPtR8n6k8SV8lfeETLAEz%2FBulb.png?alt=media&amp;token=ec7271f0-1bef-4992-8c04-b668b1e44ea6" 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 %}
