High quality, fast, modular reference implementation of SSD in PyTorch 1.0

This repository implements SSD (Single Shot MultiBox Detector) . The implementation is heavily influenced by the projects ssd.pytorch , pytorch-ssd and maskrcnn-benchmark . This repository aims to be the code base for researches based on SSD.

Highlights PyTorch 1.0 GPU/CPU NMS Multi-GPU training and inference Modular Visualization(Support Tensorboard) CPU support for inference Installation Requirements python3 PyTorch 1.0 yacs GCC >= 4.9 OpenCV Build # build nms cd ext python build.py build_ext develop Train Setting Up Datasets Pascal VOC

For Pascal VOC dataset, make the folder structure like this:

VOC_ROOT |__ VOC2007 |_ JPEGImages |_ Annotations |_ ImageSets |_ SegmentationClass |__ VOC2012 |_ JPEGImages |_ Annotations |_ ImageSets |_ SegmentationClass |__ ...

Where VOC_ROOT default is datasets folder in current project, you can create symlinks to datasets or export VOC_ROOT="/path/to/voc_root" .

COCO

For COCO dataset, make the folder structure like this:

COCO_ROOT |__ annotations |_ instances_valminusminival2014.json |_ instances_minival2014.json |_ instances_train2014.json |_ instances_val2014.json |_ ... |__ train2014 |_ <im-1-name>.jpg |_ ... |_ <im-N-name>.jpg |__ val2014 |_ <im-1-name>.jpg |_ ... |_ <im-N-name>.jpg |__ ...

Where COCO_ROOT default is datasets folder in current project, you can create symlinks to datasets or export COCO_ROOT="/path/to/coco_root" .

Single GPU training # for example, train SSD300: python train_ssd.py --config-file configs/ssd300_voc0712.yaml --vgg vgg16_reducedfc.pth Multi-GPU training # for example, train SSD300 with 4 GPUs: export NGPUS=4 python -m torch.distributed.launch --nproc_per_node=$NGPUS train_ssd.py --config-file configs/ssd300_voc0712.yaml --vgg vgg16_reducedfc.pth

The configuration files that I provide assume that we are running on single GPU. When changing number of GPUs, hyper-parameter (lr, max_iter, ...) will also changed according to this paper: Accurate, Large Minibatch SGD: Training ImageNet in 1 Hour . The pre-trained vgg weights can be downloaded here: https://s3.amazonaws.com/amdegroot-models/vgg16_reducedfc.pth .

Demo

Predicting image in a folder is simple:

python demo.py --config-file configs/ssd300_voc0712.yaml --weights path/to/trained/weights.pth --images_dir demo

Then the predicted images with boxes, scores and label names will saved to demo/result folder.

Currently, I provide weights trained as follows:

Weights SSD300* ssd300_voc0712_mAP77.83.pth(100 MB) SSD512* ssd512_voc0712_mAP80.25.pth(104 MB) Performance Origin Paper: VOC2007 test SSD300* 77.2 SSD512* 79.8 Our Implementation: VOC2007 test SSD300* 77.8 SSD512* 80.2 Details: VOC2007 test SSD300* mAP: 0.7783 aeroplane : 0.8252 bicycle : 0.8445 bird : 0.7597 boat : 0.7102 bottle : 0.5275 bus : 0.8643 car : 0.8660 cat : 0.8741 chair : 0.6179 cow : 0.8279 diningtable : 0.7862 dog : 0.8519 horse : 0.8630 motorbike : 0.8515 person : 0.8024 pottedplant : 0.5079 sheep : 0.7685 sofa : 0.7926 train : 0.8704 tvmonitor : 0.7554 SSD512*

mAP: 0.8025 aeroplane : 0.8582 bicycle : 0.8710 bird : 0.8192 boat : 0.7410 bottle : 0.5894 bus : 0.8755 car : 0.8856 cat : 0.8926 chair : 0.6589 cow : 0.8634 diningtable : 0.7676 dog : 0.8707 horse : 0.8806 motorbike : 0.8512 person : 0.8316 pottedplant : 0.5238 sheep : 0.8191 sofa : 0.7915 train : 0.8735 tvmonitor : 0.7866

本文开发(python)相关术语:python基础教程 python多线程 web开发工程师 软件开发工程师 软件开发流程

代码区博客精选文章
分页:12
转载请注明
本文标题:High quality, fast, modular reference implementation of SSD in PyTorch 1.0
本站链接:https://www.codesec.net/view/621125.html


1.凡CodeSecTeam转载的文章,均出自其它媒体或其他官网介绍,目的在于传递更多的信息,并不代表本站赞同其观点和其真实性负责;
2.转载的文章仅代表原创作者观点,与本站无关。其原创性以及文中陈述文字和内容未经本站证实,本站对该文以及其中全部或者部分内容、文字的真实性、完整性、及时性,不作出任何保证或承若;
3.如本站转载稿涉及版权等问题,请作者及时联系本站,我们会及时处理。
登录后可拥有收藏文章、关注作者等权限...
技术大类 技术大类 | 开发(python) | 评论(0) | 阅读(87)