mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-03-04 06:33:45 +00:00
Cleanup resetting tracked object activity
This commit is contained in:
parent
ffcf3c0692
commit
1fcadb09b0
@ -1570,10 +1570,29 @@ class LicensePlateProcessingMixin:
|
||||
def handle_request(self, topic, request_data) -> dict[str, Any] | None:
|
||||
return
|
||||
|
||||
def expire_object(self, object_id: str, camera: str):
|
||||
def lpr_expire(self, object_id: str, camera: str):
|
||||
print(
|
||||
f"expiring {self.detected_license_plates} and we have cars {self.camera_current_cars}"
|
||||
)
|
||||
if object_id in self.detected_license_plates:
|
||||
self.detected_license_plates.pop(object_id)
|
||||
|
||||
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:
|
||||
"""
|
||||
|
||||
@ -293,10 +293,11 @@ class FaceRealTimeProcessor(RealTimeProcessorApi):
|
||||
if camera not in self.camera_current_people:
|
||||
self.camera_current_people[camera] = []
|
||||
|
||||
self.camera_current_people[camera].append(id)
|
||||
|
||||
self.person_face_history[id].append(
|
||||
(sub_label, score, face_frame.shape[0] * face_frame.shape[1])
|
||||
)
|
||||
self.camera_current_people[camera].append(id)
|
||||
(weighted_sub_label, weighted_score) = self.weighted_average(
|
||||
self.person_face_history[id]
|
||||
)
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
"""Handle processing images for face detection and recognition."""
|
||||
|
||||
import json
|
||||
import logging
|
||||
from typing import Any
|
||||
|
||||
@ -15,7 +14,6 @@ from frigate.data_processing.common.license_plate.mixin import (
|
||||
from frigate.data_processing.common.license_plate.model import (
|
||||
LicensePlateModelRunner,
|
||||
)
|
||||
from frigate.types import TrackedObjectUpdateTypesEnum
|
||||
|
||||
from ..types import DataProcessorMetrics
|
||||
from .api import RealTimeProcessorApi
|
||||
@ -55,21 +53,5 @@ class LicensePlateRealTimeProcessor(LicensePlateProcessingMixin, RealTimeProcess
|
||||
return
|
||||
|
||||
def expire_object(self, object_id: str, camera: str):
|
||||
if object_id in self.detected_license_plates:
|
||||
self.detected_license_plates.pop(object_id)
|
||||
|
||||
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,
|
||||
}
|
||||
),
|
||||
)
|
||||
"""Expire lpr objects."""
|
||||
self.lpr_expire(object_id, camera)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user