deepinsight/insightface · error · ValueError
1:N evaluation requires at least one gallery image.
Error message
1:N evaluation requires at least one gallery image.
What it means
Raised by run_identity_identification_evaluation when, after collecting the dataset (auto-split or structured), zero gallery images were found. The gallery is the enrolled identity set that probes are matched against, so 1:N evaluation cannot proceed.
Source
Thrown at python-package/insightface/gui/core/evaluation.py:838
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,
"gallery",
multi_face_policy=multi_face_policy,
)
if embedding is not None:
gallery.append({"identity": item["identity"], "path": str(item["path"]), "embedding": embedding})View on GitHub (pinned to 7fadd420c2)
Solutions
- Verify gallery folders contain image files with recognized extensions (jpg/png/bmp per list_images)
- Check recursive listing actually finds images (nested subfolders vs non-recursive expectations)
- Confirm dataset_root/layout matches the mode (auto_split vs structured)
- Run a quick count: sum(1 for _ in (root/'gallery').rglob('*') if _.suffix.lower() in {'.jpg','.jpeg','.png','.bmp'})
Example fix
# before
result = run_identity_identification_evaluation(root, auto_split=False)
# after
gallery_imgs = list((root / "gallery").rglob("*.jpg"))
assert gallery_imgs, "no gallery images found"
result = run_identity_identification_evaluation(root, auto_split=False) Defensive patterns
Strategy: validation
Validate before calling
from pathlib import Path
EXTS = {".jpg", ".jpeg", ".png", ".bmp"}
gallery_dir = Path(root) / "gallery"
n = sum(1 for f in gallery_dir.rglob("*") if f.suffix.lower() in EXTS)
assert n > 0, "gallery empty" Try / catch
try:
result = run_identity_identification_evaluation(root, auto_split=False)
except ValueError as e:
if "at least one gallery image" in str(e):
populate_gallery_or_switch_layout() Prevention
- Count recognized images before starting long evaluations
- Keep extensions restricted to formats list_images accepts
- Automate dataset layout checks in a preflight script
When it happens
Trigger: Structured mode: gallery/ missing (also caught earlier) or containing no images in any identity folder. Auto-split mode: identity folders exist but contain no readable images, or layout has no recognizable identity folders for gallery assignment.
Common situations: Empty gallery folder or images with unsupported extensions filtered by list_images; dataset_root pointed at probe-only tree; all gallery images dropped by earlier validation.
Related errors
- 1:N evaluation requires at least one known probe image.
- No verification pairs could be generated from the selected i
- 1:N without Auto Split requires gallery/ and probe/ folders.
- Dataset root not found: {root}
- No gallery embeddings could be extracted.
AI-assisted analysis of deepinsight/insightface@7fadd420c2 (2026-08-28).
Data as JSON: /api/errors/75375f433a9a55ee.
Report an issue: GitHub.