{"record":{"id":"1609957c36e01242","repo":"deepinsight/insightface","slug":"identity-folder-root-not-found-root","errorCode":null,"errorMessage":"Identity folder root not found: {root}","messagePattern":"Identity folder root not found: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python-package/insightface/gui/core/evaluation.py","lineNumber":108,"sourceCode":"    if len(negatives) < max(20, int(1 / max(target_far, 1e-9))):\n        return \"insufficient data\"\n    thresholds = sorted({float(row[\"similarity\"]) for row in rows if row.get(\"similarity\") is not None}, reverse=True)\n    best_tar = 0.0\n    for threshold in thresholds:\n        far = sum(1 for row in negatives if row[\"similarity\"] >= threshold) / max(1, len(negatives))\n        if far <= target_far:\n            tar = sum(1 for row in positives if row[\"similarity\"] >= threshold) / max(1, len(positives))\n            best_tar = max(best_tar, tar)\n    return best_tar\n\n\ndef _identity_name(folder: Path) -> str:\n    return folder.name\n\n\ndef _identity_dirs(root: Path) -> List[Path]:\n    if not root.exists() or not root.is_dir():\n        raise ValueError(f\"Identity folder root not found: {root}\")\n    return sorted(path for path in root.iterdir() if path.is_dir())\n\n\ndef _auto_split_identity_images(identity_dir: Path) -> tuple[Path | None, List[Path]]:\n    images = sorted(list_images(identity_dir, recursive=True))\n    if not images:\n        return None, []\n    gallery_candidates = [path for path in images if \"gallery\" in path.stem.lower()]\n    gallery = sorted(gallery_candidates or images)[0]\n    probes = [path for path in images if path != gallery]\n    return gallery, probes\n\n\ndef _normalize_multi_face_policy(policy: str) -> str:\n    policy = (policy or MULTI_FACE_REQUIRE_ONE).strip()\n    return policy if policy in MULTI_FACE_POLICIES else MULTI_FACE_REQUIRE_ONE\n\n","sourceCodeStart":90,"sourceCodeEnd":126,"githubUrl":"https://github.com/deepinsight/insightface/blob/7fadd420c2351d0ffa8cac403421c1a3ed733365/python-package/insightface/gui/core/evaluation.py#L90-L126","documentation":"_identity_dirs verifies the dataset root before scanning identity folders for verification/identification evaluation: if the path doesn't exist or isn't a directory, it raises ValueError immediately. This guards against silently evaluating an empty dataset (every downstream caller — _collect_verification_specs, _collect_identification_specs, the gallery/probe splitters — starts here).","triggerScenarios":"Calling run_identity_verification_evaluation or any _collect_* helper with a root Path that is misspelled, points to a file, or hasn't been downloaded/mounted yet.","commonSituations":"Wrong --root CLI argument; running evaluation before downloading the dataset; relative path resolved against a different CWD; symlink to an unmounted network share.","solutions":["Check Path(root).is_dir() before invoking and print Path(root).resolve() to catch CWD-relative surprises.","Verify the dataset actually downloaded/mounted and pass an absolute path.","Fix the typo in the root argument (compare with the dataset's actual directory name)."],"exampleFix":"# before\nrun_identity_verification_evaluation(Path('bins/lfw'), ...)  # ValueError: Identity folder root not found: bins/lfw\n\n# after\nfrom pathlib import Path\nroot = Path('bins/lfw').expanduser().resolve()\nassert root.is_dir(), f'missing dataset at {root}'\nrun_identity_verification_evaluation(root, ...)","handlingStrategy":"validation","validationCode":"from pathlib import Path\nroot = Path(root).expanduser().resolve()\nif not root.is_dir():\n    raise SystemExit(f'dataset root missing: {root}')","typeGuard":"def is_dataset_root(p) -> bool:\n    from pathlib import Path\n    p = Path(p)\n    return p.is_dir() and any(x.is_dir() for x in p.iterdir())","tryCatchPattern":"try:\n    run_identity_verification_evaluation(root, ...)\nexcept ValueError as e:\n    if 'Identity folder root not found' in str(e):\n        # fix/download path then retry\n        ...\n    raise","preventionTips":["Resolve dataset paths to absolute form at CLI parse time.","Fail fast on missing dataset dirs before long job setup."],"tags":["path","dataset","validation","evaluation"],"backgroundTag":"input-path-not-found","analyzedSha":"7fadd420c2351d0ffa8cac403421c1a3ed733365","analyzedAt":"2026-08-28T15:44:01.850Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}