|
Download README.md from waylee001/FaceQualityCNN: direct link, hf CLI and curl.
- Browser
- Download file 1.05 kB
-
https://huggingface.co/waylee001/FaceQualityCNN/resolve/main/README.md
- Command line
-
hf download hf://waylee001/FaceQualityCNN/README.md
-
curl -L -o README.md https://huggingface.co/waylee001/FaceQualityCNN/resolve/main/README.md
1.05 kB
| # 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 | |
| ```python | |
| 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 | |
| --- | |