mirror of
https://github.com/PaddlePaddle/FastDeploy.git
synced 2025-10-06 17:17:14 +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
69 lines
2.7 KiB
Markdown
69 lines
2.7 KiB
Markdown
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
|
||
|
||
<img width="640" src="https://user-images.githubusercontent.com/67993288/184301839-a29aefae-16c9-4196-bf9d-9c6cf694f02d.jpg">
|
||
|
||
## 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/)
|