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.

相关推荐
桃源学社(接毕设)13 分钟前
基于人工智能和物联网融合跌倒监控系统(LW+源码+讲解+部署)
人工智能·python·单片机·yolov8
yunhuibin25 分钟前
pycharm2025导入anaconda创建的各个AI环境
人工智能·python
杨荧36 分钟前
基于Python的电影评论数据分析系统 Python+Django+Vue.js
大数据·前端·vue.js·python
python-行者1 小时前
akamai鼠标轨迹
爬虫·python·计算机外设·akamai
R-G-B2 小时前
【P14 3-6 】OpenCV Python——视频加载、摄像头调用、视频基本信息获取(宽、高、帧率、总帧数)
python·opencv·视频加载·摄像头调用·获取视频基本信息·获取视频帧率·获取视频帧数
赵英英俊2 小时前
Python day46
python·深度学习·机器学习
weixin_307779134 小时前
AWS Lambda解压缩S3 ZIP文件流程
python·算法·云计算·aws
独行soc11 小时前
2025年渗透测试面试题总结-18(题目+回答)
android·python·科技·面试·职场和发展·渗透测试
morliz子轩12 小时前
基于WSL搭建Ubuntu 22.04.x LTS开发环境
linux·运维·ubuntu
S01d13r12 小时前
gunicorn + flask 处理高并发请求
python·flask·gunicorn