Skip to content

Commit fee86ae

Browse files
authored
Update predictions output path for inference (#2475)
1 parent a8684ca commit fee86ae

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

sleap/gui/learning/runners.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,9 +260,20 @@ def make_predict_cli_call(
260260

261261
# Build filename with video name and timestamp
262262
timestamp = datetime.now().strftime("%y%m%d_%H%M%S")
263+
video_name_prefix = ""
264+
if "--video_index" in item_for_inference.cli_args:
265+
video_index = int(
266+
item_for_inference.cli_args[
267+
item_for_inference.cli_args.index("--video_index") + 1
268+
]
269+
)
270+
video_name_prefix = Path(self.labels.videos[video_index].filename).name
271+
video_name_prefix = (
272+
video_name_prefix + "_" if video_name_prefix != "" else ""
273+
)
263274
output_path = os.path.join(
264275
predictions_dir,
265-
f"{os.path.basename(item_for_inference.path)}.{timestamp}."
276+
f"{video_name_prefix}{os.path.basename(item_for_inference.path)}.{timestamp}."
266277
"predictions.slp",
267278
)
268279

0 commit comments

Comments
 (0)