Link to this sectionDataset COCO12-Formats#
Link to this sectionIntroduzione#
Il dataset Ultralytics COCO12-Formats è un dataset di test specializzato progettato per convalidare il caricamento delle immagini attraverso 12 estensioni di formato immagine supportate. Contiene 12 immagini (6 per l'addestramento, 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
Link to this sectionFormati 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 |
Link to this sectionStruttura 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 configurationLink to this sectionDataset 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.zipLink to this sectionRequisiti#
Alcuni formati richiedono dipendenze aggiuntive:
pip install pillow pillow-heif pillow-avif-pluginLink to this sectionLibreria di sistema AVIF (opzionale)#
Affinché OpenCV possa leggere direttamente i file AVIF, è necessario installare libavif prima di compilare OpenCV:
brew install libavifIl pacchetto opencv-python installato tramite pip potrebbe non includere il supporto AVIF poiché è pre-compilato. Ultralytics utilizza Pillow con pillow-avif-plugin come fallback per le immagini AVIF quando OpenCV non dispone del supporto.
Link to this sectionUtilizzo#
Per addestrare un modello YOLO sul dataset COCO12-Formats, utilizza 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)Link to this sectionNote specifiche per formato#
Link to this sectionAVIF (AV1 Image File Format)#
AVIF è un formato immagine moderno basato sul codec video AV1, che offre un'eccellente compressione. Richiede pillow-avif-plugin:
pip install pillow-avif-pluginLink to this sectionDNG (Digital Negative)#
DNG è il formato RAW aperto di Adobe basato su TIFF. A scopo di test, il dataset utilizza file basati su TIFF con estensione .dng.
Link to this sectionJP2 (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.
Link to this sectionMPO (Multi-Picture Object)#
I file MPO sono utilizzati per immagini stereoscopiche (3D). Il dataset memorizza dati JPEG standard con estensione .mpo per il test del formato.
Link to this sectionHEIC (High Efficiency Image Coding)#
HEIC richiede il pacchetto pillow-heif per una corretta codifica:
pip install pillow-heifLink to this sectionCasi d'uso#
Link to this sectionTest 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 NoneLink to this sectionConvalida 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}"Link to this sectionCitazioni 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}
}Link to this sectionFAQ#
Link to this sectionA cosa serve il dataset COCO12-Formats?#
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.
Link to this sectionPerché testare più formati immagine?#
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
Link to this sectionQuali formati richiedono dipendenze speciali?#
- AVIF: richiede
pillow-avif-plugin - HEIC: richiede
pillow-heif