The Face Detection API is a simple tool for detecting faces in images, overlaying facial landmarks, and providing additional data about the detected features.
- Python 3.6 or higher
- Pip (Python package installer)
- Visual Studio Build Tools (required for dlib)
-
Clone the repository:
git clone https://github.com/thewhsmith/Face-Detection-API.git
-
Navigate to the project directory:
cd Face-Detection-API
-
Install Visual Studio Build Tools from Visual Studio Downloads.
-
Install the required Python packages:
pip install -r requirements.txt
-
Download the shape predictor file from Dlib's official website and place it in the
data/
folder.
-
Run the Flask application:
python main.py
The API will be accessible at http://127.0.0.1:5000/.
-
Use the API to detect faces in an image:
- Endpoint:
POST /overlay
- Request Type: Multipart/form-data
- Request Parameter:
image
: Upload an image file.
Example using cURL:
curl -X POST -H "Content-Type: multipart/form-data" -F "image=@/path/to/your/image.jpg" http://127.0.0.1:5000/overlay
The response will include a unique job ID, a URL to the processed image, processing time, and data about the detected faces.
- Endpoint:
-
Retrieve information about a specific job:
- Endpoint:
GET /jobs/<job_id>
- **Replace
<job_id>
with the actual job ID obtained from the overlay response.
Example using cURL:
curl http://127.0.0.1:5000/jobs/unique_job_id
This will provide details about the specified job.
- Endpoint:
-
Retrieve the processed image associated with a job:
- Endpoint:
GET /jobs/<job_id>/result_image.png
- **Replace
<job_id>
with the actual job ID obtained from the overlay response.
Example using cURL:
curl -OJ http://127.0.0.1:5000/jobs/unique_job_id/result_image.png
This will download the processed image.
- Endpoint:
Enjoy using the Face Detection API! If you have any questions or encounter issues, feel free to reach out to support at [email protected].