AutoMM 检测 - 准备 COCO2017 数据集¶
COCO 是一个大规模目标检测、分割和图像描述数据集。对于检测任务,最常用的是 COCO2017 版本,它拥有最多的训练数据。该数据集包含 80 个类别、123,287 张图像、886,284 个实例,图像的中位数分辨率为 640 x 480。本教程将逐步指导您准备此数据集以用于 Autogluon MultiModalPredictor。
下载和解压此数据集需要 42.7 GB 磁盘空间。由于性能更好,推荐使用 SSD 而非 HDD。准备数据集所需总时间取决于您的网络速度和磁盘性能。例如,在带有 EBS 的 AWS EC2 上通常需要 20 分钟。
COCO 有一个官方下载页面,但一步到位的设置总是更方便。我们准备了一个用于一步下载 COCO17 数据集的 bash 脚本:download_coco17.sh。或者,您也可以使用我们的 CLI 工具 prepare_detection_dataset
,它可以下载我们教程中提及的所有数据集。该 Python 脚本位于我们的代码库中:prepare_detection_dataset.py,您也可以将其作为 CLI 运行:python3 -m autogluon.multimodal.cli.prepare_detection_dataset
。
使用 Python 脚本下载¶
Python 脚本不显示进度条,但保证在所有主要平台都能工作。如果您在 Unix 系统上工作并需要进度条,请尝试 bash 脚本!
您可以通过运行以下命令,将其解压到当前目录下的 coco17 文件夹中
python3 -m autogluon.multimodal.cli.prepare_detection_dataset --dataset_name coco2017
或将其解压到指定输出路径下的 coco17 文件夹中
python3 -m autogluon.multimodal.cli.prepare_detection_dataset --dataset_name coco2017 --output_path ~/data
或者可以简化为
python3 -m autogluon.multimodal.cli.prepare_detection_dataset -d coco17 -o ~/data
使用 Bash 脚本下载¶
您可以通过运行以下命令,将其解压到当前目录下的 coco17 文件夹中
bash download_coco17.sh
或将其解压到指定输出路径下的 coco17 文件夹中
bash download_coco17.sh ~/data
命令行输出将显示进度条
extract data in ./coco17
--2022-11-02 20:19:49-- http://images.cocodataset.org/zips/train2017.zip
Resolving images.cocodataset.org (images.cocodataset.org)... 52.217.18.68
Connecting to images.cocodataset.org (images.cocodataset.org)|52.217.18.68|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 19336861798 (18G) [application/zip]
Saving to: ‘train2017.zip’
train2017.zip 100%[=========================================================================>] 18.01G 27.0MB/s in 7m 29s
2022-11-02 20:27:18 (41.1 MB/s) - ‘train2017.zip’ saved [19336861798/19336861798]
--2022-11-02 20:27:18-- http://images.cocodataset.org/zips/val2017.zip
Resolving images.cocodataset.org (images.cocodataset.org)... 54.231.171.137
Connecting to images.cocodataset.org (images.cocodataset.org)|54.231.171.137|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 815585330 (778M) [application/zip]
Saving to: ‘val2017.zip’
val2017.zip 100%[=========================================================================>] 777.80M 43.0MB/s in 20s
2022-11-02 20:27:38 (39.2 MB/s) - ‘val2017.zip’ saved [815585330/815585330]
--2022-11-02 20:27:38-- http://images.cocodataset.org/zips/test2017.zip
Resolving images.cocodataset.org (images.cocodataset.org)... 54.231.162.177
Connecting to images.cocodataset.org (images.cocodataset.org)|54.231.162.177|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 6646970404 (6.2G) [application/zip]
Saving to: ‘test2017.zip’
test2017.zip 100%[=========================================================================>] 6.19G 42.3MB/s in 2m 32s
2022-11-02 20:30:11 (41.6 MB/s) - ‘test2017.zip’ saved [6646970404/6646970404]
--2022-11-02 20:30:11-- http://images.cocodataset.org/zips/unlabeled2017.zip
Resolving images.cocodataset.org (images.cocodataset.org)... 52.217.71.116
Connecting to images.cocodataset.org (images.cocodataset.org)|52.217.71.116|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 20126613414 (19G) [application/zip]
Saving to: ‘unlabeled2017.zip’
unlabeled2017.zip 33%[========================> ] 6.37G 43.2MB/s eta 5m 45s
完成后,coco17 文件夹将包含以下内容
annotations test2017 train2017 unlabeled2017 val2017
COCO 格式¶
COCO 也指 COCO 数据集使用的特定格式(.json
文件)。在 Autogluon MultiModalPredictor 中,我们强烈建议您使用这种数据格式。请参阅将数据转换为 COCO 格式和AutoMM 检测 - 将 VOC 格式数据集转换为 COCO 格式,了解如何从头创建 COCO 格式数据集或从其他格式(尤其是 VOC 格式)转换数据集。
其他示例¶
您可以访问 AutoMM Examples,探索其他有关 AutoMM 的示例。
自定义¶
要了解如何自定义 AutoMM,请参阅自定义 AutoMM。
引用¶
@misc{https://doi.org/10.48550/arxiv.1405.0312,
doi = {10.48550/ARXIV.1405.0312},
url = {https://arxiv.org/abs/1405.0312},
author = {Lin, Tsung-Yi and Maire, Michael and Belongie, Serge and Bourdev, Lubomir and Girshick, Ross and Hays, James and Perona, Pietro and Ramanan, Deva and Zitnick, C. Lawrence and Dollár, Piotr},
keywords = {Computer Vision and Pattern Recognition (cs.CV), FOS: Computer and information sciences, FOS: Computer and information sciences},
title = {Microsoft COCO: Common Objects in Context},
publisher = {arXiv},
year = {2014},
copyright = {arXiv.org perpetual, non-exclusive license}
}