Link to this sectionCOCO12-Formatsデータセット#
Link to this sectionはじめに#
Ultralytics COCO12-Formatsデータセットは、サポートされている12種類の画像フォーマット拡張子全体の画像読み込みを検証するために設計された、専門的なテスト用データセットです。このデータセットには12枚の画像(トレーニング用に6枚、検証用に6枚)が含まれており、画像読み込みパイプラインの包括的なテストを確実にするため、それぞれ異なるフォーマットで保存されています。
このデータセットは以下の用途に最適です。
- 画像フォーマットのサポートテスト: 一般的な画像フォーマットが正しく読み込まれることを検証します。
- CI/CDパイプライン: フォーマット互換性の自動テストを実行します。
- デバッグ: トレーニングパイプラインにおけるフォーマット固有の問題を特定します。
- 開発: 新しいフォーマットの追加や変更を検証します。
Link to this sectionサポートされているフォーマット#
このデータセットには、ultralytics/data/utils.pyで定義されている12種類のサポート対象フォーマット拡張子ごとに1枚の画像が含まれています。
| 形式 | 拡張子 | 説明 | Train/Val |
|---|---|---|---|
| AVIF | .avif | AV1 Image File Format(モダン) | トレーニング |
| BMP | .bmp | Bitmap - 非圧縮ラスタフォーマット | トレーニング |
| DNG | .dng | Digital Negative - Adobe RAWフォーマット | トレーニング |
| HEIC | .heic | High Efficiency Image Coding | トレーニング |
| JPEG | .jpeg | JPEG(フル拡張子) | トレーニング |
| JPG | .jpg | JPEG(短縮拡張子) | トレーニング |
| JP2 | .jp2 | JPEG 2000 - 医療/地理空間用 | 検証 |
| MPO | .mpo | Multi-Picture Object(ステレオ画像) | 検証 |
| PNG | .png | Portable Network Graphics | 検証 |
| TIF | .tif | TIFF(短縮拡張子) | 検証 |
| TIFF | .tiff | Tagged Image File Format | 検証 |
| WebP | .webp | モダンなWeb用画像フォーマット | 検証 |
Link to this sectionデータセットの構造#
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 sectionデータセット YAML#
COCO12-Formatsデータセットは、データセットパスとクラス名を定義するYAMLファイルを使用して構成されています。公式のcoco12-formats.yamlファイルは、Ultralytics GitHubリポジトリで確認できます。
# 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 section要件#
一部のフォーマットには追加の依存関係が必要です。
pip install pillow pillow-heif pillow-avif-pluginLink to this sectionAVIFシステムライブラリ(オプション)#
OpenCVでAVIFファイルを直接読み込むには、OpenCVのビルド前にlibavifをインストールしておく必要があります。
brew install libavifpipでインストールされるopencv-pythonパッケージは、ビルド済みのためAVIFサポートが含まれていない場合があります。Ultralyticsでは、OpenCVがAVIFをサポートしていない場合のフォールバックとして、pillow-avif-pluginを使用したPillowを利用します。
Link to this section使用方法#
COCO12-FormatsデータセットでYOLOモデルをトレーニングするには、以下の例を使用してください。
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 sectionフォーマット固有の注意点#
Link to this sectionAVIF (AV1 Image File Format)#
AVIFはAV1ビデオコーデックに基づいたモダンな画像フォーマットで、優れた圧縮効率を提供します。これにはpillow-avif-pluginが必要です。
pip install pillow-avif-pluginLink to this sectionDNG (Digital Negative)#
DNGはTIFFベースのAdobeのオープンRAWフォーマットです。テスト目的のため、このデータセットでは.dng拡張子を持つTIFFベースのファイルを使用しています。
Link to this sectionJP2 (JPEG 2000)#
JPEG 2000はウェーブレットベースの画像圧縮規格であり、従来のJPEGよりも優れた圧縮率と画質を提供します。医療用画像(DICOM)、地理空間アプリケーション、デジタルシネマで一般的に使用されます。OpenCVとPillowの両方でネイティブサポートされています。
Link to this sectionMPO (Multi-Picture Object)#
MPOファイルは立体(3D)画像に使用されます。このデータセットでは、フォーマットテスト用に.mpo拡張子が付いた標準的なJPEGデータが格納されています。
Link to this sectionHEIC (High Efficiency Image Coding)#
HEICを適切にエンコードするにはpillow-heifパッケージが必要です。
pip install pillow-heifLink to this sectionユースケース#
Link to this sectionCI/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 sectionフォーマット検証#
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 section引用と謝辞#
研究でCOCOデータセットを使用する場合は、次のように引用してください。
@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 sectionよくある質問 (FAQ)#
Link to this sectionCOCO12-Formatsデータセットは何のために使用されますか?#
COCO12-Formatsデータセットは、Ultralytics YOLOトレーニングパイプラインにおける画像フォーマットの互換性をテストするために設計されています。サポートされている12種類の画像フォーマット(AVIF、BMP、DNG、HEIC、JP2、JPEG、JPG、MPO、PNG、TIF、TIFF、WebP)が正しく読み込まれ、処理されることを確認します。
Link to this sectionなぜ複数の画像フォーマットをテストするのですか?#
画像フォーマットごとに特性(圧縮率、ビット深度、色空間)が異なります。すべてのフォーマットをテストすることで、以下を確実にします。
- 堅牢な画像読み込みコード
- 多様なデータセット間での互換性
- フォーマット固有のバグの早期発見
Link to this section特別な依存関係が必要なフォーマットはどれですか?#
- AVIF:
pillow-avif-pluginが必要です - HEIC:
pillow-heifが必要です