mmdetection v.12.0 训练自己的数据库

新版本的mmdetection训练自己数据库,变得非常简单了,不需要亲自去定义新的数据库类别。

具体操作查看官网链接(传送门)即可

但是,这个官网上给出的修改方式中,有一个地方容易写错,导致报错,因此写了这篇博客,记录一下:

Prepare a config

The second step is to prepare a config thus the dataset could be successfully loaded. Assume that we want to use Mask R-CNN with FPN, the config to train the detector on balloon dataset is as below. Assume the config is under directory configs/balloon/ and named as mask_rcnn_r50_caffe_fpn_mstrain-poly_1x_balloon.py, the config is as below.

# The new config inherits a base config to highlight the necessary modification
_base_ = 'mask_rcnn/mask_rcnn_r50_caffe_fpn_mstrain-poly_1x_coco.py'

# We also need to change the num_classes in head to match the dataset's annotation
model = dict(
    roi_head=dict(
        bbox_head=dict(num_classes=1),
        mask_head=dict(num_classes=1)))

# Modify dataset related settings
dataset_type = 'COCODataset'
classes = ('balloon',) # 注意这里是tuple类型,而非dict,此外如果只有一个元素,必须加逗号
data = dict(
    train=dict(
        img_prefix='balloon/train/',
        classes=classes,
        ann_file='balloon/train/annotation_coco.json'),
    val=dict(
        img_prefix='balloon/val/',
        classes=classes,
        ann_file='balloon/val/annotation_coco.json'),
    test=dict(
        img_prefix='balloon/val/',
        classes=classes,
        ann_file='balloon/val/annotation_coco.json'))

# We can use the pre-trained Mask RCNN model to obtain higher performance
load_from = 'checkpoints/mask_rcnn_r50_caffe_fpn_mstrain-poly_3x_coco_bbox_mAP-0.408__segm_mAP-0.37_20200504_163245-42aa3d00.pth'

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
mmdetection v2.25.3是一个开源的目标检测工具包,用于进行物体检测任务。根据引用,安装mmdetection v2.25.3需要满足以下条件:torch版本为1.3,并且cuda版本为10.0或者高于10.0的版本。如果使用cuda为9.0的版本,则需要降低torch的版本。具体安装步骤可以参考官方网站提供的说明。首先,可以使用以下命令克隆mmdetection资源库: git clone https://github.com/open-mmlab/mmdetection.git 然后进入mmdetection目录: cd mmdetection 根据引用,如果是手动安装,还需要在mmdetection目录下通过命令下载checkpoint文件: mkdir checkpoints cd checkpoints wget http://download.openmmlab.com/mmdetection/v2.0/faster_rcnn/faster_rcnn_r50_fpn_1x_coco/faster_rcnn_r50_fpn_1x_coco_20200130-047c8118.pth 下载完成后,您就可以开始使用mmdetection v2.25.3进行目标检测任务了。 请注意,根据引用,在进行任何改动之前,建议使用命令"pip install -e ."将mmdetection安装到anaconda3的库中,以确保每次对代码的修改都能生效。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *3* [【干货】:配置环境anaconda3并安装最新版mmdetection](https://blog.csdn.net/qq_41375609/article/details/106512843)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"] - *2* [MMDetection的安装及验证](https://blog.csdn.net/qq_46311811/article/details/123767250)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值