--- license: cc-by-nc-4.0 --- # GastroNet-5M — ViT-B pretrained weights This repository contains a Vision Transformer (ViT-Base) model that was used in the study: **GastroNet-5M: A Multicenter Dataset for Developing Foundation Models in Gastrointestinal Endoscopy** *Gastroenterology (2025)* DOI: 10.1053/j.gastro.2025.07.030 https://www.sciencedirect.com/science/article/pii/S001650852505797X The model was pretrained on the **GastroNet‑5M** dataset using dinov2. Please **cite the paper** when using this model, the dataset, or the pretrained weights. --- ## 🧠 Weights The pretrained model weights are hosted externally and can be downloaded here: ➡️ **https://staging.cortex.thetavision.nl/dataset-provider/listing/2/** Download the file (e.g., `dinov2.pth`) and place it locally or on your device. --- ## 🚀 Usage (PyTorch + timm) ```python # pip install timm import torch import timm # Initialize ViT‑B backbone (no classifier head) model = timm.create_model("timm/vit_base_patch14_dinov2.lvd142m", pretrained=False, num_classes=0, img_size=336, ) # Update this path to where you downloaded the checkpoint ckpt_path = "dinov2.pth" state = torch.load(ckpt_path, map_location="cpu") state_dict = state['teacher'] # Remove 'module.' prefix if present clean_state = {k.replace("backbone.", ""): v for k, v in state_dict.items()} msg = model.load_state_dict(clean_state, strict=False) print(msg) model.eval() ``` --- ## 📄 Citation If you use this model, please cite the study: **Plain citation** > 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. > *GastroNet‑5M: A Multicenter Dataset for Developing Foundation Models in Gastrointestinal Endoscopy.* Gastroenterology. 2025. DOI:10.1053/j.gastro.2025.07.030. **BibTeX** ```bibtex @article{Jong2025GastroNet5M, 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}, title = {GastroNet-5M: A Multicenter Dataset for Developing Foundation Models in Gastrointestinal Endoscopy}, journal = {Gastroenterology}, year = {2025}, doi = {10.1053/j.gastro.2025.07.030} } ```