Conn Finnegan commited on
Commit
a52a914
Β·
verified Β·
1 Parent(s): 0ef1b79

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +106 -2
README.md CHANGED
@@ -9,7 +9,111 @@ app_file: app.py
9
  pinned: false
10
  license: gpl-3.0
11
  short_description: Soma is a new skin cancer classifier with 89% accuracy
12
- thumbnail: thumbnail.png
 
13
  ---
14
 
15
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
  pinned: false
10
  license: gpl-3.0
11
  short_description: Soma is a new skin cancer classifier with 89% accuracy
12
+ thumbnail: >-
13
+ https://cdn-uploads.huggingface.co/production/uploads/681237b37adf54f53dd71ab2/yCGXoArznwcMOto8jyCoe.png
14
  ---
15
 
16
+
17
+ # 🧠 Model Card for Skin Cancer ResNet18 Classifier
18
+
19
+ 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.
20
+
21
+ ## 🧬 Model Details
22
+
23
+ ### πŸ“ Model Description
24
+
25
+ - **πŸ‘¨β€πŸ’» Developed by:** Conn Finnegan
26
+ - **🧠 Model type:** Image classifier (ResNet18)
27
+ - **πŸ”§ Finetuned from model:** `torchvision.models.resnet18(pretrained=True)`
28
+ - **πŸ–ΌοΈ Input shape:** RGB image (3 x 224 x 224)
29
+ - **🏷️ Output classes:**
30
+ - Class 0: Benign
31
+ - Class 1: Malignant
32
+
33
+ ### πŸ“¦ Model Sources
34
+
35
+ - **πŸ“ Repository:** [https://huggingface.co/connfinnegan/skin-cancer-resnet18](https://huggingface.co/connfinnegan/skin-cancer-resnet18)
36
+ - **πŸ§ͺ Demo:** Coming soon via Hugging Face Spaces
37
+
38
+ ## πŸš€ Uses
39
+
40
+ ### 🎯 Direct Use
41
+
42
+ Used for inference on dermoscopic mole/lesion images to estimate if a lesion is likely benign or malignant.
43
+
44
+ ### 🚫 Out-of-Scope Use
45
+
46
+ - Not intended as a diagnostic medical tool.
47
+ - Not trained on diverse skin tones or photographic image types.
48
+
49
+ ## ⚠️ Bias, Risks, and Limitations
50
+
51
+ - Model trained on dermoscopic images from the HAM10000 dataset, which is not representative of all skin types or lesion types.
52
+ - False negatives (missed malignancies) could be harmful.
53
+ - False positives may cause unnecessary concern.
54
+
55
+ ### βœ… Recommendations
56
+
57
+ - Always consult a healthcare professional. This model is a research prototype only.
58
+
59
+ ## πŸ§ͺ How to Get Started with the Model
60
+
61
+ ```python
62
+ import torch
63
+ from torchvision import models, transforms
64
+ from PIL import Image
65
+
66
+ model = models.resnet18()
67
+ model.fc = torch.nn.Linear(model.fc.in_features, 2)
68
+ model.load_state_dict(torch.load("skin_cancer_resnet18_v1.pt", map_location='cpu'))
69
+ model.eval()
70
+
71
+ transform = transforms.Compose([
72
+ transforms.Resize((224, 224)),
73
+ transforms.ToTensor()
74
+ ])
75
+
76
+ img = Image.open("your_image.jpg").convert("RGB")
77
+ input_tensor = transform(img).unsqueeze(0)
78
+
79
+ with torch.no_grad():
80
+ output = model(input_tensor)
81
+ pred = torch.argmax(output, dim=1).item()
82
+ print("Prediction:", "benign" if pred == 0 else "malignant")
83
+ ```
84
+
85
+ ## πŸ‹οΈ Training Details
86
+
87
+ ### πŸ—‚οΈ Training Data
88
+
89
+ - Dataset: HAM10000 (Kaggle)
90
+ - Malignant classes grouped: melanoma, bcc, akiec
91
+ - Benign classes grouped: nv, bkl, df, vasc
92
+
93
+ ### βš™οΈ Training Procedure
94
+
95
+ - πŸ“ Input resolution: 224x224
96
+ - 🧠 Optimiser: Adam
97
+ - πŸ“‰ Loss function: Weighted Cross Entropy
98
+ - πŸ” Epochs: 50 with early stopping
99
+ - βš–οΈ Class weights: applied (malignant overweighted \~3.5x)
100
+ - 🧱 Framework: PyTorch 2.0.0
101
+
102
+ ## πŸ“ˆ Evaluation
103
+
104
+ - βœ… Accuracy: \~89%
105
+ - πŸ“Š Malignant recall: \~78%
106
+ - 🎯 Benign precision: >90%
107
+
108
+ ## 🧰 Technical Specifications
109
+
110
+ - **πŸ—οΈ Architecture:** ResNet18 (modified last FC layer)
111
+ - **πŸ§ͺ Framework:** PyTorch + Torchvision
112
+ - **🐍 Python version:** 3.10
113
+ - **πŸ“¦ Dependencies:** torchvision, torch, PIL, numpy
114
+
115
+ ## πŸ“¬ Model Card Contact
116
+
117
+ - **πŸ‘€ Author:** Conn Finnegan
118
+ - **πŸ”— LinkedIn: https://www.linkedin.com/in/conn-finnegan-09a98124b/**
119
+ - **πŸ”— GitHub: https://github.com/Conn-Finnegan**