{"record":{"id":"bc0909011303f62d","repo":"deepinsight/insightface","slug":"no-gallery-embeddings-could-be-extracted","errorCode":null,"errorMessage":"No gallery embeddings could be extracted.","messagePattern":"No gallery embeddings could be extracted\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"critical","filePath":"python-package/insightface/gui/core/evaluation.py","lineNumber":860,"sourceCode":"    errors: List[Dict[str, Any]] = []\n    cache: Dict[str, np.ndarray] = {}\n    gallery: List[Dict[str, Any]] = []\n    start_all = time.perf_counter()\n    for index, item in enumerate(gallery_items):\n        embedding = _embedding_for_image(\n            Path(item[\"path\"]),\n            engine,\n            cache,\n            errors,\n            \"gallery\",\n            multi_face_policy=multi_face_policy,\n        )\n        if embedding is not None:\n            gallery.append({\"identity\": item[\"identity\"], \"path\": str(item[\"path\"]), \"embedding\": embedding})\n        if progress_callback:\n            progress_callback(index + 1, len(gallery_items), f\"Indexed gallery {index + 1}/{len(gallery_items)}\")\n    if not gallery:\n        raise ValueError(\"No gallery embeddings could be extracted.\")\n\n    rows: List[Dict[str, Any]] = []\n    known_total = len(probe_items)\n    for index, item in enumerate(probe_items):\n        if cancel_callback and cancel_callback():\n            break\n        embedding = _embedding_for_image(\n            Path(item[\"path\"]),\n            engine,\n            cache,\n            errors,\n            \"probe\",\n            multi_face_policy=multi_face_policy,\n        )\n        if embedding is None:\n            rows.append({\"probe_path\": str(item[\"path\"]), \"ground_truth\": item[\"identity\"], \"error\": \"embedding unavailable\"})\n        else:\n            ranked = _rank_identities(embedding, gallery)","sourceCodeStart":842,"sourceCodeEnd":878,"githubUrl":"https://github.com/deepinsight/insightface/blob/7fadd420c2351d0ffa8cac403421c1a3ed733365/python-package/insightface/gui/core/evaluation.py#L842-L878","documentation":"Raised by run_identity_identification_evaluation after the gallery indexing loop when the gallery list is empty — every gallery image failed to yield an embedding (each failure recorded in errors). This is distinct from error 36: images existed but none were usable.","triggerScenarios":"All gallery images failing in _embedding_for_image (read failure, no face detected, multi-face skip, or missing embedding) so gallery stays empty while gallery_items was non-empty.","commonSituations":"Model weights not properly loaded so detection always fails; dataset of images with no visible faces (cropped face chips fed where full photos expected); multi_face_policy='skip' over group photos; systematic image corruption.","solutions":["Inspect the errors list in the raised run / add logging to see per-image causes and fix the dominant one","Test one gallery image standalone: read_image + engine.detect_faces to verify the engine works","Adjust multi_face_policy (e.g., centered_largest) if faces are present but ambiguous","Replace or re-source the gallery images if they are face crops or low quality"],"exampleFix":"# before\ngallery = [{\"identity\": it[\"identity\"], \"embedding\": _embedding_for_image(it[\"path\"], engine)} for it in gallery_items]\n# after (surface per-image failures)\nfor it in gallery_items:\n    emb = _embedding_for_image(it[\"path\"], engine)\n    if emb is None:\n        print(\"gallery embedding failed:\", it[\"path\"])\n# then fix root cause (policy, image quality, engine init)","handlingStrategy":"fallback","validationCode":"ok = 0\nfor it in gallery_items:\n    img = read_image(it[\"path\"])\n    if img is None:\n        continue\n    faces = engine.detect_faces(img)\n    if faces and max(faces, key=lambda f: (f.bbox[2]-f.bbox[0])*(f.bbox[3]-f.bbox[1])).normed_embedding is not None:\n        ok += 1\nassert ok > 0, \"all gallery embeddings will fail\"","typeGuard":null,"tryCatchPattern":"try:\n    result = run_identity_identification_evaluation(root, ...)\nexcept ValueError as e:\n    if \"No gallery embeddings\" in str(e):\n        diagnose_errors(result_or_log_errors); fix_policy_or_images(); retry","preventionTips":["Smoke-test the engine on one image before batch runs","Avoid multi_face_policy='skip' for uncurated galleries","Check errors rows after every run to catch systematic failures early"],"tags":["insightface","gallery","embedding","evaluation"],"backgroundTag":"all-embeddings-failed","analyzedSha":"7fadd420c2351d0ffa8cac403421c1a3ed733365","analyzedAt":"2026-08-28T15:44:01.850Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}