目标检测 SSD: Single Shot MultiBox Detector - PyTorch实现改进的MobileNetV3-SSD

本文介绍了使用PyTorch实现改进的MobileNetV3 - SSD进行目标检测。阐述了运行环境,提及提高mAP的方法,如先在COCO数据集训练再在VOC数据集微调。还给出了数据下载方式、首次训练、预加载模型训练及测试单张图片的命令。

目标检测 SSD: Single Shot MultiBox Detector - PyTorch实现改进的MobileNetV3-SSD

flyfish

MobileNetV3-SSD implementation in PyTorch

环境
操作系统: Ubuntu18.04
Python: 3.6
PyTorch: 1.1.0

关于第二个版本请移步
https://github.com/shaoshengsong/MobileNetV3-SSD-Compact-Version

有测试结果0.619mAP
如果还想提高mAP怎么办
本repo没有在COCO数据集下训练,只训练了VOC0712数据集
如果想得到更高的mAP,可以尝试下先在COCO数据集下训练,这时候得到的模型作为预训练模型,然后在VOC0712数据集中微调,最后再在VOC2007下测试,看看是不是会得到大于0.619mAP的数

我使用第二版的部分源码做的PyTorch版的VGG-SSD,测试不同的学习率
如果按照常规做法,在训练达到某个epoch 原学习率* 0.1 , 在训练达到某个epoch 原学习率*0.01这样最终结果会得到比原论文还优秀的0.77x mAP,x代表一个很大的个位数.
如果单独采用余弦退火,mAP可以到0.771mAP,低了0.00y.
所以想增加mAP可以尝试下常规做法的学习率.

下载地址:
https://github.com/shaoshengsong/MobileNetV3-SSD

使用MobileNetV3-SSD实现目标检测
代码参考(严重参考以下代码)

一 SSD部分
https://github.com/amdegroot/ssd.pytorch
A PyTorch Implementation of Single Shot MultiBox Detector

二 MobileNetV3 部分

1 https://github.com/xiaolai-sqlai/mobilenetv3
mobilenetv3 with pytorch,provide pre-train model

2 https://github.com/kuan-wang/pytorch-mobilenet-v3
MobileNetV3 in pytorch and ImageNet pretrained models

3 https://github.com/leaderj1001/MobileNetV3-Pytorch
Implementing Searching for MobileNetV3 paper using Pytorch

4 https://github.com/qfgaohao/pytorch-ssd (严重抄袭此处)
MobileNetV1-SSD/SSD-lite,MobileNetV2-SSD/SSD-lite部分

MobileNetV1, MobileNetV2, VGG based SSD/SSD-lite implementation in Pytorch 1.0 / Pytorch 0.4. Out-of-box support for retraining on Open Images dataset. ONNX and Caffe2 support. Experiment Ideas like CoordConv.
no discernible latency cost.

针对4我这里没有做MobileNetV1, MobileNetV2等等代码兼容,只有MobileNetV3可用

下载数据

本例是以蛋糕和面包为例,原因是数据量小
所有类别总大小是561G,蛋糕和面包是3.2G

命令行下载

python3 open_images_downloader.py --root /media/santiago/a/data/open_images --class_names ‘Cake,Bread’ --num_workers 20

数据集 百度网盘

只有蛋糕和面包
链接: https://pan.baidu.com/s/1s3QCpKiqeQICkWVdGD8FYQ 密码: gb7m

首次训练

python3 train_ssd.py --dataset_type open_images --datasets /media/santiago/data/open_images --net mb3-ssd-lite --scheduler cosine --lr 0.01 --t_max 100 --validation_epochs 5 --num_epochs 100 --base_net_lr 0.001 --batch_size 5

预加载之前训练的模型

python3 train_ssd.py --dataset_type open_images --datasets /media/santiago/data/open_images --net mb3-ssd-lite --pretrained_ssd models/mb3-ssd-lite-Epoch-99-Loss-2.5194434596402613.pth --scheduler cosine --lr 0.01 --t_max 100 --validation_epochs 5 --num_epochs 200 --base_net_lr 0.001 --batch_size 5

测试一张图片

python run_ssd_example.py mb3-ssd-lite models/mb3-ssd-lite-Epoch-99-Loss-2.5194434596402613.pth models/open-images-model-labels.txt /home/santiago/picture/test.jpg

评论 39
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

二分掌柜的

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值