How ankithac46/face-sketch-construction-and-recognition-for-forensic works
Project type and purpose
• This is a full‐stack web application for forensic face‐sketch construction and recognition.
• It provides a drag‐and‐drop UI (frontend) to assemble facial features into a composite sketch and a backend service (Flask + Python) that runs face‐recognition algorithms against a criminal database.
File structure
• Top level:
• Project Snapshots (screenshots folder)
• README.md
• static/ (all JS/CSS/images/assets)
– assets/ (SVG/PNG elements: eyes, nose, etc.)
– photos/, uploads/ (runtime image storage)
• templates/ (Jinja2 HTML views: index, start, construct, result)
• Missing from tree but implied: app.py (Flask entry point), a models/ or database module, and ML helper scripts.
• MVC-style split:
• View layer: templates + static files
• Controller layer: Flask routes in app.py
• Model layer: database schema + face_recognition logic
README for additional insights
• Frontend: JavaScript drag‐and‐drop assembly
• Backend: Python Flask for HTTP API and orchestration
• ML: face_recognition, OpenCV, NumPy, Pillow for encoding and matching
• Database: SQLite or PostgreSQL storing criminal face encodings and metadata
Main components & their interactions
a. Components
– Client Browser (UI)
– Static Asset Server (serves HTML, CSS, JS, feature‐images)
– Flask Application
– Face-Recognition Module (third-party libraries)
– Database (SQLite/PostgreSQL)
– File Storage (static/uploads, static/photos)
b. Relationships/Interactions
1. User opens index.html → drag-and-drop UI loads feature assets.
2. On “Submit Sketch” action, frontend sends POST (multipart/form‐data or base64 image) to Flask route.
3. Flask receives image, saves to static/uploads, passes it to face_recognition pipeline.
4. Pipeline loads stored face encodings from DB, compares distances, picks top matches.
5. Flask queries DB for matching records, renders result.html with thumbnails + similarity scores.
c. Architectural patterns/design principles
– Layered architecture (Presentation → Application → Data)
– Separation of concerns: UI logic in JS/HTML, backend logic in Python, ML logic in a dedicated module, persistence in DB
– MVC-ish:
• View = templates + static
• Controller = Flask routes
• Model = DB + encoding loader
– Pluggable assets: facial feature libraries are interchangeable
d. Key technologies/frameworks/libraries
– Flask
– face_recognition (dlib under the hood)
– OpenCV, NumPy, Pillow (image processing)
– SQLite/PostgreSQL (via SQLAlchemy or raw)
– JavaScript drag-and-drop libraries (native HTML5 or a small helper)
– Jinja2 templating