Skip to content

Aeshan-Rosa/facial_recognition-for-CrowdEye

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

5 Commits
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🧠 facial_recognition-for-CrowdEye

Facial recognition module for the CrowdEye Smart Passenger Monitoring System.
This Python application performs real-time identification using webcam video feed and a directory of known face images.


πŸš€ What This System Does

βœ… Detects faces using webcam (OpenCV)
βœ… Recognizes known individuals using deep learning encodings
βœ… Marks labels directly on the live video stream
βœ… Shows Unknown for unmatched faces
βœ… Easy to update β€” just add images to known_faces/
βœ… Supports multiple people in a single frame


🧩 Project Structure

facial_recognition-for-CrowdEye/ β”œβ”€β”€ facial_recognition.py # Main script └── known_faces/ # Image database of known users

πŸ“ To add a new person, simply drop 1 or more of their photos into known_faces/.


πŸ–₯️ Live System Workflow

Webcam Feed β†’ Face Detection β†’ Face Encoding β†’ Matching β†’ Display with Labels

A 128-dimensional facial encoding is generated and compared against known encodings in memory.


πŸ”§ Installation

Ensure Python 3.8+ is installed.

Install dependencies:

pip install --upgrade pip
pip install opencv-python face_recognition numpy

⚠️ If installation errors occur for face_recognition, install CMake & C++ Build Tools:
	β€’	Windows: Visual Studio Build Tools
	β€’	macOS/Linux: cmake g++ packages

βΈ»

▢️ Run the Program

python facial_recognition.py

	β€’	A webcam window opens
	β€’	Press Q to exit

βΈ»

πŸ‘€ Adding New Faces

Add images into known_faces/ using either method:

βœ… All images in the root folder

known_faces/
 β”œβ”€β”€ Aeshan_1.jpg
 β”œβ”€β”€ Aeshan_2.jpg
 └── John.jpg

OR

βœ… Separate folders per person

known_faces/
 β”œβ”€β”€ Aeshan/
 β”‚   β”œβ”€β”€ 1.jpg
 β”‚   └── 2.jpg
 └── John/
     └── 1.jpg

Better results come from front-facing images with good lighting.

βΈ»

βš™οΈ Performance & Matching Settings

You can modify these inside the script:

Config	Purpose
tolerance	Lower = stricter match (0.4–0.6 recommended)
model	hog (CPU-fast) or cnn (GPU-accurate)
Frame resize	Improves FPS during livestream


βΈ»

πŸ”„ Updating the System

Pull the latest version:

git pull origin main

To update face profiles:
βœ… Add/remove images in known_faces/
βœ… Re-run program β€” it automatically re-encodes

βΈ»

πŸ› Troubleshooting

Issue	Solution
Black screen / no camera	Change webcam index (0 β†’ 1)
Slow performance	Resize frames, use hog model
Incorrect recognition	Add more photos per person / adjust tolerance
dlib failing to install	Install CMake & C++ build tools


βΈ»

πŸ” Ethical & Privacy Considerations

This system processes biometric identity data.
Use responsibly:

βœ… Obtain consent
βœ… Protect stored face images
βœ… Follow local data protection rules

βΈ»

🌱 Future Improvements (Planned)
	β€’	Face encoding caching (faster startup)
	β€’	Live backend sync with CrowdEye central system
	β€’	Liveness / anti-spoofing detection
	β€’	Full hardware deployment for bus entry validation
	β€’	GPU support for high throughput

βΈ»

πŸ’‘ Credits
	β€’	face_recognition (dlib encodings)
	β€’	OpenCV (video capture)
	β€’	NumPy (array operations)

βΈ»

About

CrowdEye project facial recognition logic

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages