mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-20 13:54:36 +01:00
Fixes (#18777)
* Remove tracked object update resets * Adjust face blur reduction * Add space for config editor buttons * Slight adjustment * Fix double thats * update icons --------- Co-authored-by: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com>
This commit is contained in:
@@ -108,21 +108,24 @@ class FaceRecognizer(ABC):
|
||||
image, M, (output_width, output_height), flags=cv2.INTER_CUBIC
|
||||
)
|
||||
|
||||
def get_blur_confidence_reduction(self, input: np.ndarray) -> tuple[float, float]:
|
||||
def get_blur_confidence_reduction(self, input: np.ndarray) -> float:
|
||||
"""Calculates the reduction in confidence based on the blur of the image."""
|
||||
if not self.config.face_recognition.blur_confidence_filter:
|
||||
return 0, 0.0
|
||||
return 0.0
|
||||
|
||||
variance = cv2.Laplacian(input, cv2.CV_64F).var()
|
||||
logger.debug(f"face detected with blurriness {variance}")
|
||||
|
||||
if variance < 80: # image is very blurry
|
||||
return variance, 0.05
|
||||
elif variance < 100: # image moderately blurry
|
||||
return variance, 0.03
|
||||
elif variance < 150: # image is slightly blurry
|
||||
return variance, 0.01
|
||||
if variance < 120: # image is very blurry
|
||||
return 0.06
|
||||
elif variance < 160: # image moderately blurry
|
||||
return 0.04
|
||||
elif variance < 200: # image is slightly blurry
|
||||
return 0.02
|
||||
elif variance < 250: # image is mostly clear
|
||||
return 0.01
|
||||
else:
|
||||
return variance, 0.0
|
||||
return 0.0
|
||||
|
||||
|
||||
def similarity_to_confidence(
|
||||
@@ -234,8 +237,7 @@ class FaceNetRecognizer(FaceRecognizer):
|
||||
# face recognition is best run on grayscale images
|
||||
|
||||
# get blur factor before aligning face
|
||||
variance, blur_reduction = self.get_blur_confidence_reduction(face_image)
|
||||
logger.debug(f"face detected with blurriness {variance}")
|
||||
blur_reduction = self.get_blur_confidence_reduction(face_image)
|
||||
|
||||
# align face and run recognition
|
||||
img = self.align_face(face_image, face_image.shape[1], face_image.shape[0])
|
||||
@@ -345,8 +347,7 @@ class ArcFaceRecognizer(FaceRecognizer):
|
||||
# face recognition is best run on grayscale images
|
||||
|
||||
# get blur reduction before aligning face
|
||||
variance, blur_reduction = self.get_blur_confidence_reduction(face_image)
|
||||
logger.debug(f"face detected with blurriness {variance}")
|
||||
blur_reduction = self.get_blur_confidence_reduction(face_image)
|
||||
|
||||
# align face and run recognition
|
||||
img = self.align_face(face_image, face_image.shape[1], face_image.shape[0])
|
||||
|
||||
@@ -1579,19 +1579,6 @@ class LicensePlateProcessingMixin:
|
||||
if object_id in self.camera_current_cars.get(camera, []):
|
||||
self.camera_current_cars[camera].remove(object_id)
|
||||
|
||||
if len(self.camera_current_cars[camera]) == 0:
|
||||
self.requestor.send_data(
|
||||
"tracked_object_update",
|
||||
json.dumps(
|
||||
{
|
||||
"type": TrackedObjectUpdateTypesEnum.lpr,
|
||||
"name": None,
|
||||
"plate": None,
|
||||
"camera": camera,
|
||||
}
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
class CTCDecoder:
|
||||
"""
|
||||
|
||||
@@ -444,18 +444,6 @@ class FaceRealTimeProcessor(RealTimeProcessorApi):
|
||||
if object_id in self.camera_current_people.get(camera, []):
|
||||
self.camera_current_people[camera].remove(object_id)
|
||||
|
||||
if len(self.camera_current_people[camera]) == 0:
|
||||
self.requestor.send_data(
|
||||
"tracked_object_update",
|
||||
json.dumps(
|
||||
{
|
||||
"type": TrackedObjectUpdateTypesEnum.face,
|
||||
"name": None,
|
||||
"camera": camera,
|
||||
}
|
||||
),
|
||||
)
|
||||
|
||||
def weighted_average(
|
||||
self, results_list: list[tuple[str, float, int]], max_weight: int = 4000
|
||||
):
|
||||
|
||||
Reference in New Issue
Block a user