Views
No views yet
⚠️ Research Use Only (RUO) — this is not a certified medical device and must not be used for clinical diagnosis.
| File | Training data | Role | Headline metric |
|---|---|---|---|
models/best_model_epoch50_auc0.9980.pth | ~95 % of labels, 50 epochs | v1 — deployed in the demo | Validation AUC 0.9983 (TTA ×5) |
models/final_model_v2_locked.pth | 70 % train, early-stopped on val | v2 — rigorous evaluation | Locked-test AUC 0.9979 (TTA ×5) |
| Metric | 5-fold CV (mean ± σ) | Locked test (TTA ×5) |
|---|---|---|
| AUC-ROC | 0.9975 ± 0.0001 | 0.9979 |
| Accuracy | 0.9821 ± 0.0008 | 0.9847 |
| F1-score | 0.9778 ± 0.0010 | 0.9810 |
| Brier Score | 0.0212 ± 0.0005 | 0.0172 |
| Sensitivity | 0.9753 ± 0.0015 | 0.9794 |
| Specificity | 0.9867 ± 0.0006 | 0.9882 |
results_v2/.timm convnext_tiny (ImageNet-pretrained, num_classes=0, drop_rate=0.3) → 768-d features.Linear(768→256) → BN → GELU → Dropout → Linear(256→256) → BN → (+ shortcut) → GELU → Dropout → Linear(256→1).[0.485, 0.456, 0.406], std [0.229, 0.224, 0.225]).1import torch, timm
2import torch.nn as nn
3from huggingface_hub import hf_hub_download
4
5class ResidualHead(nn.Module):
6 def __init__(self, in_features, hidden=256, dropout=0.3):
7 super().__init__()
8 self.fc1, self.bn1 = nn.Linear(in_features, hidden), nn.BatchNorm1d(hidden)
9 self.fc2, self.bn2 = nn.Linear(hidden, hidden), nn.BatchNorm1d(hidden)
10 self.fc_out, self.shortcut = nn.Linear(hidden, 1), nn.Linear(in_features, hidden)
11 self.gelu, self.dropout = nn.GELU(), nn.Dropout(dropout)
12 def forward(self, x):
13 identity = self.shortcut(x)
14 out = self.dropout(self.gelu(self.bn1(self.fc1(x))))
15 out = self.gelu(self.bn2(self.fc2(out)) + identity)
16 return self.fc_out(self.dropout(out))
17
18class CancerClassifier(nn.Module):
19 def __init__(self):
20 super().__init__()
21 self.backbone = timm.create_model("convnext_tiny", pretrained=False, num_classes=0)
22 self.head = ResidualHead(self.backbone.num_features)
23 def forward(self, x):
24 return self.head(self.backbone(x))
25
26model = CancerClassifier()
27
28# v2 (rigorous) — raw state_dict:
29path = hf_hub_download("hakim78/Cancer_pathos", "models/final_model_v2_locked.pth")
30model.load_state_dict(torch.load(path, map_location="cpu"))
31
32# v1 (deployed) — checkpoint dict:
33# path = hf_hub_download("hakim78/Cancer_pathos", "models/best_model_epoch50_auc0.9980.pth")
34# model.load_state_dict(torch.load(path, map_location="cpu")["model_state_dict"])
35
36model.eval()torch.sigmoid(model(x)) (probability of cancer; threshold 0.5). For best results, average over 5 TTA views (original + H/V flip + 90° rotation + transpose).