Update README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,74 @@
|
|
1 |
-
---
|
2 |
-
license: apache-2.0
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: apache-2.0
|
3 |
+
language:
|
4 |
+
- en
|
5 |
+
pipeline_tag: image-classification
|
6 |
+
---
|
7 |
+
# Skin Disease Classification Model
|
8 |
+
|
9 |
+
This repository hosts a machine learning model for **skin disease classification**, designed to predict skin conditions from input images. The model is trained on [dermnet] dataset and provides a simple yet effective way to classify skin diseases.
|
10 |
+
|
11 |
+
## Model Overview
|
12 |
+
|
13 |
+
- **Model Architecture**: [ResNet34]
|
14 |
+
- **Framework**: PyTorch
|
15 |
+
- **Input**: RGB image of size [224x224].
|
16 |
+
- **Output**: Predicted label for skin disease.
|
17 |
+
- **Training Dataset**: [Dermnet].
|
18 |
+
|
19 |
+
---
|
20 |
+
|
21 |
+
## Usage Instructions
|
22 |
+
|
23 |
+
### Loading the Model
|
24 |
+
|
25 |
+
You can load this model using the `torch` library in Python:
|
26 |
+
|
27 |
+
```python
|
28 |
+
import torch
|
29 |
+
|
30 |
+
# Load the model
|
31 |
+
model_path = "path/to/skin_model2.pth"
|
32 |
+
model = torch.load(model_path, map_location=torch.device('cpu'))
|
33 |
+
model.eval()
|
34 |
+
|
35 |
+
# Example usage
|
36 |
+
from PIL import Image
|
37 |
+
from torchvision import transforms
|
38 |
+
|
39 |
+
# Preprocess input image
|
40 |
+
transform = transforms.Compose([
|
41 |
+
transforms.Resize((224, 224)),
|
42 |
+
transforms.ToTensor(),
|
43 |
+
transforms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]),
|
44 |
+
])
|
45 |
+
|
46 |
+
image = Image.open("example_input.jpg")
|
47 |
+
input_tensor = transform(image).unsqueeze(0)
|
48 |
+
|
49 |
+
# Make a prediction
|
50 |
+
with torch.no_grad():
|
51 |
+
prediction = model(input_tensor)
|
52 |
+
predicted_class = prediction.argmax(dim=1).item()
|
53 |
+
print(f"Predicted Class: {predicted_class}")
|
54 |
+
```
|
55 |
+
|
56 |
+
### Using directly from hugging face
|
57 |
+
|
58 |
+
pip install huggingface_hub
|
59 |
+
from huggingface_hub import hf_hub_download
|
60 |
+
import torch
|
61 |
+
|
62 |
+
# Download the model from Hugging Face Hub
|
63 |
+
model_path = hf_hub_download(repo_id="<abdlh>/<ResNet34_finetuned_for_skin_diseases_by-abdlh>", filename="skin_model2.pth")
|
64 |
+
model = torch.load(model_path, map_location=torch.device('cpu'))
|
65 |
+
model.eval()
|
66 |
+
|
67 |
+
# Citation
|
68 |
+
### If you use this model in your work, please cite it as follows:
|
69 |
+
@misc{abdlh2024skindisease,
|
70 |
+
title={Skin Disease Classification Model},
|
71 |
+
author={Muhammad Abdullah },
|
72 |
+
year={2024},
|
73 |
+
url={https://huggingface.co/<abdlh>/<ResNet34_finetuned_for_skin_diseases_by-abdlh>},
|
74 |
+
}
|