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.

相关推荐
青 春 记 忆11 小时前
零基础入门python20:Flask配置、扩展和蓝图拆分
python·flask·后端开发
m0_3807438712 小时前
为 OpenAI 兼容接口配置教程
开发语言·python·node.js
leisoo809714 小时前
ig50数据落盘ClickHousevsTimescaleDBvsDuckDB实测对比 IG50免费开源股票数据API接口
开发语言·jvm·数据库·python·json
卷无止境14 小时前
FastAPI 的 Metadata 到底是什么,又牵动了哪些核心概念
后端·python
卷无止境14 小时前
FastAPI 调试实战,从断点到生产环境的排错心法
后端·python
yaoxin52112314 小时前
503. Java 反射 - 编写 ServiceFactory 类
java·开发语言·python
kyrie_sakura15 小时前
python学习笔记3 -- 流程控制语句结构
笔记·python·学习
程序员小八77715 小时前
Java 快速转 Go
java·python·golang
梦想的旅途217 小时前
Python实现企业微信文本消息发送
开发语言·python·企业微信
%4717 小时前
DAY41
pytorch·python