# Formato COCO para datasets de imágenes
La estructura general de un archivo JSON de imágenes es:
```
{
"info": info,
"images": [image],
"annotations": [annotation],
"categories": [category]
}
```
Los objetos `info` tienen la siguiente estructura:
```
info {
# Required
"version": str,
"description": str,
# Optional
"year": int,
"contributor": str,
# String representing date in format "YYYY/mm/dd"
"date_created": str,
"collection": str,
"url": str,
"type": str
}
```
Los objetos `image` tienen la siguiente estructura:
```
image {
# Required
"id": str,
"file_name" : str,
# Optional
"width" : int,
"height" : int,
# String representing datetime in format "YYYY-mm-dd HH:MM:SS"
"date_captured": str,
"location": str,
# For remote stored files
"url": str
}
```
Los objetos `annotation` tienen la siguiente estructura:
```
annotation {
# Required
"id": str,
"image_id": str,
"category_id": int,
# For object level annotations
# Bounding boxes are in absolute, floating-point coordinates,
# with the origin at the upper-left
"bbox": [x,y,width,height]
}
```
Una etiqueta a nivel de imagen no tendrán el campo bbox.
Los objetos category tienen la siguiente estructura:
```
category {
# Required
"id": int,
"name": str,
# For taxonomic related categories
"category_path": str
}
```
El campo `category_path` se compone de los ids separados por comas de cada uno de los niveles taxonómicos de un organismo, teniendo cada nivel en la jerarquía taxonómica las siguientes posiciones:
reino,phylum,clase,orden,familia,género,especie,subespecie
Si un organismo no tiene algún nivel taxonómico, el valor de esa posición será vacío.
Un ejemplo de un archivo JSON generado sería el siguiente:
```
{
"info": {
"url": "https://snmb.conabio.gob.mx",
"date_created": "2019/03/01",
"description": "SNMB 2019 Dataset",
"version": "detection",
"collection": "snmb",
"contributor": "Sistema Nacional de Monitoreo de la Biodiversidad",
"year": 2019
},
"images": [
{
"location": "110296",
"url": "http://coati.conabio.gob.mx/archivos/110296/2014_11/fotos_videos/Archivo_camara.a6c9d2fd6fd5ccb3.JPG",
"date_captured": "2014-11-24 00:00:00",
"id": "ESP-51750",
"width": 1.0,
"height": 1.0,
"file_name": "Archivo_camara.a6c9d2fd6fd5ccb3.JPG"
},...
],
"annotations": [
{
"category_id": 23837,
"bbox": [
0.567979669631512,
0.5694915254237288,
0.08005082592121981,
0.12203389830508471
],
"image_id": "ESP-51750",
"id": "ff8e6dcd-31a2-e534-0f22-6b11d286a161"
},...
],
"categories": [
{
"category_path": "1,213407,22647,22694,22939,23837,,",
"name": "Sceloporus",
"id": 23837
},...
]
}
```