English | [简体中文](README_CN.md) # BlazeFace Python Deployment Example Before deployment, two steps require confirmation - 1. Software and hardware should meet the requirements. Please refer to [FastDeploy Environment Requirements](../../../../../docs/en/build_and_install/download_prebuilt_libraries.md) - 2. Install FastDeploy Python whl package. Refer to [FastDeploy Python Installation](../../../../../docs/en/build_and_install/download_prebuilt_libraries.md) This directory provides examples that `infer.py` fast finishes the deployment of BlazeFace on CPU/GPU. ```bash # 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 ```python 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 > ```python > 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](../../../../../docs/api/vision_results/) for its description. ## Other Documents - [BlazeFace Model Description](..) - [BlazeFace C++ Deployment](../cpp) - [Model Prediction Results](../../../../../docs/api/vision_results/)