Skip to content

Commit

Permalink
black
Browse files Browse the repository at this point in the history
  • Loading branch information
eberrigan committed Oct 8, 2024
1 parent 4a8db98 commit 2db959d
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions sleap/nn/tracking.py
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,7 @@ class Tracker(BaseTracker):
max_tracking: bool = False # To enable maximum tracking.

cleaner: Optional[Callable] = None # TODO: deprecate
target_instance_count: int = 0 # TODO: deprecate
target_instance_count: int = 0 # TODO: deprecate
pre_cull_function: Optional[Callable] = None
post_connect_single_breaks: bool = False
robust_best_instance: float = 1.0
Expand Down Expand Up @@ -824,7 +824,9 @@ def final_pass(self, frames: List[LabeledFrame]):
# "tracking."
# )
self.cleaner.run(frames)
elif (self.target_instance_count or self.max_tracks) and self.post_connect_single_breaks:
elif (
self.target_instance_count or self.max_tracks
) and self.post_connect_single_breaks:
if not self.target_instance_count:
# If target_instance_count is not set, use max_tracks instead
# target_instance_count not available in the GUI
Expand Down Expand Up @@ -855,7 +857,7 @@ def make_tracker_by_name(
of_max_levels: int = 3,
save_shifted_instances: bool = False,
# Pre-tracking options to cull instances
target_instance_count: int = 0, # TODO: deprecate target_instance_count
target_instance_count: int = 0, # TODO: deprecate target_instance_count
pre_cull_to_target: bool = False,
pre_cull_iou_threshold: Optional[float] = None,
# Post-tracking options to connect broken tracks
Expand Down Expand Up @@ -946,7 +948,7 @@ def pre_cull_function(inst_list):
pre_cull_function=pre_cull_function,
max_tracking=max_tracking,
max_tracks=max_tracks,
target_instance_count=target_instance_count, # TODO: deprecate target_instance_count
target_instance_count=target_instance_count, # TODO: deprecate target_instance_count
post_connect_single_breaks=post_connect_single_breaks,
)

Expand All @@ -967,7 +969,9 @@ def pre_cull_function(inst_list):

return kalman_obj
elif kf_init_frame_count and not (max_tracks or target_instance_count):
raise ValueError("Kalman filter requires max tracks or target instance count.")
raise ValueError(
"Kalman filter requires max tracks or target instance count."
)
else:
return tracker_obj

Expand Down Expand Up @@ -1381,7 +1385,9 @@ def cull_function(inst_list):
if init_tracker.pre_cull_function is None:
init_tracker.pre_cull_function = cull_function

print(f"Using {init_tracker.get_name()} to track {init_frame_count} frames for Kalman filters.")
print(
f"Using {init_tracker.get_name()} to track {init_frame_count} frames for Kalman filters."
)

return cls(
init_tracker=init_tracker,
Expand Down

0 comments on commit 2db959d

Please sign in to comment.