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

Remove --labels and redundant data_path #1326

Merged
merged 1 commit into from
May 25, 2023
Merged
Changes from all commits
Commits
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
25 changes: 5 additions & 20 deletions sleap/gui/learning/runners.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
"""
Run training/inference in background process via CLI.
"""
"""Run training/inference in background process via CLI."""
import abc
import attr
import os
Expand Down Expand Up @@ -41,8 +39,7 @@ def kill_process(pid: int):

@attr.s(auto_attribs=True)
class ItemForInference(abc.ABC):
"""
Abstract base class for item on which we can run inference via CLI.
"""Abstract base class for item on which we can run inference via CLI.

Must have `path` and `cli_args` properties, used to build CLI call.
"""
Expand All @@ -60,8 +57,7 @@ def cli_args(self) -> List[Text]:

@attr.s(auto_attribs=True)
class VideoItemForInference(ItemForInference):
"""
Encapsulate data about video on which inference should run.
"""Encapsulate data about video on which inference should run.

This allows for inference on an arbitrary list of frames from video.

Expand Down Expand Up @@ -119,8 +115,7 @@ def cli_args(self):

@attr.s(auto_attribs=True)
class DatasetItemForInference(ItemForInference):
"""
Encapsulate data about frame selection based on dataset data.
"""Encapsulate data about frame selection based on dataset data.

Attributes:
labels_path: path to the saved :py:class:`Labels` dataset.
Expand All @@ -142,7 +137,7 @@ def path(self):

@property
def cli_args(self):
args_list = ["--labels", self.path]
args_list = [self.path]
if self.frame_filter == "user":
args_list.append("--only-labeled-frames")
elif self.frame_filter == "suggested":
Expand Down Expand Up @@ -200,18 +195,8 @@ def make_predict_cli_call(
) -> List[Text]:
"""Makes list of CLI arguments needed for running inference."""
cli_args = ["sleap-track"]

cli_args.extend(item_for_inference.cli_args)

# TODO: encapsulate in inference item class
if (
not self.trained_job_paths
and "tracking.tracker" in self.inference_params
and self.labels_filename
):
# No models so we must want to re-track previous predictions
cli_args.extend(("--labels", self.labels_filename))

# Make path where we'll save predictions (if not specified)
if output_path is None:

Expand Down