Shortcuts

可视化 COCO 标签

脚本 tools/analysis_tools/browse_coco_json.py 能够使用可视化显示 COCO 标签在图片的情况。

python tools/analysis_tools/browse_coco_json.py [--data-root ${DATA_ROOT}] \
                                                [--img-dir ${IMG_DIR}] \
                                                [--ann-file ${ANN_FILE}] \
                                                [--wait-time ${WAIT_TIME}] \
                                                [--disp-all] [--category-names CATEGORY_NAMES [CATEGORY_NAMES ...]] \
                                                [--shuffle]

其中,如果图片、标签都在同一个文件夹下的话,可以指定 --data-root 到该文件夹,然后 --img-dir--ann-file 指定该文件夹的相对路径,代码会自动拼接。 如果图片、标签文件不在同一个文件夹下的话,则无需指定 --data-root ,直接指定绝对路径的 --img-dir--ann-file 即可。

例子:

  1. 查看 COCO 全部类别,同时展示 bboxmask 等所有类型的标注:

python tools/analysis_tools/browse_coco_json.py --data-root './data/coco' \
                                                --img-dir 'train2017' \
                                                --ann-file 'annotations/instances_train2017.json' \
                                                --disp-all

如果图片、标签不在同一个文件夹下的话,可以使用绝对路径:

python tools/analysis_tools/browse_coco_json.py --img-dir '/dataset/image/coco/train2017' \
                                                --ann-file '/label/instances_train2017.json' \
                                                --disp-all
  1. 查看 COCO 全部类别,同时仅展示 bbox 类型的标注,并打乱显示:

python tools/analysis_tools/browse_coco_json.py --data-root './data/coco' \
                                                --img-dir 'train2017' \
                                                --ann-file 'annotations/instances_train2017.json' \
                                                --shuffle
  1. 只查看 bicycleperson 类别,同时仅展示 bbox 类型的标注:

python tools/analysis_tools/browse_coco_json.py --data-root './data/coco' \
                                                --img-dir 'train2017' \
                                                --ann-file 'annotations/instances_train2017.json' \
                                                --category-names 'bicycle' 'person'
  1. 查看 COCO 全部类别,同时展示 bboxmask 等所有类型的标注,并打乱显示:

python tools/analysis_tools/browse_coco_json.py --data-root './data/coco' \
                                                --img-dir 'train2017' \
                                                --ann-file 'annotations/instances_train2017.json' \
                                                --disp-all \
                                                --shuffle
Read the Docs v: latest
Versions
latest
stable
dev
Downloads
pdf
html
epub
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.