Downloads · 30 days
0
kindai-derma-ai/skin-lesion-ensemble
skin-lesion-ensemble is a image classification model from kindai-derma-ai. Use it when you need a label for an image. It is set up for timm. The card lists the license as cc-by-nc-4.0.
8クラス皮膚病変分類のための7モデルアンサンブルシステム Test Accuracy: 95.92%
Downloads · 30 days
0
Access
Public
Updated Jul 16, 2026
Repo size
6.9 GB
Likes
0
Public
Click a slice to open those files.
.pth12.7 GB · 100%
From the Hugging Face model README
8クラス皮膚病変分類のための7モデルアンサンブルシステム Test Accuracy: 95.92%
35個のディープラーニングモデル(7種類 × 5-fold CV)を組み合わせた高精度な皮膚病変診断支援システムです。
| Class | Japanese | English |
|---|---|---|
| ADM | 後天性真皮メラノサイトーシス | Acquired Dermal Melanocytosis |
| BCC | 基底細胞癌 | Basal Cell Carcinoma |
| Ephelis | 雀卵斑 | Freckles |
| Melanoma | 悪性黒色腫 | Malignant Melanoma |
| Melasma | 肝斑 | Melasma |
| Nevus | 色素性母斑 | Melanocytic Nevus |
| SK | 脂漏性角化症 | Seborrheic Keratosis |
| Solar Lentigo | 日光黒子 | Solar Lentigo |
このリポジトリには2つのモデル構成が含まれています:
| Configuration | Models | Folder | Use Case |
|---|---|---|---|
| Base Models | 20 models | base_models/ | シンプルなアンサンブル、軽量版 |
| Full Ensemble | 35 models | Root folders | 最高精度、バイナリ精緻化あり |
base_models/
├── efficientnet_b4_ham10k/ # EfficientNet-B4 × 5
├── efficientnet_b7_imagenet/ # EfficientNet-B7 × 5
└── transformers/ # ViT × 5, Swin × 5
├── efficientnet_b4_ham10k/ # EfficientNet-B4 × 5
├── efficientnet_b7_imagenet/ # EfficientNet-B7 × 5
├── transformers/ # ViT × 5, Swin × 5
└── binary_classifiers/ # Binary classifiers × 15
| Metric | Value |
|---|---|
| Test Accuracy | 95.92% |
| Macro Precision | 96.09% |
| Macro Recall | 95.56% |
| Macro F1-Score | 95.77% |
| Melanoma Sensitivity | 100% |
| Melanoma Specificity | 100% |
| Class | Precision | Recall | F1-Score |
|---|---|---|---|
| ADM | 96.30% | 96.30% | 96.30% |
| Basal Cell Carcinoma | 87.50% | 91.30% | 89.36% |
| Ephelis | 100.00% | 94.44% | 97.14% |
| Malignant Melanoma | 95.24% | 100.00% | 97.56% |
| Melasma | 97.14% | 100.00% | 98.55% |
| Nevus | 100.00% | 94.44% | 97.14% |
| Seborrheic Keratosis | 95.65% | 88.00% | 91.67% |
| Solar Lentigo | 96.88% | 100.00% | 98.41% |
| Model | Pre-training | Parameters | Count |
|---|---|---|---|
| EfficientNet-B4 | ImageNet → HAM10000 | ~19M | × 5 folds |
| EfficientNet-B7 | ImageNet | ~66M | × 5 folds |
| Vision Transformer (ViT) | ImageNet | ~86M | × 5 folds |
| Swin Transformer | ImageNet | ~88M | × 5 folds |
| Binary: ADM vs Nevus | - | ~19M | × 5 folds |
| Binary: Nevus vs Melanoma | - | ~19M | × 5 folds |
| Binary: Solar vs Ephelis | - | ~19M | × 5 folds |
Stage 1: Base Ensemble (20 models)
Stage 2: Binary Refinement (15 models) - Optional
pip install torch torchvision timm pillow huggingface_hub
from huggingface_hub import snapshot_download
# Option 1: Download base models only (20 models, ~5GB)
snapshot_download(
repo_id="kindai-derma-ai/skin-lesion-ensemble",
local_dir="./models",
allow_patterns="base_models/**"
)
# Option 2: Download full ensemble (35 models, ~6.4GB)
snapshot_download(
repo_id="kindai-derma-ai/skin-lesion-ensemble",
local_dir="./models",
ignore_patterns="base_models/**" # Avoid duplicates
)
# Option 3: Download everything
snapshot_download(
repo_id="kindai-derma-ai/skin-lesion-ensemble",
local_dir="./models"
)
import torch
import timm
from PIL import Image
from torchvision import transforms
# Load model (example with EfficientNet-B4)
model = timm.create_model('efficientnet_b4', pretrained=False, num_classes=8)
checkpoint = torch.load('models/base_models/efficientnet_b4_ham10k/efficientnet_b4_ham10k_fold0.pth')
model.load_state_dict(checkpoint['model_state_dict'])
model.eval()
# Preprocessing
transform = transforms.Compose([
transforms.Resize((384, 384)),
transforms.ToTensor(),
transforms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225])
])
# Predict
image = Image.open('skin_lesion.jpg').convert('RGB')
input_tensor = transform(image).unsqueeze(0)
with torch.no_grad():
output = model(input_tensor)
probabilities = torch.softmax(output, dim=1)
predicted_class = torch.argmax(probabilities, dim=1).item()
class_names = ['ADM', 'BCC', 'Ephelis', 'Melanoma', 'Melasma', 'Nevus', 'SK', 'Solar_Lentigo']
print(f"Prediction: {class_names[predicted_class]}")
print(f"Confidence: {probabilities[0][predicted_class]:.2%}")
models/
├── base_models/ # Base models only (20 models)
│ ├── efficientnet_b4_ham10k/
│ ├── efficientnet_b7_imagenet/
│ └── transformers/
│
├── efficientnet_b4_ham10k/ # Full ensemble components
├── efficientnet_b7_imagenet/
├── transformers/
└── binary_classifiers/ # Binary refinement (full ensemble only)
@misc{skin_lesion_ensemble_2024,
title={7-Model Ensemble for 8-Class Skin Lesion Classification},
author={Kindai Dermatology AI Lab},
year={2024},
howpublished={\url{https://huggingface.co/kindai-derma-ai/skin-lesion-ensemble}}
}
This model is released under CC BY-NC 4.0.
Created: December 2024 Organization: Kindai Dermatology AI Lab