TimJaspersTue commited on
Commit
57a8a81
·
verified ·
1 Parent(s): 3c22ce6

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +77 -3
README.md CHANGED
@@ -1,3 +1,77 @@
1
- ---
2
- license: cc-by-nc-4.0
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: cc-by-nc-4.0
3
+ ---
4
+
5
+ # GastroNet-5M — ViT-B pretrained weights
6
+
7
+ This repository contains a Vision Transformer (ViT-Base) model that was used in the study:
8
+
9
+ **GastroNet-5M: A Multicenter Dataset for Developing Foundation Models in Gastrointestinal Endoscopy**
10
+ *Gastroenterology (2025)*
11
+ DOI: 10.1053/j.gastro.2025.07.030
12
+ https://www.sciencedirect.com/science/article/pii/S001650852505797X
13
+
14
+ The model was pretrained on the **GastroNet‑5M** dataset using dinov2.
15
+ Please **cite the paper** when using this model, the dataset, or the pretrained weights.
16
+
17
+ ---
18
+
19
+ ## 🧠 Weights
20
+
21
+ The pretrained model weights are hosted externally and can be downloaded here:
22
+
23
+ ➡️ **https://staging.cortex.thetavision.nl/dataset-provider/listing/2/**
24
+
25
+ Download the file (e.g., `vit_b_gastronet5m.pth`) and place it locally or on your server.
26
+
27
+ ---
28
+
29
+ ## 🚀 Usage (PyTorch + timm)
30
+
31
+ ```python
32
+ # pip install timm
33
+ import torch
34
+ import timm
35
+
36
+ # Initialize ViT‑B backbone (no classifier head)
37
+ model = timm.create_model("vit_base_patch16_224", pretrained=False, num_classes=0)
38
+
39
+ # Update this path to where you downloaded the checkpoint
40
+ ckpt_path = "./weights/vit_b_gastronet5m.pth"
41
+ state = torch.load(ckpt_path, map_location="cpu")
42
+
43
+ # Handle state dict variations
44
+ if "model" in state:
45
+ state_dict = state["model"]
46
+ elif "state_dict" in state:
47
+ state_dict = state["state_dict"]
48
+ else:
49
+ state_dict = state
50
+
51
+ # Remove 'module.' prefix if present
52
+ clean_state = {k.replace("module.", ""): v for k, v in state_dict.items()}
53
+ model.load_state_dict(clean_state, strict=False)
54
+
55
+ model.eval()
56
+ ```
57
+
58
+ ---
59
+
60
+ ## 📄 Citation
61
+
62
+ If you use this model, please cite the study:
63
+
64
+ **Plain citation**
65
+ > Jong MR, Boers TGW, Fockens KN, Jukema JB, Kusters CHJ, Jaspers TJM, van Eijck van Heslinga RAH, Slooter FC, Struyvenberg MR, Bisschops R, van der Putten JA, de With PHN, van der Sommen F, de Groof AJ, Bergman JJGHM; BONS-AI Consortium.
66
+ > *GastroNet‑5M: A Multicenter Dataset for Developing Foundation Models in Gastrointestinal Endoscopy.* Gastroenterology. 2025. DOI:10.1053/j.gastro.2025.07.030.
67
+
68
+ **BibTeX**
69
+ ```bibtex
70
+ @article{Jong2025GastroNet5M,
71
+ author = {Jong, Martijn R and Boers, Tim G. W. and Fockens, Kiki N and Jukema, Jelmer B and Kusters, Carolus H. J and Jaspers, Tim J. M and van Eijck van Heslinga, Rixta A. H and Slooter, Floor C and Struyvenberg, Maarten R and Bisschops, Raf and van der Putten, Joost A and de With, Peter H. N and van der Sommen, Fons and de Groof, Albert J and Bergman, Jacques J. G. H. M. and Barrett's Oesophagus Imaging for Artificial Intelligence (BONS-AI) Consortium},
72
+ title = {GastroNet-5M: A Multicenter Dataset for Developing Foundation Models in Gastrointestinal Endoscopy},
73
+ journal = {Gastroenterology},
74
+ year = {2025},
75
+ doi = {10.1053/j.gastro.2025.07.030}
76
+ }
77
+ ```