This project provides an API for detecting acne in face images using YOLOv8. It highlights acne spots and generates a severity score based on the detected acne area.
✅ Detects acne spots on facial images
✅ Generates severity score (Mild, Moderate, Severe)
✅ Returns a processed image with acne highlighted
✅ Built using FastAPI & YOLOv8
✅ Simple API to receive user data and image
├── dataset/ # Dataset directory
│ ├── train/
│ │ ├── images/
│ │ ├── labels/
│ ├── valid/
│ │ ├── images/
│ │ ├── labels/
│ ├── test/
│ │ ├── images/
│ │ ├── labels/
├── models/ # Trained YOLOv8 model
├── results/ # Processed images output
├── main.py # FastAPI backend
├── requirements.txt # Dependencies
├── config.yaml # YOLOv8 dataset config
├── README.md # Project documentation
git clone https://github.com/yourusername/acne-detection-api.git
cd acne-detection-api
python -m venv .venv
source .venv/bin/activate # On Windows, use: .venv\Scripts\activate
pip install -r requirements.txt
uvicorn app:app --host 0.0.0.0 --port 8000
Go to: http://127.0.0.1:8000/docs
You can test the API here by uploading an image and entering user details.
📌 Request: (multipart/form-data)
{
"name": "John Doe",
"age": 22,
"file": "image.jpg"
}
📌 Response: (JSON)
{
"name": "John Doe",
"age": 22,
"acne_spots": 10,
"total_acne_area": 4500,
"severity": "Moderate",
"processed_image": "results/image.jpg"
}
- Visit: http://127.0.0.1:8000/docs
- Click on
POST /analyze_acne/
- Upload a face image and enter
name
&age
- Click Execute to get results
- Open Postman
- Create a
POST
request tohttp://127.0.0.1:8000/analyze_acne/
- In
Body
(form-data):name
: Text (e.g., "John Doe")age
: Text (e.g., "22")file
: File (upload an image)
- Click Send to receive results
curl -X 'POST' 'http://127.0.0.1:8000/analyze_acne/' \
-F 'name=John Doe' \
-F 'age=22' \
-F 'file=@path/to/your/image.jpg'
This project is open-source and available under the MIT License.
Developed by Seneth Mendis Kumarasignha
🔗 GitHub: github.com/senethmendis