🧠 Model Card for Skin Cancer ResNet18 Classifier

This is a binary skin lesion classifier based on ResNet-18. It was trained to distinguish between benign and malignant dermoscopic images using the HAM10000 dataset. The model is part of a privacy-focused research project for on-device melanoma risk screening.

🧬 Model Details

πŸ“ Model Description

  • πŸ‘¨β€πŸ’» Developed by: Conn Finnegan
  • 🧠 Model type: Image classifier (ResNet18)
  • πŸ”§ Finetuned from model: torchvision.models.resnet18(pretrained=True)
  • πŸ–ΌοΈ Input shape: RGB image (3 x 224 x 224)
  • 🏷️ Output classes:
    • Class 0: Benign
    • Class 1: Malignant

πŸ“¦ Model Sources

πŸš€ Uses

🎯 Direct Use

Used for inference on dermoscopic mole/lesion images to estimate if a lesion is likely benign or malignant.

🚫 Out-of-Scope Use

  • Not intended as a diagnostic medical tool.
  • Not trained on diverse skin tones or photographic image types.

⚠️ Bias, Risks, and Limitations

  • Model trained on dermoscopic images from the HAM10000 dataset, which is not representative of all skin types or lesion types.
  • False negatives (missed malignancies) could be harmful.
  • False positives may cause unnecessary concern.

βœ… Recommendations

  • Always consult a healthcare professional. This model is a research prototype only.

πŸ§ͺ How to Get Started with the Model

import torch
from torchvision import models, transforms
from PIL import Image

model = models.resnet18()
model.fc = torch.nn.Linear(model.fc.in_features, 2)
model.load_state_dict(torch.load("skin_cancer_resnet18_v1.pt", map_location='cpu'))
model.eval()

transform = transforms.Compose([
    transforms.Resize((224, 224)),
    transforms.ToTensor()
])

img = Image.open("your_image.jpg").convert("RGB")
input_tensor = transform(img).unsqueeze(0)

with torch.no_grad():
    output = model(input_tensor)
    pred = torch.argmax(output, dim=1).item()
    print("Prediction:", "benign" if pred == 0 else "malignant")

πŸ‹οΈ Training Details

πŸ—‚οΈ Training Data

  • Dataset: HAM10000 (Kaggle)
  • Malignant classes grouped: melanoma, bcc, akiec
  • Benign classes grouped: nv, bkl, df, vasc

βš™οΈ Training Procedure

  • πŸ“ Input resolution: 224x224
  • 🧠 Optimiser: Adam
  • πŸ“‰ Loss function: Weighted Cross Entropy
  • πŸ” Epochs: 50 with early stopping
  • βš–οΈ Class weights: applied (malignant overweighted ~3.5x)
  • 🧱 Framework: PyTorch 2.0.0

πŸ“ˆ Evaluation

  • βœ… Accuracy: ~89%
  • πŸ“Š Malignant recall: ~78%
  • 🎯 Benign precision: >90%

🧰 Technical Specifications

  • πŸ—οΈ Architecture: ResNet18 (modified last FC layer)
  • πŸ§ͺ Framework: PyTorch + Torchvision
  • 🐍 Python version: 3.10
  • πŸ“¦ Dependencies: torchvision, torch, PIL, numpy

πŸ“¬ Model Card Contact

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support