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.

相关推荐
百***46453 分钟前
Java进阶-在Ubuntu上部署SpringBoot应用
java·spring boot·ubuntu
李昊哲小课36 分钟前
Ubuntu 24.04 MariaDB 完整安装与配置文档
linux·ubuntu·mariadb
惊讶的猫1 小时前
LSTM论文解读
开发语言·python
测试老哥2 小时前
软件测试之单元测试知识总结
自动化测试·软件测试·python·测试工具·职场和发展·单元测试·测试用例
buvsvdp50059ac2 小时前
如何在VSCode中设置Python解释器?
ide·vscode·python
njxiejing2 小时前
Python进度条工具tqdm的安装与使用
开发语言·python
剑动山河2 小时前
ubuntu 升级mysql由mysql5.7.42 升级到8.4.0
mysql·ubuntu·adb
Mr_Dwj3 小时前
【Python】Python 基本概念
开发语言·人工智能·python·大模型·编程语言