Skip to content

Commit

Permalink
Remove --labels and redundant data_path (#1326)
Browse files Browse the repository at this point in the history
  • Loading branch information
roomrys authored May 25, 2023
1 parent cefe1a2 commit eb9dc7d
Showing 1 changed file with 5 additions and 20 deletions.
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

0 comments on commit eb9dc7d

Please sign in to comment.