YAML Metadata Warning:empty or missing yaml metadata in repo card

Check out the documentation for more information.

Face Quality CNN

This model is capable of evaluating the quality of human faces in input images.

Inference

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).

Code


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)

license: apache-2.0

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support