- Introduction
- Features
- Prerequisites
- Installation
- Directory Structure
- Configuration
- Usage
- API Endpoints
- Data Flow Overview
- Troubleshooting
- Additional Notes
- License
This backend application replicates a simplified version of Amazon Prime Video's X-Ray feature. It processes uploaded videos to recognize faces in different scenes and identifies known actors using facial recognition and classification models. The application provides a FastAPI-based API for video uploading, processing, and retrieving processed results.
- Face Detection: Detects faces in video scenes using face_recognition and OpenCV.
- Face Recognition: Matches detected faces against a database of known actors.
- Scene Processing: Processes videos based on provided scene timestamps.
- API Endpoints: FastAPI application with endpoints for video uploading and results retrieval.
- Data Storage: Stores actor information and processing results in JSON files.
- Extensibility: Modular code structure for easy expansion and customization.
- Python: Version 3.7 or higher.
- CMake: Required for building dlib, which is a dependency of face_recognition.
- Git: For cloning the repository (optional).
-
Clone the Repository
git clone https://github.com/your-username/your-repo-name.git cd your-repo-name
-
Create a Virtual Environment
python -m venv venv source venv/bin/activate # On Unix or macOS venv\Scripts\activate # On Windows
-
Install Dependencies
pip install --upgrade pip pip install -r requirements.txt
-
Install CMake (if not already installed)
- Windows: Download from the official CMake website
- Ubuntu/Debian:
sudo apt-get install cmake
- macOS:
brew install cmake
project/
├── main.py
├── models/
│ ├── face_recognition.py
│ └── face_classification.py
├── data/
│ ├── known_actors/
│ ├── actors.json
│ ├── known_faces.pkl
│ ├── uploaded_videos/
│ └── results/
├── requirements.txt
├── .gitignore
└── README.md
- Prepare Known Actors Data
- Create actors.json
- Generate Known Faces Database
For detailed configuration steps, refer to the full documentation.
- Set up the Known Actors Database
- Run the FastAPI Server:
uvicorn main:app --reload
- Test the API endpoints
For detailed usage instructions, refer to the full documentation.
- POST /upload_video
- GET /results
For detailed API documentation, refer to the full documentation.
- Video Uploading
- Face Detection and Recognition
- Results Generation
- Response to Client
- Cleanup
- CMake Not Found Error
- dlib Installation Issues
- Face Recognition Accuracy
- Empty Results
- Server Errors
For detailed troubleshooting steps, refer to the full documentation.
- Security Considerations
- Performance Optimization
- Extending the Application
- Data Privacy
This project is licensed under the MIT License - see the LICENSE file for details.
- Libraries Used: FastAPI, Uvicorn, face_recognition, OpenCV, Pydantic
- Inspiration: Amazon Prime Video's X-Ray feature
Feel free to contribute to this project by submitting issues or pull requests. If you have any questions or need further assistance, please contact the project maintainer.