deepinsight/insightface · error · ValueError
Dataset root not found: {root}
Error message
Dataset root not found: {root} What it means
Raised by run_identity_identification_evaluation when dataset_root does not exist or is not a directory (after expanduser). It is a precondition check before any collection or embedding work happens.
Source
Thrown at python-package/insightface/gui/core/evaluation.py:833
score = cosine_similarity(query_embedding, sample["embedding"])
identity = str(sample["identity"])
if identity not in best_by_identity or score > best_by_identity[identity]:
best_by_identity[identity] = score
return sorted(best_by_identity.items(), key=lambda item: item[1], reverse=True)
def run_identity_identification_evaluation(
dataset_root: str | Path,
engine: FaceEngine,
auto_split: bool = False,
multi_face_policy: str = MULTI_FACE_REQUIRE_ONE,
license_status: str = DEFAULT_LICENSE_STATUS,
progress_callback=None,
cancel_callback=None,
) -> EvaluationResult:
root = Path(dataset_root).expanduser()
if not root.is_dir():
raise ValueError(f"Dataset root not found: {root}")
gallery_items, probe_items, unknown_items = (
_collect_gallery_probe_auto_split(root) if auto_split else _collect_gallery_probe_structured(root)
)
if not gallery_items:
raise ValueError("1:N evaluation requires at least one gallery image.")
if not probe_items:
raise ValueError("1:N evaluation requires at least one known probe image.")
errors: List[Dict[str, Any]] = []
cache: Dict[str, np.ndarray] = {}
gallery: List[Dict[str, Any]] = []
start_all = time.perf_counter()
for index, item in enumerate(gallery_items):
embedding = _embedding_for_image(
Path(item["path"]),
engine,
cache,
errors,View on GitHub (pinned to 7fadd420c2)
Solutions
- Check Path(dataset_root).expanduser().resolve().is_dir() before calling
- Fix typos or use absolute paths (or resolve relative to a known anchor file)
- If in a container/remote env, confirm the dataset volume is mounted at the expected path
- Log the resolved path to catch CWD-dependent relative path issues
Example fix
# before
result = run_identity_identification_evaluation("data/ids", ...)
# after
from pathlib import Path
root = Path("data/ids").expanduser().resolve()
assert root.is_dir(), f"missing dataset root: {root}"
result = run_identity_identification_evaluation(root, ...) Defensive patterns
Strategy: validation
Validate before calling
from pathlib import Path
root = Path(dataset_root).expanduser().resolve()
if not root.is_dir():
raise FileNotFoundError(root) Type guard
def is_valid_dataset_root(root: str | Path) -> bool:
p = Path(root).expanduser()
return p.is_dir() Try / catch
try:
result = run_identity_identification_evaluation(dataset_root, ...)
except ValueError as e:
if "Dataset root not found" in str(e):
fix_and_retry_with_resolved_path() Prevention
- Resolve paths against a known anchor, not CWD
- Fail fast on missing dataset paths at app startup
- In containers, verify volume mounts before evaluation jobs
When it happens
Trigger: Passing a nonexistent, mistyped, or file (not directory) path as dataset_root; relative path resolved against an unexpected working directory; '~' expansion producing a wrong path.
Common situations: Wrong CWD when using relative paths; typo in path; dataset moved/renamed; path from config that references a machine-specific location; container volume not mounted.
Related errors
- Identity folder root not found: {root}
- No verification pairs could be generated from the selected i
- 1:N evaluation requires at least one gallery image.
- 1:N evaluation requires at least one known probe image.
- skipped multi-face image ({face_count} faces)
AI-assisted analysis of deepinsight/insightface@7fadd420c2 (2026-08-28).
Data as JSON: /api/errors/8d81adc0c722b593.
Report an issue: GitHub.