This repository contains the code for a self-driving bus authentication system that uses facial recognition to authenticate users for check-in and check-out. The system comprises both a frontend and a backend, with the backend utilizing the Python library dlib
and face_recognition
for face recognition and FastAPI for the API. The frontend uses Flask to serve webcam images to the backend for recognition.
- Facial recognition for user authentication.
- User check-in and check-out functionality.
- Integration with a database for user management and tracking.
- Real-time webcam image serving and recognition.
Before running the application, make sure you have the following prerequisites installed:
- Python 3.10 or higher
- pip package manager
- Required Python packages (see the
requirements.txt
file) - A webcam for image capture
-
Clone this repository to your local machine:
git clone https://github.com/nihaalnz/face-recognition
-
Navigate to the project directory:
cd face-recognition
-
Create a virtual environment (recommended)
python -m venv venv
-
Activate the virtual environment:
- On Windows:
venv\Scripts\activate
- On macOS or Linux:
source venv/bin/activate
- On Windows:
-
Install the required packages:
5.1 Install the required python packages (Requires C++ Build Tools and CMake):
pip install -r requirements.txt
5.2 Install the required node packages (need to have node and npm installed):
5.2.1 Navigate to frontend package (new terminal):
cd face-recognition/frontend
5.2.2 Install the npm packages:
npm install
5.2.3 Build the css using tailwind:
npm run build
-
Configure the database connection details in
.env
. -
Ensure that the necessary models for
dlib
andface_recognition
are downloaded and placed in the appropriate directories. You can follow the instructions provided by these libraries for their installation.
-
Make an .env file by filling the contents in sample.env
-
Start the backend FastAPI server:
python backend
The backend server will start at
http://localhost:8000
. -
Start the frontend Flask server (in a separate terminal):
python frontend
-
Access the application in your web browser at
http://localhost:5000
.
Contributions to this project are welcome! If you find a bug or have an enhancement in mind, please open an issue or create a pull request.
This project is licensed under the MIT License. See the LICENSE file for details.
- Thanks to the developers of
dlib
,face_recognition
, FastAPI, and Flask for their excellent libraries and frameworks.