deploy insightface for face detection

bash 复制代码
conda create -n insightface python=3.8
conda activate insightface
pip install insightface
git clone https://github.com/deepinsight/insightface.git
cd insightface/python-package
pip install numpy opencv-python 
pip install onnxruntime-gpu
touch model_test.py
cd insightface/thirdparty/face3d/mesh/cython
python setup.py build_ext -i

the following codes for model_test.py

python 复制代码
import cv2
import numpy as np
import insightface
from insightface.app import FaceAnalysis
from insightface.data import get_image as ins_get_image

app = FaceAnalysis(providers=['CUDAExecutionProvider', 'CPUExecutionProvider'])
app.prepare(ctx_id=0, det_size=(640, 640))
img = ins_get_image('t1')
faces = app.get(img)
rimg = app.draw_on(img, faces)
cv2.imwrite("./t1_output.jpg", rimg)

then run python model_test.py, you will get the result.

For the video, you may modify model.test.py and set the input value as every frame.

相关推荐
tianyuanwo2 小时前
Rust开发完全指南:从入门到与Python高效融合
开发语言·python·rust
如何原谅奋力过但无声3 小时前
TensorFlow 2.x常用函数总结(持续更新)
人工智能·python·tensorflow
程序员-小李3 小时前
基于 Python + OpenCV 的人脸识别系统开发实战
开发语言·python·opencv
曾小蛙3 小时前
【ROS2+深度相机】在Ubuntu安装realsense-ros
ubuntu·realsense-ros·ros2 humble·d435
万粉变现经纪人3 小时前
如何解决 pip install 安装报错 [WinError 32] 文件被占用(杀毒/占用进程)问题
python·pycharm·flask·beautifulsoup·bug·pandas·pip
java1234_小锋3 小时前
[免费]基于Python的Flask酒店客房管理系统【论文+源码+SQL脚本】
开发语言·人工智能·python·flask·酒店客房
2401_841495644 小时前
【自然语言处理】生成式语言模型GPT复现详细技术方案
人工智能·python·gpt·深度学习·语言模型·自然语言处理·transformer
snakecy5 小时前
过关斩将编程题
开发语言·python
Blossom.1185 小时前
大模型在边缘计算中的部署挑战与优化策略
人工智能·python·算法·机器学习·边缘计算·pygame·tornado
diannao7205 小时前
实时将大模型的解决方案转换为随机应变的机器人指令
开发语言·windows·python·机器人