File size: 2,529 Bytes
32ec1c3
477d55b
 
 
 
32ec1c3
 
 
477d55b
32ec1c3
477d55b
32ec1c3
 
477d55b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
---
title: Acne Detection AI πŸ”₯
emoji: πŸ”₯
colorFrom: indigo
colorTo: yellow
sdk: gradio
sdk_version: 5.25.2
app_file: app.py
pinned: true
license: apache-2.0
short_description: Advanced AI for Acne Segmentation & Severity Classification
---

# 🧠 Acne Detection & Classification with Deep Learning

![banner](https://huggingface.co/spaces/RihemXX/Acnes/resolve/main/images/output1.png) <!-- You can upload a real image here -->

This application demonstrates a powerful **AI-driven pipeline** for **acne detection, segmentation**, and **severity classification**, combining:

- A **UNet-based CNN** for precise acne lesion segmentation (pixel-wise accuracy β‰ˆ **96–98%**)
- A **transformer-based classifier** (fine-tuned Vision Transformer) for grading severity based on dermatological standards

Try it by uploading a face image.  
It will return:
βœ… a **visual overlay** showing detected acne regions  
βœ… a **severity label** (from clear skin to very severe acne)

---

## πŸ§ͺ Model Architecture

### πŸ”Ή Segmentation Model
- Architecture: `UNet` with `ResNet34` backbone (from [smp](https://github.com/qubvel/segmentation_models.pytorch))
- Optimized for: Binary mask prediction of acne regions
- Trained on: Annotated dermatological datasets
- Accuracy: **Pixel Accuracy β‰ˆ 98%**, **IoU β‰ˆ 91%**

### πŸ”Ή Classification Model
- Architecture: Vision Transformer (ViT)
- Source: [`imfarzanansari/skintelligent-acne`](https://huggingface.co/imfarzanansari/skintelligent-acne)
- Labels: From `Level -1 (Clear)` to `Level 4 (Very Severe Acne)`
- Input: Facial image
- Output: Severity level + confidence score

---

## πŸ“ˆ Example Output

| Input Image | Segmentation Overlay | Acne Level |
|-------------|----------------------|------------|
| ![input](https://huggingface.co/spaces/RihemXX/Acnes/resolve/main/images/image.png) | ![overlay](https://huggingface.co/spaces/RihemXX/Acnes/resolve/main/images/output.png) | Level 2: Moderate Acne |

---

## πŸ’‘ Use Cases
- Dermatology research and screening
- Skincare and cosmetic product testing
- Automated health monitoring platforms

---

## 🧩 Tech Stack
- `PyTorch`, `Segmentation Models PyTorch`
- `Transformers` by Hugging Face
- `Albumentations` for fast preprocessing
- `OpenCV`, `Gradio` for live interface




## πŸ€– Try it now!

Click below and upload a photo to get real-time predictions:

Check out the configuration reference at [https://huggingface.co/docs/hub/spaces-config-reference](https://huggingface.co/docs/hub/spaces-config-reference)