快捷键

数据集准备

本页提供在现有基准上进行数据集准备的说明,包括:

1. 下载数据集

请从官方网站下载数据集。建议将数据集的根目录符号链接到 $MMDETECTION/data

1.1 多目标跟踪

  • 对于多目标跟踪任务的训练和测试,需要使用 MOT 挑战赛数据集之一(例如 MOT17、MOT20),CrowdHuman 可以作为补充数据集。

  • 对于中国用户,以下数据集可以从 OpenDataLab 高速下载:

1.2 视频实例分割

  • 对于视频实例分割任务的训练和测试,只需要使用 YouTube-VIS 数据集之一(例如 YouTube-VIS 2019、YouTube-VIS 2021)。

  • YouTube-VIS 2019 数据集可以从 YouTubeVOS 下载。

  • YouTube-VIS 2021 数据集可以从 YouTubeVOS 下载。

1.3 数据结构

如果您的文件夹结构与以下不同,您可能需要更改配置文件中的相应路径。

mmdetection
├── mmdet
├── tools
├── configs
├── data
│   ├── coco
│   │   ├── train2017
│   │   ├── val2017
│   │   ├── test2017
│   │   ├── annotations
│   │
|   ├── MOT15/MOT16/MOT17/MOT20
|   |   ├── train
|   |   |   ├── MOT17-02-DPM
|   |   |   |   ├── det
|   │   │   │   ├── gt
|   │   │   │   ├── img1
|   │   │   │   ├── seqinfo.ini
│   │   │   ├── ......
|   |   ├── test
|   |   |   ├── MOT17-01-DPM
|   |   |   |   ├── det
|   │   │   │   ├── img1
|   │   │   │   ├── seqinfo.ini
│   │   │   ├── ......
│   │
│   ├── crowdhuman
│   │   ├── annotation_train.odgt
│   │   ├── annotation_val.odgt
│   │   ├── train
│   │   │   ├── Images
│   │   │   ├── CrowdHuman_train01.zip
│   │   │   ├── CrowdHuman_train02.zip
│   │   │   ├── CrowdHuman_train03.zip
│   │   ├── val
│   │   │   ├── Images
│   │   │   ├── CrowdHuman_val.zip
│   │

2. 转换标注

在这种情况下,您需要将官方标注转换为 coco 样式。我们提供脚本,用法如下:

# MOT17
# The processing of other MOT Challenge dataset is the same as MOT17
python ./tools/dataset_converters/mot2coco.py -i ./data/MOT17/ -o ./data/MOT17/annotations --split-train --convert-det
python ./tools/dataset_converters/mot2reid.py -i ./data/MOT17/ -o ./data/MOT17/reid --val-split 0.2 --vis-threshold 0.3

# CrowdHuman
python ./tools/dataset_converters/crowdhuman2coco.py -i ./data/crowdhuman -o ./data/crowdhuman/annotations

# YouTube-VIS 2019
python ./tools/dataset_converters/youtubevis2coco.py -i ./data/youtube_vis_2019 -o ./data/youtube_vis_2019/annotations --version 2019

# YouTube-VIS 2021
python ./tools/dataset_converters/youtubevis2coco.py -i ./data/youtube_vis_2021 -o ./data/youtube_vis_2021/annotations --version 2021

运行这些脚本后,文件夹结构将如下所示:

mmdetection
├── mmtrack
├── tools
├── configs
├── data
│   ├── coco
│   │   ├── train2017
│   │   ├── val2017
│   │   ├── test2017
│   │   ├── annotations
│   │
|   ├── MOT15/MOT16/MOT17/MOT20
|   |   ├── train
|   |   |   ├── MOT17-02-DPM
|   |   |   |   ├── det
|   │   │   │   ├── gt
|   │   │   │   ├── img1
|   │   │   │   ├── seqinfo.ini
│   │   │   ├── ......
|   |   ├── test
|   |   |   ├── MOT17-01-DPM
|   |   |   |   ├── det
|   │   │   │   ├── img1
|   │   │   │   ├── seqinfo.ini
│   │   │   ├── ......
|   |   ├── annotations
|   |   ├── reid
│   │   │   ├── imgs
│   │   │   ├── meta
│   │
│   ├── crowdhuman
│   │   ├── annotation_train.odgt
│   │   ├── annotation_val.odgt
│   │   ├── train
│   │   │   ├── Images
│   │   │   ├── CrowdHuman_train01.zip
│   │   │   ├── CrowdHuman_train02.zip
│   │   │   ├── CrowdHuman_train03.zip
│   │   ├── val
│   │   │   ├── Images
│   │   │   ├── CrowdHuman_val.zip
│   │   ├── annotations
│   │   │   ├── crowdhuman_train.json
│   │   │   ├── crowdhuman_val.json
│   │
│   ├── youtube_vis_2019
│   │   │── train
│   │   │   │── JPEGImages
│   │   │   │── ......
│   │   │── valid
│   │   │   │── JPEGImages
│   │   │   │── ......
│   │   │── test
│   │   │   │── JPEGImages
│   │   │   │── ......
│   │   │── train.json (the official annotation files)
│   │   │── valid.json (the official annotation files)
│   │   │── test.json (the official annotation files)
│   │   │── annotations (the converted annotation file)
│   │
│   ├── youtube_vis_2021
│   │   │── train
│   │   │   │── JPEGImages
│   │   │   │── instances.json (the official annotation files)
│   │   │   │── ......
│   │   │── valid
│   │   │   │── JPEGImages
│   │   │   │── instances.json (the official annotation files)
│   │   │   │── ......
│   │   │── test
│   │   │   │── JPEGImages
│   │   │   │── instances.json (the official annotation files)
│   │   │   │── ......
│   │   │── annotations (the converted annotation file)

MOT15/MOT16/MOT17/MOT20 中的标注和 reid 文件夹

以 MOT17 数据集为例,其他数据集的结构类似。

data/MOT17/annotations 中有 8 个 JSON 文件:

train_cocoformat.json:包含 MOT17 数据集训练集标注信息的 JSON 文件。

train_detections.pkl:包含 MOT17 数据集训练集的公开检测结果的 Pickle 文件。

test_cocoformat.json:包含 MOT17 数据集测试集标注信息的 JSON 文件。

test_detections.pkl:包含 MOT17 数据集测试集的公开检测结果的 Pickle 文件。

half-train_cocoformat.jsonhalf-train_detections.pklhalf-val_cocoformat.jsonhalf-val_detections.pkl 的含义与 train_cocoformat.jsontrain_detections.pkl 相似。 half 表示我们将训练集中每个视频拆分为一半。 前半部分视频被称为 half-train 集,后半部分视频被称为 half-val 集。

data/MOT17/reid 的结构如下:

reid
├── imgs
│   ├── MOT17-02-FRCNN_000002
│   │   ├── 000000.jpg
│   │   ├── 000001.jpg
│   │   ├── ...
│   ├── MOT17-02-FRCNN_000003
│   │   ├── 000000.jpg
│   │   ├── 000001.jpg
│   │   ├── ...
├── meta
│   ├── train_80.txt
│   ├── val_20.txt

train_80.txt 中的 80 表示训练数据集占整个 ReID 数据集的比例为 80%。 验证数据集的比例为 20%。

对于训练,我们提供了一个标注列表 train_80.txt。 列表的每一行包含一个文件名及其相应的真实标签。 格式如下:

MOT17-05-FRCNN_000110/000018.jpg 0
MOT17-13-FRCNN_000146/000014.jpg 1
MOT17-05-FRCNN_000088/000004.jpg 2
MOT17-02-FRCNN_000009/000081.jpg 3

MOT17-05-FRCNN_000110 表示 MOT17-05-FRCNN 视频中的第 110 个人。

对于验证,标注列表 val_20.txt 的格式与上述相同。

reid/imgs 中的图像根据相应的 gt.txtMOT17/train 中的原始图像裁剪。 真实标签的值应在范围 [0, num_classes - 1] 内。

CrowdHuman 中的标注文件夹

data/crowdhuman/annotations 中有 2 个 JSON 文件:

crowdhuman_train.json:包含 CrowdHuman 数据集训练集标注信息的 JSON 文件。 crowdhuman_val.json:包含 CrowdHuman 数据集验证集标注信息的 JSON 文件。

youtube_vis_2019/youtube_vis2021 中的标注文件夹

data/youtube_vis_2019/annotationsdata/youtube_vis_2021/annotations 中有 3 个 JSON 文件:

youtube_vis_2019_train.json/youtube_vis_2021_train.json:包含 youtube_vis_2019/youtube_vis2021 数据集训练集标注信息的 JSON 文件。

youtube_vis_2019_valid.json/youtube_vis_2021_valid.json:包含 youtube_vis_2019/youtube_vis2021 数据集验证集标注信息的 JSON 文件。

youtube_vis_2019_test.json/youtube_vis_2021_test.json:包含 youtube_vis_2019/youtube_vis2021 数据集测试集标注信息的 JSON 文件。