This is a SSD experiment reposity, the purpose is to reproduce some related papers based on SSD The code references SSD: Single Shot MultiBox Object Detector, in PyTorch and mmdet. Currently, some experiments are carried out on the VOC dataset, if you want to train your own dataset, you can refer to the part of training-yourself-dataset.
The fold structure as follow:
- config/
- config.py
- init.py
- data/
- init.py
- VOC.py
- VOCdevkit/
- model/
- build_ssd.py
- init.py
- backbone/
- neck/
- head/
- utils/
- utils/
- box/
- detection/
- loss/
- init.py
- tools/
- train.py
- eval.py
- test.py
- work_dir/
- pytorch 0.4.1
- python3+
- visdom
- for real-time loss visualization during training!
pip install visdom
- Start the server (probably in a screen or tmux)
python visdom
- Then (during training) navigate to http://localhost:8097/ (see the Train section below for training details).
- PASCAL VOC:Download VOC2007, VOC2012 dataset, then put VOCdevkit in the data directory
-
The pretrained model refer pretrained-models.pytorch,you can download it.
-
In the SSD_FPN_GIoU fold:
python tools/train.py
- Note:
- For training, default NVIDIA GPU.
- You can set the parameters in the train.py (see 'tools/train.py` for options)
- In the config,you can set the work_dir to save your training weight.(see 'configs/config.py`)
- if you want to selected the classficaiton and Regression Loss, you can to change the train_config. Now, we provide the classficaiton {FocalLoss,CrossEntropy},Regression {SmoothL1,Giou}.(see 'configs/config.py`)
- if you want to trainning yourself dataset, there are some steps:
- you need to make the dataset refer the VOC dataset, and take it to data/
- in the data/ ,you need make yourself-data.py, for example CRACK.py(it is my dataset), and change it according to your dataset. Also,in the init.py you can write something about your dataset
- change the config/ config.py, and make your dataset config,like CRACK(dict{})
- In the main,load your dataset.
- In the SSD_FPN_GIoU fold:
python tools/train.py
- To evaluate a trained network:
python eval.py --trained_model your_weight_address
- To test a trained network:
python test.py -- trained_model your_weight_address
if you want to visual the box, you can add the command --visbox True(default False)
- Backbone is the ResNet50:
Test | mAP(iou=0.5) | mAP(iou=0.6) | mAP(iou=0.75) |
---|---|---|---|
SSD | 75.49% | 70.87% | 53.44 % |
SSD+Gious | 76.09% | 71.01% | 54.70 % |
SSD+FPN | 78.99% | 73.18% | 55.19 % |
SSD+FPN+Gious | 78.96% | 73.35% | 55.83 % |
- SSD+FPN+Gious: GTX 1080ti: ~35 FPS
- Currently, we provide the following PyTorch models:
- SSD300 trained on VOC0712 (newest PyTorch SSD+FPN+Gious weights) Baidu DRIVE-raw.tar.gz , passward:zrx0