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.

相关推荐
TF男孩6 小时前
ARQ:一款低成本的消息队列,实现每秒万级吞吐
后端·python·消息队列
该用户已不存在11 小时前
Mojo vs Python vs Rust: 2025年搞AI,该学哪个?
后端·python·rust
站大爷IP13 小时前
Java调用Python的5种实用方案:从简单到进阶的全场景解析
python
用户83562907805118 小时前
从手动编辑到代码生成:Python 助你高效创建 Word 文档
后端·python
c8i18 小时前
python中类的基本结构、特殊属性于MRO理解
python
liwulin050619 小时前
【ESP32-CAM】HELLO WORLD
python
Doris_202319 小时前
Python条件判断语句 if、elif 、else
前端·后端·python
Doris_202319 小时前
Python 模式匹配match case
前端·后端·python
这里有鱼汤20 小时前
Python量化实盘踩坑指南:分钟K线没处理好,小心直接亏钱!
后端·python·程序员
绿箭柠檬茶20 小时前
Ubuntu 服务器配置转发网络访问
服务器·网络·ubuntu