File size: 2,315 Bytes
f89b7e9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
license: mit
tags:
- pytorch
- diffusers
- unconditional-image-generation
- diffusion-models-class
---

### Fine-tuned Skin Rash Detection Model v2

#### Model Overview
- **Base Model**: `google/ddpm-celebahq-256`
- **Fine-tuning Dataset**: Skin Rash Dataset
- **Output Image Size**: 256 x 256 pixels

#### Updates and Changes
1. **Parameter Increase**:
   - Previous Model: 18.54 Million Parameters
   - Current Model: 113.67 Million Parameters

2. **Image Output Size**:
   - Previous: 32 x 32 pixels
   - Current: 256 x 256 pixels

3. **Batch Size**:
   - Previous: 64 samples per batch
   - Current: 6 samples per batch

4. **Gradient Accumulation**:
   - Implemented gradient accumulation to simulate a larger batch size without exceeding GPU memory limits.

5. **Timesteps**:
   - Reduced timesteps from 1000 to 40 for faster training and inference.

#### Training Details
- **Epochs**: 12
- **Number of Training Images**: 656
- **Optimizer**: AdamW with learning rate adjusted for gradient accumulation
- **Learning Rate**: Initially set at \(1 	imes 10^-5\), adjusted for gradient accumulation
- **Gradient Accumulation Steps**: 2
- **Loss Function**: Mean Squared Error (MSE) Loss

#### Performance
- **Training Loss**: Monitored and recorded over 12 epochs, with periodic visualization of generated images to ensure the model learns effectively.

#### Training Environment
- **Hardware**: GPU with 15GB RAM
- **Software**: PyTorch, torchvision, diffusers library

#### Usage
- The fine-tuned model can generate high-resolution images of skin rashes, which can be useful for medical analysis and diagnosis.
- Due to the increased parameter count and higher resolution, the model is more accurate in capturing fine details in the images.

#### Example Usage Code
```python
from diffusers import DDPMPipeline

pipeline = DDPMPipeline.from_pretrained('DhruvParth/ddpm-celebahq-256-fineTuned-skin_rash_v2_12epochs')
image = pipeline().images[0]
image
```
```

#### Considerations
- **Batch Size**: Due to GPU memory constraints, batch size is limited to 6 samples.
- **Training Time**: Reduced timesteps to 40, allowing faster training and inference without significantly compromising on quality.
- **Gradient Accumulation**: Enabled to manage large model parameter count and small batch size effectively.