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.

相关推荐
weixin_377634845 分钟前
【python异步多线程】异步多线程爬虫代码示例
开发语言·爬虫·python
struggle202520 分钟前
PennyLane 是一个用于量子计算、量子机器学习和量子化学的跨平台 Python 库。由研究人员构建,用于研究
python·量子计算
扑克中的黑桃A20 分钟前
Python-素数
python
扑克中的黑桃A21 分钟前
Python学习的自我理解和想法(4)
python
扑克中的黑桃A30 分钟前
Python-打印杨辉三角(进阶版)
python
laity171 小时前
激活IDM的几种方法
python
gsls2008081 小时前
使用xdocreport导出word
前端·python·word
Johny_Zhao2 小时前
基于CentOS Stream 8的物联网数据采集与展示方案
linux·网络·python·mqtt·mysql·网络安全·信息安全·云计算·shell·yum源·系统运维
段帅龙呀2 小时前
Ubuntu系统复制(U盘-电脑硬盘)
linux·ubuntu
这里有鱼汤2 小时前
想成为下一个吉姆·西蒙斯,这十种经典K线形态你一定要记住
后端·python