From 7d293c9eaf0eade61c18b12127b166efbde16df4 Mon Sep 17 00:00:00 2001 From: getzze Date: Fri, 2 Aug 2024 23:25:48 +0100 Subject: [PATCH] format --- sleap/nn/tracking.py | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/sleap/nn/tracking.py b/sleap/nn/tracking.py index 4b820a17a..e38ce9d88 100644 --- a/sleap/nn/tracking.py +++ b/sleap/nn/tracking.py @@ -74,7 +74,6 @@ def from_instance( shift_score: float = 0.0, with_skeleton: bool = False, ): - points_array = new_points_array if points_array is None: points_array = ref_instance.points_array @@ -517,6 +516,7 @@ def get_candidates( @attr.s(auto_attribs=True) class BaseTracker(abc.ABC): """Abstract base class for tracker.""" + verbosity: str report_rate: float @@ -547,10 +547,10 @@ def run_step(self, lf: LabeledFrame) -> LabeledFrame: ) def run_tracker( - self, - frames: List[LabeledFrame], - *, - verbosity: Optional[str] = None, + self, + frames: List[LabeledFrame], + *, + verbosity: Optional[str] = None, final_pass: bool = True, ) -> List[LabeledFrame]: """Run the tracker on a set of labeled frames. @@ -745,7 +745,6 @@ class Tracker(BaseTracker): ) report_rate: float = 2.0 - @property def is_valid(self): return self.similarity_function is not None @@ -813,7 +812,6 @@ def track( if t is None: if self.has_max_tracking: if len(self.track_matching_queue_dict) > 0: - # Default to last timestep + 1 if available. # Here we find the track that has the most instances. track_with_max_instances = max( @@ -829,7 +827,6 @@ def track( t = 0 else: if len(self.track_matching_queue) > 0: - # Default to last timestep + 1 if available. t = self.track_matching_queue[-1].t + 1 @@ -844,7 +841,6 @@ def track( # Process untracked instances. if untracked_instances: - if self.pre_cull_function: self.pre_cull_function(untracked_instances) @@ -934,7 +930,6 @@ def spawn_for_untracked_instances( ) -> List[InstanceType]: results = [] for inst in unmatched_instances: - # Skip if this instance is too small to spawn a new track with. if inst.n_visible_points < self.min_new_track_points: continue @@ -1108,7 +1103,6 @@ def pre_cull_function(inst_list): @classmethod def get_by_name_factory_options(cls): - options = [] option = dict(name="tracker", default="None") @@ -1212,9 +1206,9 @@ def get_by_name_factory_options(cls): option = dict(name="of_window_size", default=21) option["type"] = int - option[ - "help" - ] = "For optical-flow: Optical flow window size to consider at each pyramid " + option["help"] = ( + "For optical-flow: Optical flow window size to consider at each pyramid " + ) "scale level" options.append(option) @@ -1390,7 +1384,6 @@ def add_frame_instances( # "usuable" instances—i.e., instances with the nodes that we'll track # using Kalman filters. elif frame_match.has_only_first_choice_matches: - good_instances = [ inst for inst in instances if self.is_usable_instance(inst) ] @@ -1610,7 +1603,6 @@ def track( # Check whether we've been getting good results from the Kalman filters. # First, has it been a while since the filters were initialized? if self.init_done and (t - self.last_init_t) > self.re_init_cooldown: - # If it's been a while, then see if it's also been a while since # the filters successfully matched tracks to the instances. if self.kalman_tracker.last_frame_with_tracks < t - self.re_init_after: