deepinsight/insightface · error · ValueError
no face or embedding
Error message
no face or embedding
What it means
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.
Source
Thrown at python-package/insightface/gui/core/evaluation.py:228
def _embedding_for_image(
path: Path,
engine: FaceEngine,
cache: Dict[str, np.ndarray],
errors: List[Dict[str, Any]],
stage: str,
multi_face_policy: str = MULTI_FACE_REQUIRE_ONE,
) -> Optional[np.ndarray]:
key = str(path)
if key in cache:
return cache[key]
policy = _normalize_multi_face_policy(multi_face_policy)
try:
image, faces = _detect_faces_for_image(path, engine)
face = _select_face_from_faces(faces, image.shape, path, policy, stage)
if face is None or face.normed_embedding is None:
raise ValueError("no face or embedding")
embedding = np.asarray(face.normed_embedding, dtype=np.float32).reshape(-1)
cache[key] = embedding
return embedding
except Exception as exc:
errors.append({"path": key, "error": str(exc), "stage": stage})
return None
def _collect_verification_specs(root: Path, auto_split: bool) -> tuple[List[Dict[str, Any]], List[Dict[str, Any]]]:
identities = _identity_dirs(root)
specs: List[Dict[str, Any]] = []
structure_errors: List[Dict[str, Any]] = []
if auto_split:
for identity_dir in identities:
identity = _identity_name(identity_dir)
gallery, probes = _auto_split_identity_images(identity_dir)
if gallery is None:
structure_errors.append({"identity": identity, "error": "identity folder has no images"})View on GitHub (pinned to 7fadd420c2)
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
Example fix
# before
emb = _embedding_for_image(path, engine)
# after
emb = _embedding_for_image(path, engine)
if emb is None:
print(result_errors_for(path)) # inspect {'path':..., 'error': 'no face or embedding', 'stage':...} Defensive patterns
Strategy: try-catch
Validate before calling
img = read_image(path) faces = engine.detect_faces(img) ok = len(faces) >= 1 and all(f.normed_embedding is not None for f in faces)
Try / catch
try:
emb = _embedding_for_image(path, engine)
except ValueError as e:
record_error(path, str(e)) # errors list already captures path/stage Prevention
- 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
When it happens
Trigger: An image where detection/select returns a face without normed_embedding, or selection yields None, during verification or identification evaluation runs.
Common situations: 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.
Related errors
- skipped multi-face image ({face_count} faces)
- No gallery embeddings could be extracted.
- no face detected
- multiple faces detected ({face_count}); expected exactly one
- image read failure
AI-assisted analysis of deepinsight/insightface@7fadd420c2 (2026-08-28).
Data as JSON: /api/errors/47d1964d2d86422a.
Report an issue: GitHub.