-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add tracking-only ui to sleap-track.
If sleap-track is given labels file as data_path and tracking policy but no models, then it will run the tracker on the previously generated predictions. This is a better interface than having to call sleap.nn.tracking to retrack. Resolves issue #260.
- Loading branch information
Showing
2 changed files
with
113 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import attr | ||
|
||
|
||
@attr.s(auto_attribs=True) | ||
class PredictedInstancePredictor: | ||
""" | ||
Returns chunk of previously generated predictions in format of Predictor. | ||
""" | ||
|
||
labels: "Labels" | ||
video_idx: int = 0 | ||
|
||
def get_chunk(self, frame_inds): | ||
video = self.labels.videos[self.video_idx] | ||
|
||
# Return dict keyed to sample index (i.e., offset in frame_inds), value | ||
# is the list of instances for that frame. | ||
return { | ||
i: [ | ||
inst | ||
for lf in self.labels.find(video=video, frame_idx=int(frame_idx)) | ||
for inst in lf.instances | ||
] | ||
for i, frame_idx in enumerate(frame_inds) | ||
} |