Use constants

This commit is contained in:
Weitheng Haw 2025-01-28 09:34:35 +00:00
parent aa5f7721b6
commit b84201c030

View File

@ -81,9 +81,9 @@ class FaceProcessor(RealTimeProcessorApi):
self.face_detector = cv2.FaceDetectorYN.create(
"/config/model_cache/facedet/facedet.onnx",
config="",
input_size=(320, 320),
score_threshold=0.8,
nms_threshold=0.3,
input_size=FACE_INPUT_SIZE,
score_threshold=MIN_FACE_SCORE,
nms_threshold=NMS_THRESHOLD
)
self.landmark_detector = cv2.face.createFacemarkLBF()
self.landmark_detector.loadModel("/config/model_cache/facedet/landmarkdet.yaml")
@ -394,7 +394,7 @@ class FaceProcessor(RealTimeProcessorApi):
face = img[face_box[1] : face_box[3], face_box[0] : face_box[2]]
_, thumbnail = cv2.imencode(
".webp", face, [int(cv2.IMWRITE_WEBP_QUALITY), 100]
".webp", face, [int(cv2.IMWRITE_WEBP_QUALITY), FACE_QUALITY]
)
# write face to library
@ -441,4 +441,4 @@ class FaceProcessor(RealTimeProcessorApi):
if self.landmark_detector:
self.landmark_detector = None
if self.face_recognizer:
self.face_recognizer = None
self.face_recognizer = None