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

Function find_next_unlabeled_folder

deeplabcut/utils/auxiliaryfunctions.py:937–959  ·  view source on GitHub ↗
(config_path, verbose=False)

Source from the content-addressed store, hash-verified

935
936
937def find_next_unlabeled_folder(config_path, verbose=False):
938 cfg = read_config(config_path)
939 base_folder = Path(os.path.join(cfg["project_path"], "labeled-data"))
940 h5files = sorted(
941 base_folder.rglob("*.h5"),
942 key=lambda p: p.lstat().st_mtime,
943 reverse=True,
944 )
945 folders = sorted(f for f in base_folder.iterdir() if f.is_dir())
946 most_recent_folder = h5files[0].parent
947 ind = folders.index(most_recent_folder)
948 next_folder = folders[min(ind + 1, len(folders) - 1)]
949 if verbose: # Print some stats about data completeness
950 print("Data completeness\n-----------------")
951 for folder in folders:
952 dfs = []
953 for file in folder.rglob("*.h5"):
954 dfs.append(pd.read_hdf(file))
955 if dfs:
956 df = pd.concat(dfs)
957 frac = (~df.isna()).sum().sum() / df.size
958 print(f"{folder.name} | {int(100 * frac)} %")
959 return next_folder
960
961
962def get_snapshot_index_for_scorer(name: str, index: int | str) -> int:

Callers

nothing calls this directly

Calls 2

lstatMethod · 0.80
read_configFunction · 0.70

Tested by

no test coverage detected