Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Limit max tracks via track-local queues #1447

Merged
merged 31 commits into from
Sep 8, 2023
Merged
Show file tree
Hide file tree
Changes from 26 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
8d88668
Initial commit
shrivaths16 Aug 10, 2023
acbb444
Merge remote-tracking branch 'origin/develop' into shrivaths/fix-maxi…
shrivaths16 Aug 11, 2023
3b23e1e
format files
shrivaths16 Aug 14, 2023
e32b8e3
[wip] adding local deque for tracks
shrivaths16 Aug 15, 2023
fe5aeef
format files
shrivaths16 Aug 15, 2023
f494cad
[wip] adding local deque for tracks
shrivaths16 Aug 15, 2023
c8328e1
Merge remote-tracking branch 'origin/develop' into shrivaths/fix-maxi…
shrivaths16 Aug 15, 2023
82ae620
Merge branch 'develop' into shrivaths/fix-maximum-tracking
shrivaths16 Aug 17, 2023
6352e2a
[wip] Add max tracking for simpletracker
shrivaths16 Aug 22, 2023
bef1548
Merge branch 'shrivaths/fix-maximum-tracking' of https://github.com/t…
shrivaths16 Aug 22, 2023
4ddcbc9
[wip] Add max tracking for simple tracker
shrivaths16 Aug 22, 2023
6ff43c6
[wip] add missing argument
shrivaths16 Aug 22, 2023
216f3a3
[wip] Add and modify test functions
shrivaths16 Aug 23, 2023
d897170
[wip] Add and modify test functions
shrivaths16 Aug 24, 2023
9c5579f
Bug fix and refactoring code
shrivaths16 Aug 25, 2023
380038f
[wip] Add max tracking for flow tracker.
shrivaths16 Aug 28, 2023
9413bfd
[wip] Including suggested changes
shrivaths16 Aug 31, 2023
1969d2b
[wip] refactor code
shrivaths16 Sep 1, 2023
c927090
Add test function to check max tracks
shrivaths16 Sep 1, 2023
2e4fece
Added suggestions and feedback
shrivaths16 Sep 2, 2023
bff3333
Prevent the creation of more than max tracks when we have unmatched d…
talmo Sep 6, 2023
0492ff7
Add tests
talmo Sep 6, 2023
89b04af
Use maximum tracking by default when loading model via high level API
talmo Sep 6, 2023
e62db0f
Lint
talmo Sep 8, 2023
3a72e1a
Fix integration test
talmo Sep 8, 2023
74ea980
Refactor max tracker tests
talmo Sep 8, 2023
f8254a4
Add integration test for CLI
talmo Sep 8, 2023
e1e7285
typo
talmo Sep 8, 2023
ee26e2e
Merge branch 'develop' into shrivaths/fix-maximum-tracking
talmo Sep 8, 2023
91ad0b6
Add max tracks to the tracking GUI
talmo Sep 8, 2023
0b2fdd9
Update CLI docs and add examples
talmo Sep 8, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions sleap/nn/inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
)
from sleap.nn.utils import reset_input_layer
from sleap.io.dataset import Labels
from sleap.util import frame_list
from sleap.util import frame_list, make_scoped_dictionary
from sleap.instance import PredictedInstance, LabeledFrame

from tensorflow.python.framework.convert_to_constants import (
Expand Down Expand Up @@ -4773,8 +4773,7 @@ def load_model(
be performed.
tracker_window: Number of frames of history to use when tracking. No effect when
`tracker` is `None`.
tracker_max_instances: If not `None`, discard instances beyond this count when
tracking. No effect when `tracker` is `None`.
tracker_max_instances: If not `None`, create at most this many tracks.
disable_gpu_preallocation: If `True` (the default), initialize the GPU and
disable preallocation of memory. This is necessary to prevent freezing on
some systems with low GPU memory and has negligible impact on performance.
Expand Down Expand Up @@ -4863,11 +4862,18 @@ def unpack_sleap_model(model_path):
)
predictor.verbosity = progress_reporting
if tracker is not None:
use_max_tracker = tracker_max_instances is not None
if use_max_tracker and not tracker.endswith("maxtracks"):
# Append maxtracks to the tracker name to use the right tracker variants.
tracker += "maxtracks"
talmo marked this conversation as resolved.
Show resolved Hide resolved

predictor.tracker = Tracker.make_tracker_by_name(
tracker=tracker,
track_window=tracker_window,
post_connect_single_breaks=True,
clean_instance_count=tracker_max_instances,
max_tracking=use_max_tracker,
max_tracks=tracker_max_instances,
# clean_instance_count=tracker_max_instances,
)

# Remove temp dirs.
Expand Down Expand Up @@ -5335,7 +5341,7 @@ def _make_tracker_from_cli(args: argparse.Namespace) -> Optional[Tracker]:
Returns:
An instance of `Tracker` or `None` if tracking method was not specified.
"""
policy_args = sleap.util.make_scoped_dictionary(vars(args), exclude_nones=True)
policy_args = make_scoped_dictionary(vars(args), exclude_nones=True)
if "tracking" in policy_args:
tracker = Tracker.make_tracker_by_name(**policy_args["tracking"])
return tracker
Expand Down
Loading
Loading