Views
No views yet
| File | Size | Description |
|---|---|---|
ijepa_best.pth | ~353 MB | I-JEPA encoder (ViT-Small/16), state dict key context_encoder |
probe_best.pth | ~15 KB | Linear probe head, state dict key probe |
| Metric | Value |
|---|---|
| Accuracy | 0.8914 |
| AUC-ROC | 0.9582 |
| Precision | 0.9195 |
| Recall | 0.8560 |
| F1-score | 0.8866 |
| Specificity | 0.9262 |
timm vit_small_patch16_224), 384-dim embeddings, 196 patches.1import timm, torch
2import torch.nn as nn
3from huggingface_hub import hf_hub_download
4
5REPO = "zainabFarih/lung-ct-nodule-ijepa-vit-small"
6device = "cuda" if torch.cuda.is_available() else "cpu"
7
8encoder = timm.create_model("vit_small_patch16_224", pretrained=False,
9 num_classes=0, global_pool="")
10enc_ckpt = torch.load(hf_hub_download(REPO, "ijepa_best.pth"), map_location=device)
11encoder.load_state_dict(enc_ckpt["context_encoder"])
12
13class LinearProbe(nn.Module):
14 def __init__(self, dim=384, n=2, p=0.1):
15 super().__init__()
16 self.dropout = nn.Dropout(p)
17 self.fc = nn.Linear(dim, n)
18 def forward(self, cls):
19 return self.fc(self.dropout(cls))
20
21probe = LinearProbe()
22probe_ckpt = torch.load(hf_hub_download(REPO, "probe_best.pth"), map_location=device)
23probe.load_state_dict(probe_ckpt["probe"])
24
25encoder.eval(); probe.eval()
26# logits = probe(encoder(x)[:, 0, :]) # x: (B, 3, 224, 224) normalised