# attributes

Attributes in the context of the VisionAI format refer to an alias assigned to element data that can be nested within geometric object data. For instance, a bounding box may have attributes related to its score, visibility, or other features.\
These attribute values can be nested within the object (ex. boundingbox) data itself.

## Schema

{% @mermaid/diagram content="erDiagram
object\_data ||--|{ OBJECT\_TYPE : contains
OBJECT\_TYPE ||--|| attributes : contains
attributes ||--|{ ATTRIBUTE\_TYPE : contains
object\_data {
OBJECT\_TYPE object
}
OBJECT\_TYPE {
name string
val array
stream string
confidence\_score number
attributes object
}
attributes {
ATTRIBUTE\_TYPE array\_of\_objects
}
ATTRIBUTE\_TYPE {
name string
val according\_to\_attribute\_type
}" %}

### Example

```json
{
    "boolean": [{
            "name": "visible",
            "val": true
        },{
            "name": "touchable",
            "val": false
    }],

    "text": [{
        "name": "company",
        "val": "linker"
    },{
        "name": "branch",
        "val": "taipei"
    }],

    "number": [{
        "name": "height",
        "val": 180
    },{
        "name": "weight",
        "val": 75
    }],

    "vec": [{
        "name": "locations",
        "val": ["taipei", "tainan"]
    },{
        "name": "projects",
        "val": ["mlops", "auto_labeling"]
    }]
}
```

### attributes {}

An attribute can be any combination of the following types below. Each type is an array. All values with the same type will be in the same array.

<table><thead><tr><th width="132">name</th><th width="338">description</th><th width="172">type</th><th>required</th></tr></thead><tbody><tr><td>boolean</td><td>The boolean type attribute means a result that can only have one of two possible values: true or false.</td><td>array of objects</td><td>false</td></tr><tr><td>num</td><td>The number type attribute defines a floating-point number and is defined by a name key, and val key.</td><td>array of objects</td><td>false</td></tr><tr><td>text</td><td>The text type attribute is a string to represent textual information.</td><td>array of objects</td><td>false</td></tr><tr><td>vec</td><td>The vec type attribute is an array of text. It represents the options of the attribute and possibly has the same properties as the other generic attributes.</td><td>array of objects</td><td>false</td></tr></tbody></table>

#### attribute\_type objects

<table><thead><tr><th>name</th><th width="370">description</th><th width="184">type</th><th>required</th></tr></thead><tbody><tr><td>name</td><td>The name of this attribute.</td><td>string</td><td>true</td></tr><tr><td>val</td><td>The value of this attribute follows the table defined above.<br>➤ boolean: boolean<br>➤ num: float<br>➤ text: string<br>➤ vec: array of strings</td><td>describe in the description</td><td>true</td></tr></tbody></table>

{% hint style="info" %}
NOTE: The attribute name and the vec type array items name may only contain lowercase letters, numbers, and hyphens (-), and must begin and end with a letter or a number. Each hyphen (-) must be preceded and followed by a non-hyphen character. The name must also be between 3 and 40 characters long.
{% endhint %}

***

## Use Case

### bbox with attributes

To describe a bbox dataset with one camera sensor:

* sensor: camera (#camera1)
* ontology:
  * people
    * ischild - boolean (static info)
    * direction - front, left, right, back (dynamic info)
    * age - number (static info)
  * car
    * color - white, silver, blue, red, black (static info)
  * truck
  * bus

Example Code

{% content-ref url="../../use-case/bbox" %}
[bbox](https://linkervision.gitbook.io/dataverse/visionai-format/use-case/bbox)
{% endcontent-ref %}
