@@ -105,10 +105,6 @@ class FaceNet:
105105 If unable to connect to the camera.
106106 """
107107
108- # TODO: Allow config via env vars
109- LEARNING_RATE = 0.6 # tolerance level - keep switching this until you find perfection in recognition
110- MODEL = "hog" # model using which the images are matched
111-
112108 def __init__ (self ):
113109 """Instantiates the ``Processor`` object and sources the camera hardware."""
114110 self .validation_video = cv2 .VideoCapture (models .env .camera_index or 0 )
@@ -161,12 +157,16 @@ def recognizer(self, location: str | FilePath, retry_count: int = 20) -> str | N
161157 logger .warning ("Unable to read from camera index: %d" , models .env .camera_index or 0 )
162158 continue
163159 # gets image from the video read above
164- identifier = face_recognition .face_locations (img , model = self . MODEL )
160+ identifier = face_recognition .face_locations (img , model = models . env . face_recognition_model )
165161 # creates an encoding for the image
166- encoded_ = face_recognition .face_encodings (img , identifier )
162+ encoded_ = face_recognition .face_encodings (face_image = img , known_face_locations = identifier )
167163 for face_encoding , face_location in zip (encoded_ , identifier ):
168164 # using learning_rate, the encoding is matched against the encoded matrix for images in named directory
169- results = face_recognition .compare_faces (self .train_faces , face_encoding , self .LEARNING_RATE )
165+ results = face_recognition .compare_faces (
166+ known_face_encodings = self .train_faces ,
167+ face_encoding_to_check = face_encoding ,
168+ tolerance = models .env .face_recognition_learning_rate ,
169+ )
170170 # if a match is found the directory name is rendered and returned as match value
171171 if True in results :
172172 return self .train_names [results .index (True )]
0 commit comments