2022.7.14:Optimize loss, adopt IOU aware based on smooth L1, and the AP is significantly increased by 0.7
Network | mAPval 0.5 | mAPval 0.5:0.95 | Resolution | Run Time(4xCore) | Run Time(1xCore) | Params(M) |
---|---|---|---|---|---|---|
yolov5s | 56.8% | 37.4% | 640X640 | 395.31ms | 1139.16ms | 7.2M |
yolov6n | - | 30.8% | 416X416 | 109.24ms | 445.44ms | 4.3M |
yolox-nano | - | 25.8% | 416X416 | 76.31ms | 191.16ms | 0.91M |
nanodet_m | - | 20.6% | 320X320 | 49.24ms | 160.35ms | 0.95M |
yolo-fastestv1.1 | 24.40% | - | 320X320 | 26.60ms | 75.74ms | 0.35M |
yolo-fastestv2 | 24.10% | - | 352X352 | 23.8ms | 68.9ms | 0.25M |
FastestDet | 25.3% | 13.0% | 352X352 | 23.51ms | 70.62ms | 0.24M |
Equipment | Computing backend | System | Framework | Run time(Single core) | Run time(Multi core) |
---|---|---|---|---|---|
Radxa rock3a | RK3568(arm-cpu) | Linux(aarch64) | ncnn | 70.62ms | 23.51ms |
Radxa rock3a | RK3568(NPU) | Linux(aarch64) | rknn | 28ms | - |
Qualcomm | Snapdragon 835(arm-cpu) | Android(aarch64) | ncnn | 32.34ms | 16.24ms |
Intel | i7-8700(X86-cpu) | Linux(amd64) | ncnn | 4.51ms | 4.33ms |
pip install -r requirements.txt
python3 test.py --yaml configs/coco.yaml --weight weights/weight_AP05:0.253207_280-epoch.pth --img data/3.jpg
11 0.344192634561 0.611 0.416430594901 0.262
14 0.509915014164 0.51 0.974504249292 0.972
.
├── train
│ ├── 000001.jpg
│ ├── 000001.txt
│ ├── 000002.jpg
│ ├── 000002.txt
│ ├── 000003.jpg
│ └── 000003.txt
└── val
├── 000043.jpg
├── 000043.txt
├── 000057.jpg
├── 000057.txt
├── 000070.jpg
└── 000070.txt
Generate a dataset path .txt file, the example content is as follows:
train.txt
/home/qiuqiu/Desktop/dataset/train/000001.jpg
/home/qiuqiu/Desktop/dataset/train/000002.jpg
/home/qiuqiu/Desktop/dataset/train/000003.jpg
val.txt
/home/qiuqiu/Desktop/dataset/val/000070.jpg
/home/qiuqiu/Desktop/dataset/val/000043.jpg
/home/qiuqiu/Desktop/dataset/val/000057.jpg
Generate the .names category label file, the sample content is as follows:
category.names
person
bicycle
car
motorbike
...
The directory structure of the finally constructed training data set is as follows:
.
├── category.names # .names category label file
├── train # train dataset
│ ├── 000001.jpg
│ ├── 000001.txt
│ ├── 000002.jpg
│ ├── 000002.txt
│ ├── 000003.jpg
│ └── 000003.txt
├── train.txt # train dataset path .txt file
├── val # val dataset
│ ├── 000043.jpg
│ ├── 000043.txt
│ ├── 000057.jpg
│ ├── 000057.txt
│ ├── 000070.jpg
│ └── 000070.txt
└── val.txt # val dataset path .txt file
DATASET:
TRAIN: "/home/qiuqiu/Desktop/coco2017/train2017.txt" # Train dataset path .txt file
VAL: "/home/qiuqiu/Desktop/coco2017/val2017.txt" # Val dataset path .txt file
NAMES: "dataset/coco128/coco.names" # .names category label file
MODEL:
NC: 80 # Number of detection categories
INPUT_WIDTH: 352 # The width of the model input image
INPUT_HEIGHT: 352 # The height of the model input image
TRAIN:
LR: 0.001 # Train learn rate
THRESH: 0.25 # ????
WARMUP: true # Trun on warm up
BATCH_SIZE: 64 # Batch size
END_EPOCH: 350 # Train epichs
MILESTIONES: # Declining learning rate steps
- 150
- 250
- 300
python3 train.py --yaml configs/coco.yaml
python3 eval.py --yaml configs/coco.yaml --weight weights/weight_AP05:0.253207_280-epoch.pth
COCO2017 evaluation
creating index...
index created!
creating index...
index created!
Running per image evaluation...
Evaluate annotation type *bbox*
DONE (t=30.85s).
Accumulating evaluation results...
DONE (t=4.97s).
Average Precision (AP) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.130
Average Precision (AP) @[ IoU=0.50 | area= all | maxDets=100 ] = 0.253
Average Precision (AP) @[ IoU=0.75 | area= all | maxDets=100 ] = 0.119
Average Precision (AP) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.021
Average Precision (AP) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.129
Average Precision (AP) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.237
Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets= 1 ] = 0.142
Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets= 10 ] = 0.208
Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.214
Average Recall (AR) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.043
Average Recall (AR) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.236
Average Recall (AR) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.372
python3 test.py --yaml configs/coco.yaml --weight weights/weight_AP05:0.253207_280-epoch.pth --img data/3.jpg --onnx
python3 test.py --yaml configs/coco.yaml --weight weights/weight_AP05:0.253207_280-epoch.pth --img data/3.jpg --torchscript
cd example/ncnn/
sh build.sh
./FastestDet
cd example/onnx-runtime
pip install onnx-runtime
python3 runtime.py
@misc{=FastestDet,
title={FastestDet: Ultra lightweight anchor-free real-time object detection algorithm.},
author={xuehao.ma},
howpublished = {\url{https://github.com/dog-qiuqiu/FastestDet}},
year={2022}
}