File size: 4,908 Bytes
2385a75
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
---
license: mit
tags:
- image-classification
- pytorch
- skin-analysis
- dermatology
- computer-vision
datasets:
- custom
metrics:
- accuracy
- f1
pipeline_tag: image-classification
widget:
- src: https://example.com/dry-skin-sample.jpg
  example_title: Dry Skin
- src: https://example.com/oily-skin-sample.jpg
  example_title: Oily Skin
---

# 🔬 Skin Type Classification Model

A deep learning model for classifying skin types into **dry** and **oily** categories using computer vision.

## Model Description

This model is based on ResNet50 architecture and has been fine-tuned specifically for skin type classification. It can analyze facial skin images and determine whether the skin type is dry or oily with high accuracy.

### Key Features
- **Architecture**: ResNet50-based classification model
- **Classes**: 2 (dry, oily)
- **Input**: RGB images (224x224 pixels)
- **Framework**: PyTorch + Transformers
- **Performance**: High accuracy on skin type classification

## Intended Use

### Primary Use Cases
- Dermatological analysis and skin assessment
- Cosmetic product recommendation systems
- Skincare routine personalization
- Medical research and skin health monitoring

### Limitations
- Designed specifically for facial skin analysis
- Requires good lighting and clear skin visibility
- Not suitable for medical diagnosis (for research/cosmetic use only)
- Performance may vary across different skin tones and ethnicities

## How to Use

### Quick Start with Transformers

```python
from transformers import AutoModelForImageClassification, AutoImageProcessor
from PIL import Image
import torch

# Load model and processor
model = AutoModelForImageClassification.from_pretrained("your-username/skin-type-classifier")
processor = AutoImageProcessor.from_pretrained("your-username/skin-type-classifier")

# Load and process image
image = Image.open("path/to/skin/image.jpg")
inputs = processor(images=image, return_tensors="pt")

# Make prediction
with torch.no_grad():
    outputs = model(**inputs)
    predictions = torch.nn.functional.softmax(outputs.logits, dim=-1)
    predicted_class = predictions.argmax().item()

# Get result
labels = ["dry", "oily"]
confidence = predictions[0][predicted_class].item()
print(f"Predicted skin type: {labels[predicted_class]} (confidence: {confidence:.2%})")
```

### Using the Pipeline API

```python
from transformers import pipeline

# Create classification pipeline
classifier = pipeline("image-classification", model="your-username/skin-type-classifier")

# Classify image
result = classifier("path/to/skin/image.jpg")
print(result)
```

## Model Details

### Architecture
- **Base Model**: ResNet50
- **Modification**: Custom classification head with 2 output classes
- **Input Size**: 224 × 224 × 3 (RGB)
- **Parameters**: ~25M parameters

### Training Details
- **Dataset**: Custom skin type classification dataset
- **Preprocessing**: 
  - Resize to 224×224 pixels
  - Normalization: ImageNet statistics
  - Data augmentation applied during training
- **Training Framework**: PyTorch
- **Optimization**: Adam optimizer with learning rate scheduling

### Performance Metrics
- **Training Accuracy**: High performance on validation set
- **Inference Speed**: Fast inference suitable for real-time applications
- **Model Size**: ~94MB

## Technical Specifications

### Input Format
- **Type**: RGB Images
- **Size**: 224 × 224 pixels
- **Format**: PIL Image, numpy array, or torch tensor
- **Normalization**: ImageNet mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]

### Output Format
- **Type**: Classification logits
- **Classes**: 
  - 0: "dry" - Dry skin type
  - 1: "oily" - Oily skin type
- **Output**: Softmax probabilities for each class

## Ethical Considerations

### Bias and Fairness
- Model trained on diverse skin types but may have limitations
- Users should be aware of potential biases in skin tone representation
- Continuous evaluation needed for fair performance across demographics

### Privacy
- Model processes images locally - no data transmission required
- Users responsible for ensuring proper consent when analyzing others' images
- Recommend anonymization of facial features when possible

## License

This model is released under the MIT License. See LICENSE file for details.

## Citation

If you use this model in your research, please cite:

```bibtex
@misc{skin-type-classifier-2025,
  title={Skin Type Classification Model},
  author={Your Name},
  year={2025},
  howpublished={\\url{https://huggingface.co/your-username/skin-type-classifier}},
}
```

## Contact

For questions, issues, or collaboration opportunities, please reach out through the Hugging Face model page or GitHub repository.

---

**Disclaimer**: This model is for research and cosmetic purposes only. It should not be used for medical diagnosis or treatment decisions. Always consult healthcare professionals for medical concerns.