mirror of
				https://github.com/blakeblackshear/frigate.git
				synced 2025-10-27 10:52:11 +01:00 
			
		
		
		
	Adjust kalman filter used for norfair tracker (#9538)
* Adjust kalman filter * Add comment * Formatting
This commit is contained in:
		
							parent
							
								
									c5819478d3
								
							
						
					
					
						commit
						2d0864c723
					
				@ -3,7 +3,13 @@ import random
 | 
				
			|||||||
import string
 | 
					import string
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import numpy as np
 | 
					import numpy as np
 | 
				
			||||||
from norfair import Detection, Drawable, Tracker, draw_boxes
 | 
					from norfair import (
 | 
				
			||||||
 | 
					    Detection,
 | 
				
			||||||
 | 
					    Drawable,
 | 
				
			||||||
 | 
					    OptimizedKalmanFilterFactory,
 | 
				
			||||||
 | 
					    Tracker,
 | 
				
			||||||
 | 
					    draw_boxes,
 | 
				
			||||||
 | 
					)
 | 
				
			||||||
from norfair.drawing.drawer import Drawer
 | 
					from norfair.drawing.drawer import Drawer
 | 
				
			||||||
 | 
					
 | 
				
			||||||
from frigate.config import CameraConfig
 | 
					from frigate.config import CameraConfig
 | 
				
			||||||
@ -82,6 +88,13 @@ class NorfairTracker(ObjectTracker):
 | 
				
			|||||||
            distance_threshold=2.5,
 | 
					            distance_threshold=2.5,
 | 
				
			||||||
            initialization_delay=self.detect_config.min_initialized,
 | 
					            initialization_delay=self.detect_config.min_initialized,
 | 
				
			||||||
            hit_counter_max=self.detect_config.max_disappeared,
 | 
					            hit_counter_max=self.detect_config.max_disappeared,
 | 
				
			||||||
 | 
					            # use default filter factory with custom values
 | 
				
			||||||
 | 
					            # R is the multiplier for the sensor measurement noise matrix, default of 4.0
 | 
				
			||||||
 | 
					            # lowering R means that we trust the position of the bounding boxes more
 | 
				
			||||||
 | 
					            # testing shows that the prediction was being relied on a bit too much
 | 
				
			||||||
 | 
					            # TODO: could use different kalman filter values along with
 | 
				
			||||||
 | 
					            #       the different tracker per object class
 | 
				
			||||||
 | 
					            filter_factory=OptimizedKalmanFilterFactory(R=3.4),
 | 
				
			||||||
        )
 | 
					        )
 | 
				
			||||||
        if self.ptz_autotracker_enabled.value:
 | 
					        if self.ptz_autotracker_enabled.value:
 | 
				
			||||||
            self.ptz_motion_estimator = PtzMotionEstimator(
 | 
					            self.ptz_motion_estimator = PtzMotionEstimator(
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user