This is the branch of YOLOV3 about using model compression tricks.The dataset used is PASCAL VOC(not use difficulty). The eval tool is the voc2010. If you want to see the original code, you can switch to master branch
Subsequently, i will continue to update the code, involving new papers and tips.
name | Train Dataset | Val Dataset | Params | Mult-Adds | Inference(GPU) | mAP | notes |
---|---|---|---|---|---|---|---|
YOLOV3-*-544 | 2007trainval + 2012trainval | 2007test | 61.63M | 55.94G | 23.87ms | 0.832 | darknet53 |
YOLOV3-*-544 | 2007trainval + 2012trainval | 2007test | 6.77M | 6.45G | 15.2ms | 0.792 | MobileNet-v2 & FPN(partly conv->dw+pw) |
YOLOV3-*-544 | 2007trainval + 2012trainval | 2007test | 6.84M | 6.51G | 16.31ms | 0.808 | MobileNet-v2 & FPN(generally conv->dw+pw) |
Note
:
- YOLOV3-*-544 means test image size is 544.
"*"
means the multi-scale. - In the test, the nms threshold is 0.5 and the conf_score is 0.01.
- Now only support the single gpu to train and test.
- Params and Mult-Adds are based on the torchsummaryX
There is basicallly no difference from the inference time on the gpu, but on the cpu depthwise conv of the pytorch is too slow.Now i don't have good way to test the time.
- Nvida GeForce RTX 2080 Ti
- CUDA10.0
- CUDNN7.0
- ubuntu 16.04
- Intel(R) Xeon(R) CPU E5-2678 v3 @ 2.50GHz
# install packages
pip3 install -r requirements.txt --user
- Data Augment (RandomHorizontalFlip, RandomCrop, RandomAffine, Resize)
- Step lr Schedule
- Multi-scale Training (320 to 640)
- Focal loss
- GIOU
- Label smooth
- Mixup
- Cosine lr
- MobileNet-V2
git clone https://github.com/Peterisfar/YOLOV3.git
update the "PROJECT_PATH"
in the params.py.
- Download Pascal VOC dataset : VOC 2012_trainval 、VOC 2007_trainval、VOC2007_test. put them in the dir, and update the
"DATA_PATH"
in the params.py. - Convert data format : Convert the pascal voc *.xml format to custom format (Image_path0 xmin0,ymin0,xmax0,ymax0,class0 xmin1,ymin1...)
cd YOLOV3 && git checkout model_compression && mkdir data
cd utils
python3 voc.py # get train_annotation.txt and test_annotation.txt in data/
- MobileNet-V2 pre-trained weight : mobilenetv2_1.0-0c6065bc.pth
- This repository test weight : best_mobilenet_v2.pt
Make dir weight/
in the YOLOV3 and put the weight file in.
Run the following command to start training and see the details in the config/yolov3_config_voc.py
WEIGHT_PATH=weight/mobilenetv2_1.0-0c6065bc.pth
CUDA_VISIBLE_DEVICES=0 nohup python3 -u train.py --weight_path $WEIGHT_PATH --gpu_id 0 > nohup.log 2>&1 &
Notes:
- Training steps could run the
"cat nohup.log"
to print the log. - It supports to resume training adding
--resume
, it will loadlast.pt
automaticly.
You should define your weight file path WEIGHT_FILE
and images file path IMAGE_FILE
WEIGHT_PATH=weight/best_mobilenet_v2.pt
DATA_TEST=./data/test # your own images
CUDA_VISIBLE_DEVICES=0 python3 test.py --weight_path $WEIGHT_PATH --gpu_id 0 --visiual $DATA_TEST --eval
The images can be seen in the data/
- EfficientNet
- OctvConv