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.

相关推荐
這花開嗎几秒前
2026年TTS文字转语音API哪家强?批量自动化配音成本与技术实测
python·flask·自动化
笨蛋不要掉眼泪14 分钟前
Java虚拟机:常用参数
java·开发语言·python
2501_9095091040 分钟前
DAY 31
python
李昊哲小课1 小时前
FastAPI 猫咖预约系统 API
人工智能·python·fastapi
你驴我1 小时前
WhatsApp 消息撤回与编辑的幂等性设计实践
java·服务器·前端·后端·python
向日的葵0061 小时前
Redis会话机制vsJWT机制深度解析
数据库·redis·python·缓存·系统架构·jwt
祉猷并茂,雯华若锦1 小时前
Win下完美解决Allure报错,生成Web自动化测试报告
android·python·selenium·自动化
Sirius.z1 小时前
第R4周:LSTM-火灾温度预测
python
cui_ruicheng2 小时前
Python数据分析(一):数据分析概述与环境搭建
开发语言·python·数据分析