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.

相关推荐
Kyln.Wu25 分钟前
【python实用小脚本-139】Python 在线图片批量下载器:requests+PIL 一键保存网络图像
数据库·python·php
江沉晚呤时9 小时前
在 C# 中调用 Python 脚本:实现跨语言功能集成
python·microsoft·c#·.net·.netcore·.net core
电脑能手10 小时前
如何远程访问在WSL运行的Jupyter Notebook
ide·python·jupyter
Edward-tan10 小时前
CCPD 车牌数据集提取标注,并转为标准 YOLO 格式
python
老胖闲聊10 小时前
Python I/O 库【输入输出】全面详解
开发语言·python
倔强青铜三11 小时前
苦练Python第18天:Python异常处理锦囊
人工智能·python·面试
倔强青铜三11 小时前
苦练Python第17天:你必须掌握的Python内置函数
人工智能·python·面试
迷路爸爸18011 小时前
让 VSCode 调试器像 PyCharm 一样显示 Tensor Shape、变量形状、变量长度、维度信息
ide·vscode·python·pycharm·debug·调试
咸鱼鲸12 小时前
【PyTorch】PyTorch中的数据预处理操作
人工智能·pytorch·python
Dxy123931021612 小时前
Python ExcelWriter详解:从基础到高级的完整指南
开发语言·python