This project is a face recognition web application built using FastAPI. It includes functionalities for managing cameras, users, training models, making predictions, and viewing logs.
-
Clone the repository:
git clone https://github.com/yourusername/FaceRecog.git cd FaceRecog/WebApp/apiApp -
Run the installation script:
./install.sh
This script will:
- Download and install Anaconda.
- Create a new conda environment with Python 3.10.
- Install dependencies from
requirements.txt. - Install
torch,torchvision, andtorchaudiowith CUDA support. - Set the environment as the default in
.bashrc.
-
Activate the conda environment:
conda activate myenv
-
Run the FastAPI application:
uvicorn app.main:app --reload
-
Access the API documentation at http://localhost:8000/docs.
-
Get Camera URLs
GET /camera/- Fetches the list of camera URLs.
-
Update Camera URLs
POST /camera/- Updates the list of camera URLs.
-
Add User
POST /user/add_user/{user_name}- Adds a new user.
-
Remove User
DELETE /user/remove_user/{user_name}- Removes an existing user.
-
Add Image
POST /user/add_image/{user_name}- Adds images for a user.
-
Remove Image
DELETE /user/remove_image/{user_name}- Removes images for a user.
-
Start Training
POST /train/- Starts the training process.
-
Get Training Status
GET /train/status- Fetches the training status.
-
Start Prediction
POST /predict/- Starts the prediction process.
-
Get Prediction Status
GET /predict/status- Fetches the prediction status.
-
Stop Prediction
POST /predict/stop- Stops the prediction process.
-
List Logs
GET /logs/{log_type}/logs- Lists all log files for a specific log type.
-
Get Log
GET /logs/{log_type}/logs/{log_file}- Fetches a specific log file.
-
Delete Log
DELETE /logs/{log_type}/logs/{log_file}- Deletes a specific log file.
Logs are stored in the logs directory with separate subdirectories for application, inference, and training logs.
Configuration settings are stored in the .env file and various configuration files in the machine_learning/config directory.
The project directory structure is as follows:
FaceRecog/
├── WebApp/
│ ├── apiApp/
│ │ ├── app/
│ │ ├── logs/
│ │ ├── machine_learning/
│ │ ├── .env
│ │ ├── install.sh
│ │ ├── requirements.txt
│ │ ├── postman_collection.json
│ │ ├── README.md
│ │ └── .gitignore
│ └── ...
└── ...
Contributions are welcome! Please fork the repository and submit a pull request.
This project is licensed under the MIT License.
This project is owned by PT Sentra Teknologi.