mirror of
https://github.com/PaddlePaddle/FastDeploy.git
synced 2025-10-05 08:37:06 +08:00

* fit yolov7face file path * TODO:添加yolov7facePython接口Predict * resolve yolov7face.py * resolve yolov7face.py * resolve yolov7face.py * add yolov7face example readme file * [Doc] fix yolov7face example readme file * [Doc]fix yolov7face example readme file * support BlazeFace * add blazeface readme file * fix review problem * fix code style error * fix review problem * fix review problem * fix head file problem * fix review problem * fix review problem * fix readme file problem * add English readme file * fix English readme file
English | 简体中文
BlazeFace Python Deployment Example
Before deployment, two steps require confirmation
-
- Software and hardware should meet the requirements. Please refer to FastDeploy Environment Requirements
-
- Install FastDeploy Python whl package. Refer to FastDeploy Python Installation
This directory provides examples that infer.py
fast finishes the deployment of BlazeFace on CPU/GPU.
# Download the example code for deployment
git clone https://github.com/PaddlePaddle/FastDeploy.git
cd examples/vision/facedet/blazeface/python/
# Download BlazeFace model files and test images
wget https://raw.githubusercontent.com/DefTruth/lite.ai.toolkit/main/examples/lite/resources/test_lite_face_detector_3.jpg
wget https://bj.bcebos.com/paddlehub/fastdeploy/blazeface-1000e.tgz
# Use blazeface-1000e model
# CPU Inference
python infer.py --model blazeface-1000e/ --image test_lite_face_detector_3.jpg --device cpu
# GPU Inference
python infer.py --model blazeface-1000e/ --image test_lite_face_detector_3.jpg --device gpu
The visualized result after running is as follows

BlazeFace Python Interface
fastdeploy.vision.facedet.BlzaeFace(model_file, params_file=None, runtime_option=None, config_file=None, model_format=ModelFormat.PADDLE)
BlazeFace model loading and initialization, among which model_file is the exported PADDLE model format
Parameter
- model_file(str): Model file path
- params_file(str): Parameter file path. No need to set when the model is in PADDLE format
- config_file(str): config file path. No need to set when the model is in PADDLE format
- runtime_option(RuntimeOption): Backend inference configuration. None by default, which is the default configuration
- model_format(ModelFormat): Model format. PADDLE format by default
predict function
BlazeFace.predict(input_image)
Through let BlazeFace.postprocessor.conf_threshold = 0.2,to modify conf_threshold
Model prediction interface. Input images and output detection results.
Parameter
- input_image(np.ndarray): Input image in HWC or BGR format
Return
Return
fastdeploy.vision.FaceDetectionResult
structure. Refer to Vision Model Prediction Results for its description.