mmdetection 训练cityscapes数据集笔记

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

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

  • 0
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 3
    评论
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值