Downloads · 30 days
0
waylee001/FaceQualityCNN
FaceQualityCNN is a machine learning model from waylee001. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
This model is capable of evaluating the quality of human faces in input images.
Downloads · 30 days
0
Access
Public
Updated Oct 21, 2024
Repo size
406 KB
Likes
2
Public
Click a slice to open those files.
.onnx406 KB · 99%
From the Hugging Face model README
This model is capable of evaluating the quality of human faces in input images.
It takes aligned face images (112x112) as input and returns a quality score for the face (ranging from 0 to 1, with higher scores indicating higher quality).
class face_quality_assessment():
def __init__(self, path):
# Initialize model
self.net = cv2.dnn.readNet(path)
self.input_height = 112
self.input_width = 112
def classify(self, srcimg):
input_img = cv2.resize(cv2.cvtColor(srcimg, cv2.COLOR_BGR2RGB), (self.input_width, self.input_height))
input_img = (input_img.astype(np.float32) / 255.0 - 0.5) / 0.5
blob = cv2.dnn.blobFromImage(input_img.astype(np.float32))
self.net.setInput(blob)
outputs = self.net.forward(self.net.getUnconnectedOutLayersNames())
return outputs[0].reshape(-1)
fqa = face_quality_assessment("weights/face-quality-assessment.onnx")
fqa_probs = fqa.classify(img)