MCPcopy Index your code
hub / github.com/DeepLabCut/DeepLabCut / get_snapshots_from_folder

Function get_snapshots_from_folder

deeplabcut/utils/auxiliaryfunctions.py:613–630  ·  view source on GitHub ↗

Returns an ordered list of existing snapshot names in the train folder, sorted by increasing training iterations. Raises: FileNotFoundError: if no snapshot_names are found in the train_folder.

(train_folder: Path)

Source from the content-addressed store, hash-verified

611
612
613def get_snapshots_from_folder(train_folder: Path) -> list[str]:
614 """Returns an ordered list of existing snapshot names in the train folder, sorted by
615 increasing training iterations.
616
617 Raises:
618 FileNotFoundError: if no snapshot_names are found in the train_folder.
619 """
620 snapshot_names = [file.stem for file in train_folder.iterdir() if "index" in file.name]
621
622 if len(snapshot_names) == 0:
623 raise FileNotFoundError(
624 f"No snapshots were found in {train_folder}! Please ensure the network has "
625 f"been trained and verify the iteration, shuffle and trainFraction are "
626 f"correct."
627 )
628
629 # sort in ascending order of iteration number
630 return sorted(snapshot_names, key=lambda name: int(name.split("-")[1]))
631
632
633def get_deeplabcut_path():

Callers 1

get_scorer_nameFunction · 0.85

Calls 1

splitMethod · 0.45

Tested by

no test coverage detected