---
# System prepended metadata

title: Sample annotation

---

# Sample annotation for multi-category anomaly detection

## Template

A dictionary includes two primary keys: `anomaly_ids` and `annotations`. 
- Key `anomaly_ids` has the value as the dictionary mapping anomaly catogories to integer indices.
- Key `annotations` has keys as video names. Each key has the value as a list that each component in this list is the sub-dictionary includes three keys that are `frame_start`, `frame_end` and `anomalies`. Two keys `frame_start`, `frame_end` indicate the sequence of frames appearing anomalous events. `anomalies` has the value as a list. Each component in this list is a sub-dictionary includes three keys `frame_start`, `frame_end`, and `anomaly_ids`. The key `anomaly_ids` has the value as a integer list that includes indices as anomalous categories.

```[python3]
{
    "anomaly_ids": {
        "name-anomaly-1": int,
        "name-anomaly-2": int,
        ...
        "name-anomaly-n": int
    }
    "annotations": {
        "video-name-1_[num_frame]": {
            "frame-start": int,
            "frame-end": int,
            "anomalies": [
                {
                    "frame-start": int,
                    "frame-end": int,
                    "anomaly_ids": [int, int, ..., int]
                }
            ]
        },
        ...
        "video-name-n": {
            "frame-start": int,
            "frame-end": int,
            "anomalies": [
                {
                    "frame-start": int,
                    "frame-end": int,
                    "anomaly_ids": [int, int, ..., int]
                }
            ]
        }
    }
}
```

## Example

- Video name: DJI_0065 (1908 frames)
- Link video demo: [Link](https://drive.google.com/file/d/1RS4LXFY2bwS4NfiZ-dctGL59Epyh49BR/view?usp=drive_link)
- Sample json file: [Link](https://drive.google.com/file/d/1aBB5jlx6b8DHB9LMQylefQQ3_JN3cBNm/view?usp=sharing)

```[python3]
{
    "anomaly_ids": {
        "crossing-the-road-at-the-wrong-line": 0,
        "walking-under-the-street": 1,
        "driving-in-the-wrong-roundabout": 2,
        "driving-on-the-side-walk": 3,
        "illegal-turn": 4,
        "illegal-parking": 5,
        "carrying-bulky-goods": 6,
        "parking-on-the-sidewalk": 7,
        "driving-in-the-opposite-directions": 8,
        "falling-off-motorcycles": 9
    },
    "annotations": {
        "DJI_0065_1908": [
            {
                "frame_start": 17,
                "frame_end": 75,
                "anomalies": [
                    {
                        "frame_start": 17,
                        "frame_end": 75,
                        "anomaly_ids": [0],
                        "bbox": {
                            0: [[x1, y1, x2, y2], ..., [x1, y1, x2, y2]],
                        }
                    }
                ]
            },
            {
                "frame_start": 179,
                "frame_end": 287,
                "anomalies": [
                    {
                        "frame_start": 179,
                        "frame_end": 287,
                        "anomaly_ids": [4],
                        "bbox": {
                            4: [[x1, y1, x2, y2], ..., [x1, y1, x2, y2]],
                        }
                    }
                ]
            },
            {
                "frame_start": 371,
                "frame_end": 399,
                "anomalies": [
                    {
                        "frame_start": 371,
                        "frame_end": 399,
                        "anomaly_ids": [4],
                        "bbox": {
                            4: [[x1, y1, x2, y2], ..., [x1, y1, x2, y2]],
                        }
                    }
                ]
            },
            {
                "frame_start": 498,
                "frame_end": 555,
                "anomalies": [
                    {
                        "frame_start": 498,
                        "frame_end": 555,
                        "anomaly_ids": [4],
                        "bbox": {
                            4: [[x1, y1, x2, y2], ..., [x1, y1, x2, y2]],
                        }
                    }
                ]
            },
            {
                "frame_start": 800,
                "frame_end": 822,
                "anomalies": [
                    {
                        "frame_start": 800,
                        "frame_end": 822,
                        "anomaly_ids": [4],
                        "bbox": {
                            4: [[x1, y1, x2, y2], ..., [x1, y1, x2, y2]],
                        }
                    }
                ]
            },
            {
                "frame_start": 878,
                "frame_end": 905,
                "anomalies": [
                    {
                        "frame_start": 878,
                        "frame_end": 905,
                        "anomaly_ids": [4],
                        "bbox": {
                            4: [[x1, y1, x2, y2], ..., [x1, y1, x2, y2]],
                        }
                    }
                ]
            },
            {
                "frame_start": 1065,
                "frame_end": 1127,
                "anomalies": [
                    {
                        "frame_start": 1065,
                        "frame_end": 1090,
                        "anomaly_ids": [0, 4]
                        "bbox": {
                            0: [[x1, y1, x2, y2], ..., [x1, y1, x2, y2]],
                            4: [[x1, y1, x2, y2], ..., [x1, y1, x2, y2]],
                        }
                    },
                    {
                        "frame_start": 1091,
                        "frame_end": 1127,
                        "anomaly_ids": [4],
                        "bbox": {
                            4: [[x1, y1, x2, y2], ..., [x1, y1, x2, y2]],
                        }
                    }
                ]
            },
            {
                "frame_start": 1320,
                "frame_end": 1504,
                "anomalies": [
                    {
                        "frame_start": 1320,
                        "frame_end": 1504,
                        "anomaly_ids": [0],
                        "bbox": {
                            0: [[x1, y1, x2, y2], ..., [x1, y1, x2, y2]],
                        }
                    }
                ]
            },
            {
                "frame_start": 1696,
                "frame_end": 1778,
                "anomalies": [
                    {
                        "frame_start": 1696,
                        "frame_end": 1778,
                        "anomaly_ids": [4],
                        "bbox": {
                            4: [[x1, y1, x2, y2], ..., [x1, y1, x2, y2]],
                        }
                    }
                ]
            },
            {
                "frame_start": 1784,
                "frame_end": 1799,
                "anomalies": [
                    {
                        "frame_start": 1784,
                        "frame_end": 1799,
                        "anomaly_ids": [4],
                        "bbox": {
                            4: [[x1, y1, x2, y2], ..., [x1, y1, x2, y2]],
                        }
                    }
                ]
            }
        ]
    }
}
```