Skip to content

Pairman/FastestDetV2

 
 

Repository files navigation

FastestDetV2 [中文]

🔥🔥Even faster and stronger than FastestDet🔥🔥
🔥🔥比FastestDet更快更强🔥🔥

Improvements

  • 2.5% mAP50 & 1% mAP50:95 improvement, with ~20% faster speed compared to FastestDet
  • Assign Guidance Module and SimOTA label assignment for better precision
  • Quantization-aware, reparameterizable MobileOne backbone and convolution modules
  • ⚡相比FastestDetmAP50提升2.5%,mAP50:95提升1%,同时速度提升约20%
  • 采用Assign Guidance ModuleSimOTA标签分配策略,以获得更好的精度
  • 基于支持量化感知训练、可重参数化的MobileOne骨干网络和卷积模块

Gallery

Benchmarks

Model mAP50 mAP50:95 Resolution Inference time (4x core) Inference time (1x core) Params (M)
FastestDetV2 27.8% 14.0% 352X352 2.83ms 6.95ms 0.33M
FastestDetV2-2x 36.6% 19.9% 352X352 6.81ms 19.88ms 1.22M
FastestDet 25.3% 13.0% 352X352 3.68ms 8.48ms 0.24M
NanoDet-m - 20.6% 320X320 7.76ms 22.23ms 0.95M
YOLOX-Nano - 25.8% 416X416 36.88ms 92.52ms 0.91M
YOLOv8n 56.8% 37.4% 640X640 57.03ms 122.63ms 7.2M

Tested on EmbedFire LubanCat-4 RK3588S ARM 4*Cortex-A76 CPU@2.0GHz, using NCNN.

Multi-platform Benchmarks

Device Computing backend System Framework Inference time (4x core) Inference time (1x core) 2x Inference time (4x core) 2x Inference time (1x core)
EmbedFire LubanCat-4 RK3588 (CPU) 1 Linux (arm64) NCNN 2.83ms 6.95ms 6.81ms 19.88ms
EmbedFire LubanCat-4 RK3588 (NPU) Linux (arm64) RKNN 7.067ms 2 7.532ms 8.04ms 3 9.56ms
Google Pixel 10 Pro XL Tensor G5 (CPU) Android (arm64) NCNN 2.69ms 3.88ms 4.66ms 6.26ms
OnePlus 6 Snapdragon 845 (CPU) Android (arm64) NCNN 4.73ms 8.14ms 11.56ms 17.84ms
Dell Precision 3630 Tower Core i9-9900 (CPU) 4 Linux (x86_64) NCNN 2.90m 7.31ms 6.86ms 19.94ms

1: At 2.0 GHz.
2, 3: RKNNLite.NPU_CORE_0_1_2 is used.
4: At 800MHz.

Model Zoo

Download Note
fastestdetv2.pth, fastestdetv2_unfused.pth
fastestdetv2-2x.pth, fastestdetv2-2x_unfused.pth
Model weights
qamobileone.pth
qamobileone-2x.pth
Backbone weights
fastestdetv2.apk Android demo
fastestdetv2.bin, fastestdetv2.param
fastestdetv2-2x.bin, fastestdetv2-2x.param
NCNN files
fastestdetv2.rknn
fastestdetv2-2x.rknn
RKNN files
fastestdetv2.onnx
fastestdetv2-2x.onnx
ONNX files
fastestdetv2.pt, fastestdetv2_ptq.arm.pt, fastestdetv2_ptq.x86.pt
fastestdetv2-2x.pt, fastestdetv2-2x_ptq.arm.pt, fastestdetv2-2x_ptq.x86.pt
TorchScript files

Usage

Dependencies

pip install -r requirements.txt

Datasets & Configurations

Datasets can be either in Darknet format (like FastestDet, using a text file to list image paths, with labels stored in separate .txt files in the same directory) or in YOLO format (like YOLOv8, where each image has a corresponding .txt label file in a seperate directory). Labels are in cls cx cy w h normalized bboxes.

The .yaml configurations file specifies dataset paths, model settings, and training hyperparameters. Dataset could be either in Darknet format or YOLO format. Class names can also be in a single text file with each line representing a class name. See configs/coco.yaml for example.

Evaluation & Testing

You can evaluate the model with a fused (reparameterized) model weights file.

python3 eval.py --configs CONFIGS_PATH --weight WEIGHTS_PATH

Or test it on an image:

python3 test.py --configs CONFIGS_PATH --weights WEIGHTS_PATH --image IMAGE_PATH

Training

Download the backbone weights and place it under weights/qamobileone.pth and weights/qamobileone-2x.pth, and run:

python3 train.py --configs CONFIGS_PATH

Or finetune it with an unfused weights file:

python3 train.py --configs CONFIGS_PATH --weights WEIGHTS_PATH

Deployment

ONNX & TorchScript

Export to ONNX and TorchScript format with:

python3 test.py --configs CONFIGS_PATH --weights WEIGHTS_PATH --export

PT2E PTQ

Post-training quantization for x86 (with X86InductorQuantizer) or arm (with XNNPackQuantizer) platforms, with fused weights:

python3 quant.py --configs CONFIGS_PATH --weights WEIGHTS_PATH --image IMAGE_PATH --target TARGET_PLATFORM

NCNN

Follow deploy/ncnn/README.md or deploy/ncnn_android/README.md (for Android).

RKNN

Follow deploy/rknn/README.md.

Citation

@misc{=FastestDetV2,
    title={FastestDetV2: Even faster and stronger than FastestDet},
    author={Pairman},
    howpublished = {\url{https://github.com/Pairman/FastestDetV2}},
    year={2025}
}

References

About

🔥🔥Even faster and stronger than FastestDet | 比FastestDet更快更强🔥🔥

Resources

License

Stars

Watchers

Forks

Contributors

Languages

  • Python 62.0%
  • Java 18.9%
  • C++ 18.6%
  • CMake 0.5%