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.

相关推荐
luod7 小时前
Python异常链
python
我不是QI8 小时前
周志华《机器学习---西瓜书》 一
人工智能·python·机器学习·ai
今天没ID8 小时前
Python 编程实战:从基础语法到算法实现 (1)
python
二川bro8 小时前
Python在AI领域应用全景:2025趋势与案例
开发语言·人工智能·python
棒棒的皮皮9 小时前
【Python】Open3d用于3D测高项目
python·3d·open3d
CodeLongBear9 小时前
Python数据分析: 数据可视化入门:Matplotlib基础操作与多坐标系实战
python·信息可视化·数据分析
李晨卓9 小时前
python学习之不同储存方式的操作方法
python·代码规范
站大爷IP9 小时前
实战:爬取某联招聘职位需求并生成词云——从零开始的完整指南
python
deephub10 小时前
从零开始:用Python和Gemini 3四步搭建你自己的AI Agent
人工智能·python·大语言模型·agent
咕白m62510 小时前
Python 实现 PDF 页面旋转
python