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.

相关推荐
西西弗Sisyphus几秒前
Python 处理图像并生成 JSONL 元数据文件 - 灵活text版本
开发语言·python
Taichi呀几秒前
PyCharm 快捷键指南
ide·python·pycharm
Stara05118 分钟前
基于注意力机制与iRMB模块的YOLOv11改进模型—高效轻量目标检测新范式
人工智能·python·深度学习·神经网络·目标检测·计算机视觉·yolov11
Python猫33 分钟前
付费专栏·Python潮流周刊电子书合集(epub、pdf、markdown)下载
python·计算机·pdf·电子书·资料
农民小飞侠1 小时前
ubuntu 24.04 error: cannot uninstall blinker 1.7.0, record file not found. hint
linux·运维·ubuntu
强化学习与机器人控制仿真1 小时前
openpi 入门教程
开发语言·人工智能·python·深度学习·神经网络·机器人·自动驾驶
BuLingLings2 小时前
vue3+flask+sqlite前后端项目实战
python·sqlite·flask
AA-代码批发V哥2 小时前
正则表达式: 从基础到进阶的语法指南
java·开发语言·javascript·python·正则表达式
进取星辰3 小时前
24、TypeScript:预言家之书——React 19 类型系统
linux·运维·ubuntu
缘友一世3 小时前
Pytorch常用统计和矩阵运算
人工智能·pytorch·python