--- title: DeepDerma emoji: ๐Ÿงด colorFrom: blue colorTo: pink sdk: gradio sdk_version: 5.38.0 app_file: app.py pinned: true short_description: Detect skin cancer early with powerful AI --- # ๐Ÿฉบ DeepDerma: Skin Lesion Classification App Welcome to **DeepDerma**, a simple yet powerful AI tool that helps identify **7 common skin lesions (abnormal injury or disease)** from clinical dermatoscopic images. Upload a skin image, and DeepDerma will predict the most likely diagnosis โ€” assisting in early detection and educational awareness. --- ## ๐Ÿ” How It Works Just upload a skin lesion image, and our AI model will: - Preprocess the image - Classify it into one of 7 dermatological categories - Return the top predicted class with confidence scores The model is built using **EfficientNet-B2** and trained on the **DermMNIST** dataset from MedMNIST. --- ## ๐Ÿงช Performance Summary | Metric | Value | |--------------|-----------| | Test Accuracy | 73.3% | | AUC Score | 0.91 | | Top Class F1 | 0.86 (Nevus - NV) | | Minority Class F1 | 0.53 | ## Competitiveness > our results outperforms benchmarks such as ResNet-18, ResNet-50 in terms of accuracy and is competitive in AUC scores Despite class imbalance, the model performs well on high-priority categories like melanoma (MEL) and nevi (NV) thanks to AUC-based training. --- ## ๐Ÿง  Model Details - **Architecture**: [EfficientNet-B2](https://arxiv.org/abs/1905.11946) - **Fine-tuned** on: DermMNIST (medmnist v2) - **Input size**: 224 ร— 224 - **Optimizer**: Adam, LR = 1e-4 - **Scheduler**: ReduceLROnPlateau - **Augmentations**: Random flip, rotation, color jitter - **Class balancing**: Weighted loss + WeightedRandomSampler - **Metric used**: AUC (Area Under ROC Curve) for better performance on imbalanced classes --- ## ๐Ÿ“Š Dataset: DermMNIST - **Source**: [MedMNIST v2](https://medmnist.com/) - **Images**: 10,015 dermatoscopic RGB images (28ร—28, resized to 224ร—224) - **Classes**: 7 types of skin lesions - **Split**: - Train: 7,007 images - Val: 1,003 images - Test: 2,005 images --- ## ๐Ÿงฌ Target Classes (With Description) | Label | Name (Short) | Description | |-------|--------------|-------------| | 0 | **AKIEC** | Actinic keratoses / Intraepithelial carcinoma โ€“ pre-cancerous skin lesions | | 1 | **BCC** | Basal Cell Carcinoma โ€“ common and locally invasive skin cancer | | 2 | **BKL** | Benign Keratosis-like lesions โ€“ non-cancerous growths (seborrheic, solar, etc.) | | 3 | **DF** | Dermatofibroma โ€“ benign skin nodules caused by overgrowth of fibrous tissue | | 4 | **MEL** | Melanoma โ€“ the most dangerous type of skin cancer; early detection critical | | 5 | **NV** | Melanocytic Nevi โ€“ common moles, typically benign | | 6 | **VASC** | Vascular Lesions โ€“ angiomas, hemorrhages, and similar blood vessel-related growths | --- ## ๐Ÿš€ How to Run This Space runs using **Gradio**. No setup needed โ€” just: 1. Click the upload button 2. Select or drag an image 3. View the predicted class and probabilities --- ## ๐Ÿงพ Files Included - `app.py` โ€” Gradio interface - `model.py` โ€” Model architecture and prediction pipeline - `requirements.txt` โ€” Dependencies - `fine_tuned_effnetb2_dermamnist.pth` โ€” Trained model weights ---