Download experiments/layout.py from Angione-Lab/Shape2Force: direct link, hf CLI and curl.
- Browser
- Download file 1 kB
-
https://huggingface.co/Angione-Lab/Shape2Force/resolve/main/experiments/layout.py
- Command line
-
hf download hf://Angione-Lab/Shape2Force/experiments/layout.py
-
curl -L -o layout.py https://huggingface.co/Angione-Lab/Shape2Force/resolve/main/experiments/layout.py
1 kB
| """Paths and split-manifest helpers. Each manifest in experiments/splits/ lists one sample per row.""" | |
| import csv | |
| import os | |
| S2F_ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) | |
| DEFAULT_DATASET_ROOT = os.environ.get("S2F_DATASET_ROOT", os.path.join(S2F_ROOT, "dataset")) | |
| SPLITS_DIR = os.environ.get("S2F_SPLITS_DIR", os.path.join(S2F_ROOT, "experiments", "splits")) | |
| RUNS_DIR = os.environ.get("S2F_RUNS_DIR", os.path.join(S2F_ROOT, "experiments", "runs")) | |
| RESULTS_DIR = os.environ.get("S2F_RESULTS_DIR", os.path.join(S2F_ROOT, "experiments", "results")) | |
| MASK_NAMES = ("cell_mask.tif", "cell_mask.png", "mask.tif", "mask.png") | |
| def read_manifest(path): | |
| with open(path, newline="") as f: | |
| return list(csv.DictReader(f)) | |
| def manifest_path(name): | |
| return os.path.join(SPLITS_DIR, f"{name}.csv") | |
| def list_manifests(): | |
| if not os.path.isdir(SPLITS_DIR): | |
| return [] | |
| return sorted(os.path.splitext(f)[0] for f in os.listdir(SPLITS_DIR) if f.endswith(".csv")) | |