Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
A Lightweight Face Detection and Facial Attribute Analysis Framework (Age, Gender, Emotion) for Python
[TOC]
newlandface 是一个轻量级的人脸检测和多属性分析(年龄、性别、标签)分析工具,使用python语言,集成了部分开源库Dlib、mtcnn等工具,该库主要是基于Keras和TensorFlow来进行开发的。
The easiest way to install newlandface is to download it from PyPI
.
pip install newlandface
│ README.md │ requirements.txt │ setup.py │
├─newlandface │ │ nlface.py │ │ init.py │ │
│ ├─basemodels │ │ │ DeepID.py │ │ │ DlibResNet.py │ │ │ Facenet.py │ │ │ FbDeepFace.py │ │ │ OpenFace.py │ │ │ VGGFace.py │ │ │ init.py │ │
│ ├─commons │ │ │ distance.py │ │ │ functions.py │ │ │ realtime.py │ │ │ init.py │ │
│ ├─extendedmodels │ │ │ Age.py │ │ │ Emotion.py │ │ │ Gender.py │ │ │ Race.py │ │ │ init.py │ │
│ ├─models │ │ face-recognition-ensemble-model.txt │ │ init.py │
└─tests │ testFaceAttr_video.py │ testFaceDetect_img.py │ testFacePoints_img.py │
└─dataset img1.jpg img13.jpg img14.jpg ...
from newlandface import nlface
import cv2
# 模型加载
nlface.load_model()
image = cv2.imread("./dataset/test1.jpg")
# 人脸检测
faceObjs = nlface.detect_face(image)
# 显示人脸框
if faceObjs is not 0:
for idx, rect in enumerate(faceObjs):
image = nlface.show_face(image,rect)
else:
print("no face detect")
os._exit(0)
cv2.imshow("test",image)
cv2.waitKey()
核心函数:detect_face、show_face_points
from newlandface import nlface
import cv2
cv2.namedWindow("test",0)
# 模型加载
nlface.load_model()
image = cv2.imread("./dataset/test1.jpg")
# 人脸检测
faceObjs = nlface.detect_face(image)
# 显示人脸框
if faceObjs is not 0:
for idx, rect in enumerate(faceObjs):
image = nlface.show_face_points(image,rect)
else:
print("no face detect")
os._exit(0)
cv2.imshow("test",image)
cv2.waitKey()
核心函数:detect_face、detect_points、show_face
from newlandface import nlface
import cv2
cv2.namedWindow("test",0)
# 模型加载
nlface.load_model()
image = cv2.imread("./dataset/test1.jpg")
# 人脸检测
faceObjs = nlface.detect_face(image)
if faceObjs is not 0:
for idx, rect in enumerate(faceObjs):
# 人脸68点检测
points = nlface.detect_points(image,rect)
# 显示人脸框、68点
image = nlface.show_face(image,rect)
for i,point in enumerate(points):
cv2.circle(image,(point[0],point[1]),2,(0,0,255),-1)
cv2.imshow("test",image)
cv2.waitKey(1)
else:
print("no face detect")
os._exit(0)
cv2.imshow("test",image)
cv2.waitKey()
核心函数:detect_face、detect_points、show_face
属性开放:emotion(表情)、age(年龄)、gender(性别)
属性 | 检测耗时 | 标签类型 |
---|---|---|
emotion表情 | 30ms | ['angry', 'disgust', 'fear', 'happy', 'sad', 'surprise', 'neutral'] |
age年龄 | 130ms | 1-100 |
gender性别 | 170ms | woman、man |
注意:不同的模块耗时不一,所以如果调用摄像头的时候,要注意实时性上的要求。
from newlandface import nlface
import cv2
cv2.namedWindow("test",0)
# 模型加载
nlface.load_model()
image = cv2.imread("./dataset/test1.jpg")
# 人脸检测
faceObjs = nlface.detect_face(image)
if faceObjs is not 0:
for idx, rect in enumerate(faceObjs):
# 人脸属性分析
actions = ['emotion', 'age', 'gender']
attribute = nlface.analyze(image, faceObjs[idex],actions = actions)
# 显示人脸框\属性
image = nlface.show_face(image,rect)
image = nlface.show_face_attr(image, faceObjs[idex], attribute, actions)
cv2.imshow("test",image)
cv2.waitKey(1)
else:
print("no face detect")
os._exit(0)
cv2.imshow("test",image)
cv2.waitKey()
FAQs
A Lightweight Face Detection and Facial Attribute Analysis Framework (Age, Gender, Emotion) for Python
We found that newlandface demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.