Face Data Classes
Overview
Face data in degirum-face is represented by two related classes:
FaceAttributes- Contains face identity data (embeddings, attributes, images)FaceRecognitionResult- Includes allFaceAttributesproperties plus detection metadata (bounding box, scores, landmarks)
FaceAttributes
Contains face identity data without detection-specific information. Used primarily for enrollment workflows.
Properties
attributes
dict or str or None
Person metadata. Can be any Python dictionary containing person information (first name, last name, address, etc.) or a simple string for the person's name. Examples in this documentation use simple strings for clarity.
db_id
str or None
Database ID if stored
embeddings
list
Face embedding vector(s) (512-D each). May contain multiple embeddings when returned by find_faces_in_file() / find_faces_in_clip()
images
list
Cropped face images (numpy arrays) corresponding to embeddings. May contain multiple images when returned by find_faces_in_file() / find_faces_in_clip()
When It's Used
find_faces_in_file() and find_faces_in_clip() return Dict[int, FaceAttributes] - a mapping of track IDs to face data. Each FaceAttributes object contains:
Multiple embeddings - One for each frame where the face was detected (or sampled based on reid_expiration_frames)
Multiple images - Corresponding cropped face images for each embedding
This accumulated data across frames provides robust face representations for enrollment
Also used as input to FaceTracker.enroll() for batch enrollment.
Usage Example
FaceRecognitionResult
Subclasses FaceAttributes to add detection-specific metadata. Used for real-time recognition results.
Properties
Inherits all FaceAttributes properties (attributes, db_id, embeddings, images) plus:
bbox
list
Bounding box [x1, y1, x2, y2]
detection_score
float
Face detection confidence 0.0-1.0
similarity_score
float or None
Match confidence 0.0-1.0 (None if unknown)
landmarks
array
Facial keypoints (eyes, nose, mouth)
frame_id
int or None
Frame number (when applicable)
Important notes:
The
embeddingsandimageslists contain a single item when returned byenroll_image(),enroll_batch(),predict(), orpredict_batch(). Access usingresult.embeddings[0]andresult.images[0]. This is different fromfind_faces_in_file()/find_faces_in_clip()which return multiple embeddings/images per track.When using FaceTracker,
track_idis inInferenceResults.results, not as a property. Access viaresult.results[i].get("track_id")
When It's Used
Returned by
enroll_image()andenroll_batch()Contained in
InferenceResults.facesfrompredict()andpredict_batch()
Usage Examples
Check if face was detected:
Access detection properties:
Access embeddings and cropped images:
FaceTracker - Access tracking data:
Return Types by Method
FaceRecognizer
enroll_image()
Optional[FaceRecognitionResult]
enroll_batch()
List[FaceRecognitionResult]
predict()
InferenceResults (.faces property yields FaceRecognitionResult objects)
predict_batch()
Iterator of InferenceResults
FaceTracker
predict_batch()
Iterator of InferenceResults (.faces property yields FaceRecognitionResult objects)
find_faces_in_file()
Dict[int, FaceAttributes]
find_faces_in_clip()
Dict[int, FaceAttributes]
Last updated
Was this helpful?

