用于检测面部情绪的Pythorch库
PyEmotion的Python项目详细描述
皮埃莫
PyEmotion-Version 1.0.0一个使用PyTorch进行面部情感识别的Python包。PyEmotion是一个python包,它可以帮助获取人的情绪。在
Author:卡瑟夫纳加拉扬
安装
我们可以使用以下命令安装PyEmotion包
pip install PyEmotion
如何测试?在
在终端中运行python3时,它将产生如下输出:
^{pr2}$运行以下代码可以获得PyEmotion包的初始化过程输出。在
>>> from PyEmotion import *
>>> PyEmotion()
要求
pytorch >=1.5.1 torchvision >=0.6.1
可用操作
- 网络摄像头 - 结果为视频
from PyEmotion import * import cv2 as cv PyEmotion()er= DetectFace(device='cpu', gpu_id=0)# Open you default cameracap= cv.VideoCapture(0)while(True): ret, frame= cap.read() frame, emotion= er.predict_emotion(frame) cv.imshow('frame', frame)if cv.waitKey(1)&0xFF== ord('q'): break cap.release() cv.destroyAllWindows()
- Image - 结果为图像
from PyEmotion import * import cv2 as cv PyEmotion()er= DetectFace(device='cpu', gpu_id=0)# Open you default cameracap= cv.VideoCapture(0) ret, frame= cap.read() frame, emotion= er.predict_emotion(frame) cv.imshow('frame', frame) cv.waitKey(0)
论据
er= DetectFace(device='cpu', gpu_id=0)device='gpu' or cpu' gpu_id will be effective only when more than two GPUs are detected or it will through error.
贡献
欢迎所有问题和拉请求!要在本地运行代码,请先分叉存储库,然后在计算机上运行以下命令:
git clone https://github.com/<your-username>/PyEmotion.git cd PyEmotion # Recommended creating a virtual environment before the next step pip3 install -r requirements.txt
在添加代码时,一定要在必要时编写单元测试。在
联系人
{a7}是由情感创造的。请随时联系Twitter或通过Email!
- 项目
标签: