Detectron2-使用内置数据集(官方文档中文翻译)


https://github.com/facebookresearch/detectron2/blob/master/datasets/README.md
使用内置数据集

数据集可以通过进入detectron2.data package API(或者class name)的数据被使用,这个文档解释了如何设置内置的数据集,以便它们可以被上面的api使用,Use Custom Datasets(之后会翻译Use Custom Datasets)
https://detectron2.readthedocs.io/tutorials/datasets.html 更好地教我们怎么用数据目录和元数据目录,怎么为他们添加新的数据集

Detectron2已经对一些数据集提供了支持,假定这些数据集存在于由环境变量(DETECTRON2_DATASETS)特定的目录中,在这个目录下,如果需要的话,detectron2将会在如下描述的结构中搜寻数据:

$DETECTRON2_DATASETS/ coco/ lvis/ cityscapes/ VOC20{07,12}/

你可以通过export DETECTRON2_DATASETS=/path/to/datasets为内置的数据集设置位置,如果不设置的话,对你的当前的工作目录来讲,默认的为./datasets,

model zoo包含了使用这些内置数据集的配置和模型

COCO instance/keypoint detection的理想型数据集结构:

coco/ annotations/ instances_{train,val}2017.json person_keypoints_{train,val}2017.json {train,val}2017/ # image files that are mentioned in the corresponding json

你同样可以使用2014版本的数据集

一些内置的测试(dev/run_*_tests.sh)使用了你可以用(./prepare_for_tests.sh)下载的COCO数据集tiny版本

PanopticFPN(语义分割和实例分割的FCN和Mask R-CNN结合起来的全景分割研究)的理想型数据集结构:

coco/ annotations/ panoptic_{train,val}2017.json panoptic_{train,val}2017/ # png annotations panoptic_stuff_{train,val}2017/ # generated by the script mentioned below

通过以下指令安装panopticapi:

pip install git+https://github.com/cocodataset/panopticapi.git

接着,运行 python prepare_panoptic_fpn.py 从展示全景的注释(panoptic annotations)提取语义标注

大规模的词汇实例分割数据集(LVIS instance segmentation)的理想型数据集结构:

coco/ {train,val,test}2017/ lvis/ lvis_v0.5_{train,val}.json lvis_v0.5_image_info_test.json lvis_v1_{train,val}.json lvis_v1_image_info_test{,_challenge}.json

安装lvis-api:

pip install git+https://github.com/lvis-dataset/lvis-api.git

运行 python prepare_cocofied_lvis.py 评估使用 LVIS annotations 在COCO数据集上训练的模型来准备“COCO化”的 LVIS annotations

(城市环境中驾驶场景)cityscapes 的理想型数据集结构:

cityscapes/ gtFine/ train/ aachen/ color.png, instanceIds.png, labelIds.png, polygons.json, labelTrainIds.png ... val/ test/ # below are generated Cityscapes panoptic annotation cityscapes_panoptic_train.json cityscapes_panoptic_train/ cityscapes_panoptic_val.json cityscapes_panoptic_val/ cityscapes_panoptic_test.json cityscapes_panoptic_test/ leftImg8bit/ train/ val/ test/
安装cityscapes scripts :

pip install git+https://github.com/mcordts/cityscapesScripts.git

注意:为了创造 labelTrainIds.png, 首先准备以上的结构,接着运行cityscapesescript with:

CITYSCAPES_DATASET=/path/to/abovementioned/cityscapes python cityscapesscripts/preparation/createTrainIdLabelImgs.py

实力分割不需要这些文件

注意:为了获得Cityscapes panoptic数据集,运行cityscapesescript with:

CITYSCAPES_DATASET=/path/to/abovementioned/cityscapes python cityscapesscripts/preparation/createPanopticImgs.py

语义(像素级别的分类)和实例分割(类的具体对象)不需要这些文件。(语义分割:人,实例分割:甲乙丙)

Pascal VOC期望的数据集结构:

VOC20{07,12}/ Annotations/ ImageSets/ Main/ trainval.txt test.txt # train.txt or val.txt, if you use these splits JPEGImages/

ADE20k Scene Parsing期望的数据集结构:

ADEChallengeData2016/ annotations/ annotations_detectron2/ images/ objectInfo150.txt

annotations_detectron2目录是通过运行 python prepare_ade20k_sem_seg.py 生成的。


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM