Skip to content

Latest commit

 

History

History

retinaface

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

English | 简体中文

RetinaFace Ready-to-deploy Model

Export ONNX Model

Download the pre-trained ONNX modelThe model has been converted to ONNX. If you downloaded the model from the RetinaFace official repo, please follow the tutorial below to export ONNX.

  • Download the official repository
git clone https://github.com/biubug6/Pytorch_Retinaface.git
  • Download the pre-trained weights and place them in the weights folder
./weights/
      mobilenet0.25_Final.pth
      mobilenetV1X0.25_pretrain.tar
      Resnet50_Final.pth
  • run convert_to_onnx.py to export ONNX model files
PYTHONPATH=. python convert_to_onnx.py --trained_model ./weights/mobilenet0.25_Final.pth --network mobile0.25 --long_side 640 --cpu
PYTHONPATH=. python convert_to_onnx.py --trained_model ./weights/Resnet50_Final.pth --network resnet50 --long_side 640 --cpu

Attention: We need to add a type constraint, type=int, to the --long_side parameter in the convert_to_onnx.py script.

  • Use onnxsim to simplify the model
onnxsim FaceDetector.onnx Pytorch_RetinaFace_mobile0.25-640-640.onnx  # mobilenet
onnxsim FaceDetector.onnx Pytorch_RetinaFace_resnet50-640-640.onnx  # resnet50

Download pre-trained ONNX models

For developers' testing, models exported by RetinaFace are provided below. Developers can download and use them directly. (The accuracy of the models in the table is sourced from the official library)

Model Size Accuracy
RetinaFace_mobile0.25-640 1.7MB -
RetinaFace_mobile0.25-720 1.7MB -
RetinaFace_resnet50-640 105MB -
RetinaFace_resnet50-720 105MB -

Detailed Deployment Tutorials

Release Note