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.

相关推荐
星期天要睡觉5 分钟前
深度学习——基于 ResNet18 的图像分类训练
pytorch·python·机器学习
林炳然6 分钟前
Python-Basic Day-1 基本元素(数字、字符串)
python
weixin_307779138 分钟前
在Linux服务器上使用Jenkins和Poetry实现Python项目自动化
linux·开发语言·python·自动化·jenkins
今天没有盐10 分钟前
内置基础类型之布尔值类型(bool)与时间与日期类型
python·编程语言
Empty_77713 分钟前
Python编程之常用模块
开发语言·网络·python
Q_Q51100828538 分钟前
python+uniapp基于微信小程序的学院设备报修系统
spring boot·python·微信小程序·django·flask·uni-app
蓝色空白的博客1 小时前
自动化测试脚本-->集成测试部署思路整理(1)
python·集成测试
Blossom.1181 小时前
把AI“绣”进丝绸:生成式刺绣神经网络让古装自带摄像头
人工智能·pytorch·python·深度学习·神经网络·机器学习·fpga开发
星星也在雾里2 小时前
【管理多版本Python环境】Anaconda安装及使用
python·anaconda
用户3721574261352 小时前
使用 Python 将 CSV 文件转换为 PDF 的实践指南
python