Dataset COCO12-Formats#
Introduzione#
Il dataset COCO12-Formats di Ultralytics è un dataset di test specializzato progettato per convalidare il caricamento delle immagini su 12 estensioni di formato di immagine supportate. Contiene 12 immagini (6 per il training, 6 per la validazione), ciascuna salvata in un formato diverso per garantire un test completo della pipeline di caricamento delle immagini.
Questo dataset è inestimabile per:
- Test del supporto dei formati immagine: verifica che i formati immagine comuni vengano caricati correttamente
- Pipeline CI/CD: test automatizzati della compatibilità dei formati
- Debug: isolamento di problemi specifici del formato nelle pipeline di addestramento
- Sviluppo: convalida di nuove aggiunte o modifiche ai formati
Quando gestisci i dataset su Ultralytics Platform, le immagini in uno qualsiasi di questi formati vengono gestite automaticamente, senza alcuna conversione manuale richiesta.
Formati supportati#
Il dataset include un'immagine per ciascuna delle 12 estensioni di formato supportate definite in ultralytics/data/utils.py:
| Formato | Estensione | Descrizione | Train/Val |
|---|---|---|---|
| AVIF | .avif | AV1 Image File Format (moderno) | Addestramento |
| BMP | .bmp | Bitmap - formato raster non compresso | Addestramento |
| DNG | .dng | Digital Negative - formato RAW di Adobe | Addestramento |
| HEIC | .heic | High Efficiency Image Coding | Addestramento |
| JPEG | .jpeg | JPEG con estensione completa | Addestramento |
| JPG | .jpg | JPEG con estensione breve | Addestramento |
| JP2 | .jp2 | JPEG 2000 - medico/geospaziale | Valutazione |
| MPO | .mpo | Multi-Picture Object (immagini stereo) | Valutazione |
| PNG | .png | Portable Network Graphics | Valutazione |
| TIF | .tif | TIFF con estensione breve | Valutazione |
| TIFF | .tiff | Tagged Image File Format | Valutazione |
| WebP | .webp | Formato immagine web moderno | Valutazione |
Struttura del dataset#
coco12-formats/
├── images/
│ ├── train/ # 6 images (avif, bmp, dng, heic, jpeg, jpg)
│ └── val/ # 6 images (jp2, mpo, png, tif, tiff, webp)
├── labels/
│ ├── train/ # Corresponding YOLO format labels
│ └── val/
└── coco12-formats.yaml # Dataset configurationDataset YAML#
Il dataset COCO12-Formats è configurato utilizzando un file YAML che definisce i percorsi del dataset e i nomi delle classi. Puoi esaminare il file ufficiale coco12-formats.yaml nel repository GitHub di Ultralytics.
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
# COCO12-Formats dataset (12 images testing all supported image formats) by Ultralytics
# Documentation: https://docs.ultralytics.com/datasets/detect/coco12-formats
# Example usage: yolo train data=coco12-formats.yaml
# parent
# ├── ultralytics
# └── datasets
# └── coco12-formats ← downloads here (1 MB)
# Train/val/test sets as 1) dir: path/to/imgs, 2) file: path/to/imgs.txt, or 3) list: [path/to/imgs1, path/to/imgs2, ..]
path: coco12-formats # dataset root dir
train: images/train # train images (relative to 'path') 6 images
val: images/val # val images (relative to 'path') 6 images
test: # test images (optional)
# Classes
names:
0: person
1: bicycle
2: car
3: motorcycle
4: airplane
5: bus
6: train
7: truck
8: boat
9: traffic light
10: fire hydrant
11: stop sign
12: parking meter
13: bench
14: bird
15: cat
16: dog
17: horse
18: sheep
19: cow
20: elephant
21: bear
22: zebra
23: giraffe
24: backpack
25: umbrella
26: handbag
27: tie
28: suitcase
29: frisbee
30: skis
31: snowboard
32: sports ball
33: kite
34: baseball bat
35: baseball glove
36: skateboard
37: surfboard
38: tennis racket
39: bottle
40: wine glass
41: cup
42: fork
43: knife
44: spoon
45: bowl
46: banana
47: apple
48: sandwich
49: orange
50: broccoli
51: carrot
52: hot dog
53: pizza
54: donut
55: cake
56: chair
57: couch
58: potted plant
59: bed
60: dining table
61: toilet
62: tv
63: laptop
64: mouse
65: remote
66: keyboard
67: cell phone
68: microwave
69: oven
70: toaster
71: sink
72: refrigerator
73: book
74: clock
75: vase
76: scissors
77: teddy bear
78: hair drier
79: toothbrush
# Download script/URL (optional)
download: https://github.com/ultralytics/assets/releases/download/v0.0.0/coco12-formats.zipRequisiti#
Alcuni formati richiedono dipendenze aggiuntive:
pip install pillow pillow-heif pillow-avif-pluginLibreria di sistema AVIF (opzionale)#
Affinché OpenCV possa leggere i file AVIF direttamente, libavif deve essere installato prima di compilare OpenCV:
brew install libavifIl pacchetto opencv-python installato tramite pip potrebbe non includere il supporto per AVIF poiché è precompilato. Ultralytics utilizza Pillow con pillow-avif-plugin come fallback per le immagini AVIF quando OpenCV manca del supporto.
Utilizzo#
Il dataset COCO12-Formats (1 MB) viene scaricato automaticamente la prima volta che avvii l'addestramento. Per addestrare un modello YOLO sul dataset COCO12-Formats, usa i seguenti esempi:
from ultralytics import YOLO
# Load a pretrained YOLO model
model = YOLO("yolo26n.pt")
# Train on COCO12-Formats to test 12 supported image formats
results = model.train(data="coco12-formats.yaml", epochs=1, imgsz=640)Note specifiche per formato#
AVIF (AV1 Image File Format)#
AVIF è un formato di immagine moderno basato sul codec video AV1, che offre un'eccellente compressione. Richiede pillow-avif-plugin:
pip install pillow-avif-pluginDNG (Digital Negative)#
DNG è il formato RAW aperto di Adobe basato su TIFF. Ai fini del test, il dataset utilizza file basati su TIFF con l'estensione .dng.
JP2 (JPEG 2000)#
JPEG 2000 è uno standard di compressione delle immagini basato su wavelet che offre una compressione e una qualità migliori rispetto al JPEG tradizionale. È comunemente usato nell'imaging medico (DICOM), nelle applicazioni geospaziali e nel cinema digitale. Supportato nativamente sia da OpenCV che da Pillow.
MPO (Multi-Picture Object)#
I file MPO vengono utilizzati per le immagini stereoscopiche (3D). Il dataset memorizza dati JPEG standard con l'estensione .mpo per il test del formato.
HEIC / HEIF (High Efficiency Image File Format)#
Entrambe le estensioni .heic e .heif fanno riferimento allo stesso contenitore ISO/IEC 23008-12. Per convenzione, .heic denota i file HEIF codificati in HEVC (la variante prodotta dai dispositivi Apple), mentre .heif è l'estensione ombrello più ampia.
Ultralytics decodifica entrambi tramite il fallback OpenCV → Pillow in ultralytics/utils/patches.py, che installa automaticamente pi-heif (leggero, solo decodifica) al primo utilizzo, senza alcuna configurazione manuale richiesta per la lettura. Per produrre tu stesso file HEIC/HEIF (ad esempio, ricodificando le immagini di esempio), installa il pacchetto completo pillow-heif, che include i codificatori:
pip install pillow-heifCasi d'uso#
Test CI/CD#
from ultralytics import YOLO
def test_image_formats():
"""Test that 12 supported image formats load correctly."""
model = YOLO("yolo26n.pt")
results = model.train(data="coco12-formats.yaml", epochs=1, imgsz=64)
assert results is not NoneConvalida dei formati#
from pathlib import Path
from ultralytics.data.utils import IMG_FORMATS
# Verify all dataset formats are supported
dataset_dir = Path("datasets/coco12-formats/images")
found_formats = {f.suffix[1:].lower() for f in dataset_dir.rglob("*.*")}
assert found_formats <= IMG_FORMATS, f"Unsupported formats: {found_formats - IMG_FORMATS}"Citazioni e riconoscimenti#
Se utilizzi il dataset COCO nella tua ricerca, ti preghiamo di citare:
@misc{lin2015microsoft,
title={Microsoft COCO: Common Objects in Context},
author={Tsung-Yi Lin and Michael Maire and Serge Belongie and Lubomir Bourdev and Ross Girshick and James Hays and Pietro Perona and Deva Ramanan and C. Lawrence Zitnick and Piotr Doll{\'a}r},
year={2015},
eprint={1405.0312},
archivePrefix={arXiv},
primaryClass={cs.CV}
}FAQ#
Il dataset COCO12-Formats è progettato per testare la compatibilità dei formati immagine nelle pipeline di addestramento YOLO di Ultralytics. Garantisce che 12 formati immagine supportati (AVIF, BMP, DNG, HEIC, JP2, JPEG, JPG, MPO, PNG, TIF, TIFF, WebP) vengano caricati ed elaborati correttamente.
Formati immagine diversi hanno caratteristiche uniche (compressione, profondità di bit, spazi colore). Testare tutti i formati garantisce:
- Codice di caricamento immagini robusto
- Compatibilità tra dataset diversi
- Rilevamento precoce di bug specifici del formato
- AVIF: Richiede
pillow-avif-plugin - HEIC: Richiede
pillow-heif
- AVIF: Richiede