2021-06-20 22:00:16 +00:00
---
title: Custom Metadata
---
Metadata can be customized as needed using: **meta** dictionaries:
* As a top-level key for metadata applying to entire frame
* In `rois` dictionaries, for metadata applying to individual ROIs.
## Usage
2021-09-09 10:17:46 +00:00
### Adding Frame Metadata
2021-06-20 22:00:16 +00:00
2024-03-05 10:00:32 +00:00
When instantiating a `SingleFrame` , metadata that applies to the entire frame can be
added as an argument:
2021-06-20 22:00:16 +00:00
```python
from allegroai import SingleFrame
# create a frame with metadata
frame = SingleFrame(
source='https://allegro-datasets.s3.amazonaws.com/tutorials/000012.jpg',
preview_uri='https://allegro-datasets.s3.amazonaws.com/tutorials/000012.jpg',
# insert metadata dictionary
metadata={'alive':'yes'},
)
# add metadata to the frame
frame.metadata['dangerous'] = 'no'
```
2021-09-09 10:17:46 +00:00
### Adding ROI Metadata
2021-06-20 22:00:16 +00:00
2024-03-05 10:00:32 +00:00
Metadata can be added to individual ROIs when adding an annotation to a `frame` , using [`SingleFrame.add_annotation()` ](../references/hyperdataset/singleframe.md#add_annotation ):
2021-06-20 22:00:16 +00:00
```python
2024-03-05 10:00:32 +00:00
frame.add_annotation(
box2d_xywh=(10, 10, 30, 20),
labels=['tiger'],
# insert metadata dictionary
metadata={'dangerous':'yes'}
)
2021-06-20 22:00:16 +00:00
```