forked from Github/frigate
Custom classes for Process and Metrics (#13950)
* Subclass Process for audio_process * Introduce custom mp.Process subclass In preparation to switch the multiprocessing startup method away from "fork", we cannot rely on os.fork cloning the log state at fork time. Instead, we have to set up logging before we run the business logic of each process. * Make camera_metrics into a class * Make ptz_metrics into a class * Fixed PtzMotionEstimator.ptz_metrics type annotation * Removed pointless variables * Do not start audio processor when no audio cameras are configured
This commit is contained in:
@@ -12,10 +12,10 @@ from norfair import (
|
||||
)
|
||||
from norfair.drawing.drawer import Drawer
|
||||
|
||||
from frigate.camera import PTZMetrics
|
||||
from frigate.config import CameraConfig
|
||||
from frigate.ptz.autotrack import PtzMotionEstimator
|
||||
from frigate.track import ObjectTracker
|
||||
from frigate.types import PTZMetricsTypes
|
||||
from frigate.util.image import intersection_over_union
|
||||
from frigate.util.object import average_boxes, median_of_boxes
|
||||
|
||||
@@ -75,7 +75,7 @@ class NorfairTracker(ObjectTracker):
|
||||
def __init__(
|
||||
self,
|
||||
config: CameraConfig,
|
||||
ptz_metrics: PTZMetricsTypes,
|
||||
ptz_metrics: PTZMetrics,
|
||||
):
|
||||
self.tracked_objects = {}
|
||||
self.untracked_object_boxes: list[list[int]] = []
|
||||
@@ -85,7 +85,6 @@ class NorfairTracker(ObjectTracker):
|
||||
self.camera_config = config
|
||||
self.detect_config = config.detect
|
||||
self.ptz_metrics = ptz_metrics
|
||||
self.ptz_autotracker_enabled = ptz_metrics["ptz_autotracker_enabled"]
|
||||
self.ptz_motion_estimator = {}
|
||||
self.camera_name = config.name
|
||||
self.track_id_map = {}
|
||||
@@ -104,7 +103,7 @@ class NorfairTracker(ObjectTracker):
|
||||
# the different tracker per object class
|
||||
filter_factory=OptimizedKalmanFilterFactory(R=3.4),
|
||||
)
|
||||
if self.ptz_autotracker_enabled.value:
|
||||
if self.ptz_metrics.autotracker_enabled.value:
|
||||
self.ptz_motion_estimator = PtzMotionEstimator(
|
||||
self.camera_config, self.ptz_metrics
|
||||
)
|
||||
@@ -315,7 +314,7 @@ class NorfairTracker(ObjectTracker):
|
||||
|
||||
coord_transformations = None
|
||||
|
||||
if self.ptz_autotracker_enabled.value:
|
||||
if self.ptz_metrics.autotracker_enabled.value:
|
||||
# we must have been enabled by mqtt, so set up the estimator
|
||||
if not self.ptz_motion_estimator:
|
||||
self.ptz_motion_estimator = PtzMotionEstimator(
|
||||
|
||||
Reference in New Issue
Block a user