This repository is the official PyTorch implementation of the paper archived in ssFPN: Scale Sequence (S2) Feature Based-Feature Pyramid Network for Object Detection, arXiv [Categories: Computer Vision and Pattern Recognition (cs.CV)], arXiv ( https://arxiv.org/abs/2208.11533 ).
This is the implementation of Scaled-YOLOv4-P6-s2 (scale sequence) using PyTorch framwork.
Download other pre-trained models.
Model | Test Size | APtest | AP50test | AP75test | APStest | APMtest | APLtest | weights |
---|---|---|---|---|---|---|---|---|
YOLOv4-P5 | 896 | 51.4% | 69.9% | 56.3% | 33.1% | 55.4% | 62.4% | yolov4-p5.pt |
YOLOv4-P5-s2 | 896 | 52.3% | 70.7% | 57.4% | 34.2% | 56.2% | 63.7% | yolov4-p5-s2.pt |
Model | Test Size | APtest | AP50test | AP75test | APStest | APMtest | APLtest | weights |
---|---|---|---|---|---|---|---|---|
YOLOv4-P6 | 1280 | 54.3% | 72.3% | 59.5% | 36.6% | 58.2% | 65.5% | yolov4-p6.pt |
YOLOv4-P6-s2 | 1280 | 54.8% | 72.8% | 60.0% | 37.7% | 58.5% | 65.9% | yolov4-p6-s2.pt |
# download COCO dataset: ../coco
# create the docker container, you can change the share memory size if you have more.
nvidia-docker run --name yolov4_csp -it -v your_coco_path/:/coco/ -v your_code_path/:/yolo --shm-size=64g nvcr.io/nvidia/pytorch:20.06-py3
# install mish-cuda, if you use different pytorch version, you could try https://github.com/thomasbrandon/mish-cuda
cd /
git clone https://github.com/JunnYu/mish-cuda
cd mish-cuda
python setup.py build install
# go to code folder
cd /yolo
- Ubuntu 18.04 with Tesla V100
- Cuda 10.2
- torch 1.9.0
- torchvision 0.10.0
pip install -r requirements.txt
python test.py --img 1280 --conf 0.001 --batch 8 --device 0 --data coco.yaml --weights weights/yolov4-p6-s2.pt --task test
detections_val2017__results.json -> detections_test-dev2017_yolov4p6s2_results.json
detections_test-dev2017_yolov4p6s2_results.zip
4. Submit zip to COCO challenge official server
python test.py --img 1280 --conf 0.001 --batch 8 --device 0 --data coco.yaml --weights weights/yolov4-p6-s2.pt
You will get following results:
# yolov4-p6-s2
Average Precision (AP) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.544
Average Precision (AP) @[ IoU=0.50 | area= all | maxDets=100 ] = 0.726
Average Precision (AP) @[ IoU=0.75 | area= all | maxDets=100 ] = 0.597
Average Precision (AP) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.393
Average Precision (AP) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.588
Average Precision (AP) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.669
Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets= 1 ] = 0.400
Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets= 10 ] = 0.668
Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.726
Average Recall (AR) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.599
Average Recall (AR) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.763
Average Recall (AR) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.845
# yolov4-p6-s2
python -m torch.distributed.launch --nproc_per_node 3 train.py --batch-size 21 --img 1280 1280 --data data/coco.yaml --cfg models/yolov4-p6-sequence.yaml --sync-bn --epochs 300 --name yolov4-p6-s2 --device 0,1,2
python -m torch.distributed.launch --nproc_per_node 3 train.py --batch-size 21 --img 1280 1280 --data data/coco.yaml --cfg models/yolov4-p6-sequence.yaml --weight runs/exp0_yolov4-p6-s2/weights/last_298.pt --sync-bn --device 0,1,2,3 --name yolov4-p6-s2-tune --hyp 'data/hyp.finetune.yaml' --epochs 450 --resume