π Finalist β Social Development Innovation Hackathon (Team Mulai'm / Ω ΩΩΨ§Ψ¦Ω )
A facial-resemblance matching system that, given photos of two parents, finds the children whose faces most resemble the combined parental identity β built on face embeddings rather than raw images, so no personal photos need to be stored.
The project was built for a social-development use case (e.g. supporting family reunification / kinship matching) where privacy is a hard requirement: faces are converted to mathematical vectors immediately, and matching happens entirely in embedding space.
- Face embeddings β each face is encoded with InsightFace (
buffalo_l, ArcFace) into a normalized 512-dimensional vector (family_system.py:FaceProcessor). - Family embedding β the mother and father embeddings are blended into a single
"family identity" vector using a tunable mixing weight
alpha(create_family_embedding).find_best_alphacan optimizealphaagainst a known child when one is available. - Matching β the family vector is compared against a database of children
embeddings using cosine similarity, returning the top-K most similar children
with a 0β100 resemblance score and a
low_confidenceflag when a match falls below the similarity threshold. - Two strategies, auto-selected β the system implements both a family-vector
method (single blended vector) and a weighted method (parent similarities
combined separately), and
pick_methodautomatically chooses the stronger one per query.
- Matching operates on embeddings (vectors), not stored photographs.
- Uploaded images are processed transiently to extract an embedding; this repository
intentionally ships no faces, no embedding database, and no personal data
(enforced via
.gitignore). - The embedding database is built locally by the operator from their own images.
- Face recognition: InsightFace (
buffalo_l/ ArcFace), OpenCV - Matching: NumPy (cosine similarity over normalized embeddings)
- API: Flask + Flask-CORS (
app.pyβPOST /api/upload) - Storage: NumPy
.npyembedding store + SQLite embedding store (sql.py) - Frontend: HTML templates (
templates/)
family-system/
βββ family_system.py # Core: FaceProcessor, FamilyMatcher, build_database
βββ app.py # Flask API β POST /api/upload (mother + father β top-K children)
βββ sql.py # Build a SQLite embedding store from the .npy database
βββ backend/ # Alternative Flask app factory + blueprint
βββ templates/ # index / results / base HTML
βββ requirements.txt
# 1. Install
pip install -r requirements.txt
# 2. Build the children embedding database from your own images
# (place images in ./children_db, then:)
python -c "from family_system import build_database; build_database('children_db')"
# 3. Start the API
python app.py
# POST mother_img + father_img (multipart) to http://localhost:5000/api/upload- Matching currently uses NumPy cosine similarity; swapping in a FAISS index is the natural next step for scaling to large databases.
- A per-region facial-landmark explainability view (which regions drive the match) is a planned explainability layer.
Collaborative hackathon project. Core matching engine by @yousef0852; team contributions from @Manar567.