How wrishavsett/face-verification-service works
This is a FastAPI face-verification service for examination centres. A caller submits a student ID and webcam image to the verify endpoint; the route decodes the image, retrieves the enrolled reference photo, obtains embeddings for both, applies a similarity threshold, and returns a decision. Enrollment validates a single face before saving the reference. The graph follows the sampled route calls and documented API capabilities; it omits unsampled internals beyond their documented role.
Main entry points: main.py FastAPI app · verify.py Verification route · face_service.py Face detection and embeddings · enroll.py Enrollment route
Components 13
API entrypoints
- FastAPI app
app/main.py - Enrollment route
app/api/v1/routes/enroll.py - Verification route
app/api/v1/routes/verify.py
Image processing
- Image decoding
app/utils/image_utils.py
Face and matching
- Face detection and embeddings
app/services/face_service.py - Similarity decision
app/services/similarity_service.py
Reference storage
- Reference photo storage
app/services/storage_service.py
Runtime and contracts
- Service configuration
app/core/config.py - Error handling
app/core/exceptions.py - Response schemas
app/models/responses.py - Request validation
app/models/requests.py
Other components
- Examination client
- InsightFace runtime
Connections 23
- Examination client → FastAPI app: sends API requests
README.md - FastAPI app → Enrollment route: routes enrollment
app/main.py - FastAPI app → Verification route: routes verification
app/main.py - FastAPI app → Face detection and embeddings: initializes model
app/main.py - Enrollment route → Image decoding: decodes upload
app/api/v1/routes/enroll.py - Enrollment route → Face detection and embeddings: checks face count
app/api/v1/routes/enroll.py - Enrollment route → Reference photo storage: saves reference
app/api/v1/routes/enroll.py - Enrollment route → Response schemas: returns enrollment schema
app/api/v1/routes/enroll.py - Verification route → Image decoding: decodes snapshot
app/api/v1/routes/verify.py - Verification route → Reference photo storage: loads reference
app/api/v1/routes/verify.py - Verification route → Face detection and embeddings: embeds both images
app/api/v1/routes/verify.py - Verification route → Similarity decision: evaluates embeddings
app/api/v1/routes/verify.py - Verification route → Response schemas: returns verification schema
app/api/v1/routes/verify.py - Face detection and embeddings → InsightFace runtime: detects and embeds
app/services/face_service.py - Face detection and embeddings → Service configuration: reads model settings
app/services/face_service.py - Similarity decision → Service configuration: reads threshold
app/services/similarity_service.py - Reference photo storage → Service configuration: reads photo directory
app/services/storage_service.py - Reference photo storage → Image decoding: decodes stored image
app/services/storage_service.py - FastAPI app → Service configuration: configures API
app/main.py - FastAPI app → Error handling: maps exceptions
app/main.py - Image decoding → Error handling: raises invalid-image errors
app/utils/image_utils.py - Face detection and embeddings → Error handling: raises face-detection errors
app/services/face_service.py - Reference photo storage → Error handling: raises missing-student error
app/services/storage_service.py