Model Card for rope_deit3_reg4_m14_arabian-peninsula
A RoPE DeiT3 reg4 image classification model. This model was trained on the arabian-peninsula
dataset (all the relevant bird species found in the Arabian peninsula inc. rarities).
The species list is derived from data available at https://avibase.bsc-eoc.org/checklist.jsp?region=ARA.
Model Details
Model Type: Image classification and detection backbone
Model Stats:
- Params (M): 38.7
- Input image size: 252 x 252
Dataset: arabian-peninsula (735 classes)
Papers:
- DeiT III: Revenge of the ViT: https://arxiv.org/abs/2204.07118
- Rotary Position Embedding for Vision Transformer: https://arxiv.org/abs/2403.13298
Model Usage
Image Classification
import birder
from birder.inference.classification import infer_image
(net, model_info) = birder.load_pretrained_model("rope_deit3_reg4_m14_arabian-peninsula", 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, must be loaded in RGB format
(out, _) = infer_image(net, image, transform)
# out is a NumPy array with shape of (1, 735), representing class probabilities.
Image Embeddings
import birder
from birder.inference.classification import infer_image
(net, model_info) = birder.load_pretrained_model("rope_deit3_reg4_m14_arabian-peninsula", 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
from PIL import Image
import birder
(net, model_info) = birder.load_pretrained_model("rope_deit3_reg4_m14_arabian-peninsula", 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, 18, 18]))]
Citation
@misc{touvron2022deitiiirevengevit,
title={DeiT III: Revenge of the ViT},
author={Hugo Touvron and Matthieu Cord and Hervé Jégou},
year={2022},
eprint={2204.07118},
archivePrefix={arXiv},
primaryClass={cs.CV},
url={https://arxiv.org/abs/2204.07118},
}
@misc{heo2024rotarypositionembeddingvision,
title={Rotary Position Embedding for Vision Transformer},
author={Byeongho Heo and Song Park and Dongyoon Han and Sangdoo Yun},
year={2024},
eprint={2403.13298},
archivePrefix={arXiv},
primaryClass={cs.CV},
url={https://arxiv.org/abs/2403.13298},
}
- Downloads last month
- 36
Inference Providers
NEW
This model isn't deployed by any Inference Provider.
🙋
Ask for provider support
HF Inference deployability: The HF Inference API does not support image-classification models for birder
library.