CoolFace
Modelpublic

birder-project/vit_reg4_m16_rms_avg_i-jepa

sourceHugging Faceapache-2.0updated 8mo agoView on Hugging Face
0likes11downloads
Model Card

Model Card for vitreg4m16rmsavg_i-jepa

A ViT m16 RMS norm image encoder pre-trained using I-JEPA. This model has not been fine-tuned for a specific classification task and is intended to be used as a general-purpose feature extractor or a backbone for downstream tasks like object detection, segmentation, or custom classification.

Model Details

  • —Model Type: Image classification and detection backbone
  • —Model Stats:
  • —Params (M): 38.3
  • —Input image size: 224 x 224
  • —Dataset: Trained on a diverse dataset of approximately 13.5M images (12M before sampling), including:
  • —iNaturalist 2021 (~2.6M) x1
  • —imagenet-1k-webp (~1.3M) x2
  • —COCO (~120K) x2
  • —VOC 2012 (~17K) x2
  • —CUB-200 2011 (~6K) x4
  • —The Birder dataset (~8M, private dataset) x1
  • —Papers:
  • —An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale: <https://arxiv.org/abs/2010.11929>
  • —Vision Transformers Need Registers: <https://arxiv.org/abs/2309.16588>
  • —Self-Supervised Learning from Images with a Joint-Embedding Predictive Architecture: <https://arxiv.org/abs/2301.08243>

Model Usage

Image Embeddings

python
import birder
from birder.inference.classification import infer_image

(net, model_info) = birder.load_pretrained_model("vit_reg4_m16_rms_avg_i-jepa", inference=True)

# Get the image size the model was trained on
size = birder.get_size_from_signature(model_info.signature)

# Create an inference transform
transform = birder.classification_transform(size, model_info.rgb_stats)

image = "path/to/image.jpeg"  # or a PIL image
(out, embedding) = infer_image(net, image, transform, return_embedding=True)
# embedding is a NumPy array with shape of (1, 512)

Detection Feature Map

python
from PIL import Image
import birder

(net, model_info) = birder.load_pretrained_model("vit_reg4_m16_rms_avg_i-jepa", inference=True)

# Get the image size the model was trained on
size = birder.get_size_from_signature(model_info.signature)

# Create an inference transform
transform = birder.classification_transform(size, model_info.rgb_stats)

image = Image.open("path/to/image.jpeg")
features = net.detection_features(transform(image).unsqueeze(0))
# features is a dict (stage name -> torch.Tensor)
print([(k, v.size()) for k, v in features.items()])
# Output example:
# [('neck', torch.Size([1, 512, 14, 14]))]

Citation

bibtex
@misc{dosovitskiy2021imageworth16x16words,
      title={An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale}, 
      author={Alexey Dosovitskiy and Lucas Beyer and Alexander Kolesnikov and Dirk Weissenborn and Xiaohua Zhai and Thomas Unterthiner and Mostafa Dehghani and Matthias Minderer and Georg Heigold and Sylvain Gelly and Jakob Uszkoreit and Neil Houlsby},
      year={2021},
      eprint={2010.11929},
      archivePrefix={arXiv},
      primaryClass={cs.CV},
      url={https://arxiv.org/abs/2010.11929}, 
}

@misc{darcet2024visiontransformersneedregisters,
      title={Vision Transformers Need Registers}, 
      author={Timothée Darcet and Maxime Oquab and Julien Mairal and Piotr Bojanowski},
      year={2024},
      eprint={2309.16588},
      archivePrefix={arXiv},
      primaryClass={cs.CV},
      url={https://arxiv.org/abs/2309.16588}, 
}

@misc{assran2023selfsupervisedlearningimagesjointembedding,
      title={Self-Supervised Learning from Images with a Joint-Embedding Predictive Architecture},
      author={Mahmoud Assran and Quentin Duval and Ishan Misra and Piotr Bojanowski and Pascal Vincent and Michael Rabbat and Yann LeCun and Nicolas Ballas},
      year={2023},
      eprint={2301.08243},
      archivePrefix={arXiv},
      primaryClass={cs.CV},
      url={https://arxiv.org/abs/2301.08243},
}