{"record":{"id":"47d1964d2d86422a","repo":"deepinsight/insightface","slug":"no-face-or-embedding","errorCode":null,"errorMessage":"no face or embedding","messagePattern":"no face or embedding","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python-package/insightface/gui/core/evaluation.py","lineNumber":228,"sourceCode":"\n\ndef _embedding_for_image(\n    path: Path,\n    engine: FaceEngine,\n    cache: Dict[str, np.ndarray],\n    errors: List[Dict[str, Any]],\n    stage: str,\n    multi_face_policy: str = MULTI_FACE_REQUIRE_ONE,\n) -> Optional[np.ndarray]:\n    key = str(path)\n    if key in cache:\n        return cache[key]\n    policy = _normalize_multi_face_policy(multi_face_policy)\n    try:\n        image, faces = _detect_faces_for_image(path, engine)\n        face = _select_face_from_faces(faces, image.shape, path, policy, stage)\n        if face is None or face.normed_embedding is None:\n            raise ValueError(\"no face or embedding\")\n        embedding = np.asarray(face.normed_embedding, dtype=np.float32).reshape(-1)\n        cache[key] = embedding\n        return embedding\n    except Exception as exc:\n        errors.append({\"path\": key, \"error\": str(exc), \"stage\": stage})\n        return None\n\n\ndef _collect_verification_specs(root: Path, auto_split: bool) -> tuple[List[Dict[str, Any]], List[Dict[str, Any]]]:\n    identities = _identity_dirs(root)\n    specs: List[Dict[str, Any]] = []\n    structure_errors: List[Dict[str, Any]] = []\n    if auto_split:\n        for identity_dir in identities:\n            identity = _identity_name(identity_dir)\n            gallery, probes = _auto_split_identity_images(identity_dir)\n            if gallery is None:\n                structure_errors.append({\"identity\": identity, \"error\": \"identity folder has no images\"})","sourceCodeStart":210,"sourceCodeEnd":246,"githubUrl":"https://github.com/deepinsight/insightface/blob/7fadd420c2351d0ffa8cac403421c1a3ed733365/python-package/insightface/gui/core/evaluation.py#L210-L246","documentation":"Raised by _embedding_for_image when face selection returned None or the selected face has no normed_embedding. Note the surrounding try/except appends the error to the errors list and returns None, so this message typically surfaces in result error rows rather than as a crash.","triggerScenarios":"An image where detection/select returns a face without normed_embedding, or selection yields None, during verification or identification evaluation runs.","commonSituations":"Very small or blurred faces where the model skips embedding extraction; engine/model misconfigured so embeddings are never computed; face crop too small after alignment.","solutions":["Check the errors rows (path/stage) to see which images failed and inspect them","Increase image resolution or face size (better quality source images)","Verify the FaceEngine model supports embedding extraction and was initialized correctly","Apply a different multi_face_policy or retry failing images individually"],"exampleFix":"# before\nemb = _embedding_for_image(path, engine)\n# after\nemb = _embedding_for_image(path, engine)\nif emb is None:\n    print(result_errors_for(path))  # inspect {'path':..., 'error': 'no face or embedding', 'stage':...}","handlingStrategy":"try-catch","validationCode":"img = read_image(path)\nfaces = engine.detect_faces(img)\nok = len(faces) >= 1 and all(f.normed_embedding is not None for f in faces)","typeGuard":null,"tryCatchPattern":"try:\n    emb = _embedding_for_image(path, engine)\nexcept ValueError as e:\n    record_error(path, str(e))  # errors list already captures path/stage","preventionTips":["Check face.normed_embedding is not None before relying on it","Use higher-resolution source images","Monitor the errors rows of evaluation results for embedding failures"],"tags":["insightface","embedding","face-detection","evaluation"],"backgroundTag":"embedding-extraction-failed","analyzedSha":"7fadd420c2351d0ffa8cac403421c1a3ed733365","analyzedAt":"2026-08-28T15:44:01.850Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}