Conn-Cerberus commited on
Commit
52f527e
Β·
verified Β·
1 Parent(s): 523ba70

Model card made

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