Downloads · 30 days
15
3% of all-time downloads
Arko007/skin-disease-detector-ai
skin-disease-detector-ai is a image classification model from Arko007. Use it when you need a label for an image. It is set up for keras. The card lists the license as apache-2.0.
This repository contains a custom, high-performance EfficientNet-style model for the classification of 8 common skin conditions. This model was built from scratch and trained on a massively augmented dataset of over 3…
Downloads · 30 days
15
3% of all-time downloads
All-time downloads
466
Public
Repo size
2.6 GB
Likes
2
Public
Click a slice to open those files.
.keras2.6 GB · 100%
From the Hugging Face model README
This repository contains a custom, high-performance EfficientNet-style model for the classification of 8 common skin conditions. This model was built from scratch and trained on a massively augmented dataset of over 33,000 images using an NVIDIA A100 80GB GPU.
The model is a deep convolutional neural network based on the principles of EfficientNet (MBConv blocks, Squeeze-and-Excitation, compound scaling) but with a custom, up-scaled architecture designed for this specific task. It has been scaled to ~150 million parameters to effectively learn from a large-scale, high-resolution medical imaging dataset.
512x512x3The model is trained to classify the following 8 conditions:
(Note: The 'Melanoma' class from the original dataset was not present in the processed data and is therefore not included in this version.)
This model achieved the following state-of-the-art performance on the validation set:
88.96%97.89%[Add your final Validation Loss here]You can easily load and use this model for inference using TensorFlow/Keras and the huggingface_hub library.
First, install the necessary libraries:
pip install tensorflow huggingface_hub
import tensorflow as tf
from huggingface_hub import from_pretrained_keras
import numpy as np
from PIL import Image
# Load the model from your Hugging Face Hub repo
model = from_pretrained_keras("Arko007/skin-disease-detector-ai")
print("Model loaded successfully!")
# Define the class names in the correct order
CLASS_NAMES = [
'Acitinic Keratosis', 'Basal Cell Carcinoma', 'Dermatofibroma', 'Nevus',
'Pigmented Benign Keratosis', 'Seborrheic Keratosis',
'Squamous Cell Carcinoma', 'Vascular Lesion'
]
def preprocess_image(image_path, img_size=512):
"""Loads and preprocesses an image for the model."""
img = Image.open(image_path).convert('RGB')
img = img.resize((img_size, img_size))
img_array = np.array(img)
img_array = np.expand_dims(img_array, axis=0)
img_array = tf.cast(img_array, tf.float32) / 255.0
return img_array
def predict(image_path):
"""Runs inference on a single image."""
processed_image = preprocess_image(image_path)
predictions = model.predict(processed_image)
predicted_class_index = np.argmax(predictions, axis=1)[0]
predicted_class_name = CLASS_NAMES[predicted_class_index]
confidence = np.max(predictions, axis=1)[0]
print(f"Predicted Class: {predicted_class_name}")
print(f"Confidence: {confidence:.2%}")
return predicted_class_name, confidence
# Example usage:
# predict("path/to/your/skin_image.jpg")
## Training Data
The model was trained on the "Multiple Skin Disease Detection and Classification" dataset. The original dataset of ~3,300 images was augmented 10x using the `imgaug` library to create a final training set of over 33,000 images, which helped in achieving high generalization performance.
## Author
This model was built by Arko.