|
--- |
|
license: apache-2.0 |
|
language: |
|
- en |
|
pipeline_tag: image-classification |
|
--- |
|
# Skin Disease Classification Model |
|
|
|
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. |
|
|
|
## Model Overview |
|
|
|
- **Model Architecture**: [ResNet34] |
|
- **Framework**: PyTorch |
|
- **Input**: RGB image of size [224x224]. |
|
- **Output**: Predicted label for skin disease. |
|
- **Training Dataset**: [Dermnet]. |
|
|
|
--- |
|
|
|
## Usage Instructions |
|
|
|
### Loading the Model |
|
|
|
You can load this model using the `torch` library in Python: |
|
|
|
```python |
|
import torch |
|
|
|
# Load the model |
|
model_path = "path/to/skin_model2.pth" |
|
model = torch.load(model_path, map_location=torch.device('cpu')) |
|
model.eval() |
|
|
|
# Example usage |
|
from PIL import Image |
|
from torchvision import transforms |
|
|
|
# Preprocess input image |
|
transform = transforms.Compose([ |
|
transforms.Resize((224, 224)), |
|
transforms.ToTensor(), |
|
transforms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]), |
|
]) |
|
|
|
image = Image.open("example_input.jpg") |
|
input_tensor = transform(image).unsqueeze(0) |
|
|
|
# Make a prediction |
|
with torch.no_grad(): |
|
prediction = model(input_tensor) |
|
predicted_class = prediction.argmax(dim=1).item() |
|
print(f"Predicted Class: {predicted_class}") |
|
``` |
|
|
|
### Using directly from hugging face |
|
|
|
pip install huggingface_hub |
|
from huggingface_hub import hf_hub_download |
|
import torch |
|
|
|
# Download the model from Hugging Face Hub |
|
model_path = hf_hub_download(repo_id="<abdlh>/<ResNet34_finetuned_for_skin_diseases_by-abdlh>", filename="skin_model2.pth") |
|
model = torch.load(model_path, map_location=torch.device('cpu')) |
|
model.eval() |
|
|
|
# Citation |
|
### If you use this model in your work, please cite it as follows: |
|
@misc{abdlh2024skindisease, |
|
title={Skin Disease Classification Model}, |
|
author={Muhammad Abdullah }, |
|
year={2024}, |
|
url={https://huggingface.co/<abdlh>/<ResNet34_finetuned_for_skin_diseases_by-abdlh>}, |
|
} |