mmdetection 训练cityscapes数据集笔记

1.首先要下载cityscapes数据集,下载需要注册账户,只需要下载红框标注的两个文件,第一个是ground truth文件,第二个是原始图片,官网

mmdetection 训练cityscapes数据集笔记_第1张图片

https://github.com/mcordts/cityscapesScripts

上面网页包含cityscapesScripts脚本下载方法,和命令行使用的一些命令。

Prepare datasets

mmdetection
├── mmdet
├── tools
├── configs
├── data
│   ├── coco
│   │   ├── annotations
│   │   ├── train2017
│   │   ├── val2017
│   │   ├── test2017
│   ├── cityscapes
│   │   ├── annotations
│   │   ├── leftImg8bit
│   │   │   ├── train
│   │   │   ├── val
│   │   ├── gtFine
│   │   │   ├── train
│   │   │   ├── val
│   ├── VOCdevkit
│   │   ├── VOC2007
│   │   ├── VOC2012

The cityscapes annotations have to be converted into the coco format using

tools/convert_datasets/cityscapes.py
pip install cityscapesscripts
python tools/convert_datasets/cityscapes.py ./data/cityscapes --nproc 8 --out-dir ./data/cityscapes/annotations

 

备注:pycocotools需要安装mmdetection配套的cocoapi,否则会报

AttributeError: 'COCO' object has no attribute 'get_cat_ids'

2.Train with a single GPU

python tools/train.py ${CONFIG_FILE} [optional arguments]

Train with multiple GPUs

./tools/dist_train.sh ${CONFIG_FILE} ${GPU_NUM} [optional arguments]

3.Image demo

We provide a demo script to test a single image.

python demo/image_demo.py ${IMAGE_FILE} ${CONFIG_FILE} ${CHECKPOINT_FILE} [--device ${GPU_ID}] [--score-thr ${SCORE_THR}]

Examples:

python demo/image_demo.py demo/demo.jpg configs/faster_rcnn_r50_fpn_1x_coco.py
 checkpoints/faster_rcnn_r50_fpn_1x_20181010-3d1b3351.pth --device cpu

Webcam demo

python demo/webcam_demo.py ${CONFIG_FILE} ${CHECKPOINT_FILE} [--device ${GPU_ID}] [--camera-id ${CAMERA-ID}] [--score-thr ${SCORE_THR}]

Examples:

python demo/webcam_demo.py configs/faster_rcnn_r50_fpn_1x_coco.py  checkpoints/faster_rcnn_r50_fpn_1x_20181010-3d1b3351.pth

 

 

参考文献:

1.语义分割学习系列(三)cityscapes数据集介绍

2.【mmdetection】AttributeError: COCO object has no attribute get_cat_ids 错误

3.mmdetection-数据篇

4.Getting Started

你可能感兴趣的:(深度学习)