Views
No views yet
iNaturalist 2021 dataset - https://github.com/visipedia/inat_comp/tree/master/2021.hieradet_d_small_dino-v2-inat21-256px.1import birder
2from birder.inference.classification import infer_image
3
4(net, model_info) = birder.load_pretrained_model("hieradet_d_small_dino-v2-inat21", inference=True)
5# Note: A 256x256 variant is available as "hieradet_d_small_dino-v2-inat21-256px"
6
7# Get the image size the model was trained on
8size = birder.get_size_from_signature(model_info.signature)
9
10# Create an inference transform
11transform = birder.classification_transform(size, model_info.rgb_stats)
12
13image = "path/to/image.jpeg" # or a PIL image, must be loaded in RGB format
14(out, _) = infer_image(net, image, transform)
15# out is a NumPy array with shape of (1, 10000), representing class probabilities.1import birder
2from birder.inference.classification import infer_image
3
4(net, model_info) = birder.load_pretrained_model("hieradet_d_small_dino-v2-inat21", inference=True)
5
6# Get the image size the model was trained on
7size = birder.get_size_from_signature(model_info.signature)
8
9# Create an inference transform
10transform = birder.classification_transform(size, model_info.rgb_stats)
11
12image = "path/to/image.jpeg" # or a PIL image
13(out, embedding) = infer_image(net, image, transform, return_embedding=True)
14# embedding is a NumPy array with shape of (1, 768)1from PIL import Image
2import birder
3
4(net, model_info) = birder.load_pretrained_model("hieradet_d_small_dino-v2-inat21", inference=True)
5
6# Get the image size the model was trained on
7size = birder.get_size_from_signature(model_info.signature)
8
9# Create an inference transform
10transform = birder.classification_transform(size, model_info.rgb_stats)
11
12image = Image.open("path/to/image.jpeg")
13features = net.detection_features(transform(image).unsqueeze(0))
14# features is a dict (stage name -> torch.Tensor)
15print([(k, v.size()) for k, v in features.items()])
16# Output example:
17# [('stage1', torch.Size([1, 96, 96, 96])),
18# ('stage2', torch.Size([1, 192, 48, 48])),
19# ('stage3', torch.Size([1, 384, 24, 24])),
20# ('stage4', torch.Size([1, 768, 12, 12]))]1@misc{ryali2023hierahierarchicalvisiontransformer,
2 title={Hiera: A Hierarchical Vision Transformer without the Bells-and-Whistles},
3 author={Chaitanya Ryali and Yuan-Ting Hu and Daniel Bolya and Chen Wei and Haoqi Fan and Po-Yao Huang and Vaibhav Aggarwal and Arkabandhu Chowdhury and Omid Poursaeed and Judy Hoffman and Jitendra Malik and Yanghao Li and Christoph Feichtenhofer},
4 year={2023},
5 eprint={2306.00989},
6 archivePrefix={arXiv},
7 primaryClass={cs.CV},
8 url={https://arxiv.org/abs/2306.00989},
9}
10
11@misc{ravi2024sam2segmentimages,
12 title={SAM 2: Segment Anything in Images and Videos},
13 author={Nikhila Ravi and Valentin Gabeur and Yuan-Ting Hu and Ronghang Hu and Chaitanya Ryali and Tengyu Ma and Haitham Khedr and Roman Rädle and Chloe Rolland and Laura Gustafson and Eric Mintun and Junting Pan and Kalyan Vasudev Alwala and Nicolas Carion and Chao-Yuan Wu and Ross Girshick and Piotr Dollár and Christoph Feichtenhofer},
14 year={2024},
15 eprint={2408.00714},
16 archivePrefix={arXiv},
17 primaryClass={cs.CV},
18 url={https://arxiv.org/abs/2408.00714},
19}
20
21@misc{oquab2024dinov2learningrobustvisual,
22 title={DINOv2: Learning Robust Visual Features without Supervision},
23 author={Maxime Oquab and Timothée Darcet and Théo Moutakanni and Huy Vo and Marc Szafraniec and Vasil Khalidov and Pierre Fernandez and Daniel Haziza and Francisco Massa and Alaaeldin El-Nouby and Mahmoud Assran and Nicolas Ballas and Wojciech Galuba and Russell Howes and Po-Yao Huang and Shang-Wen Li and Ishan Misra and Michael Rabbat and Vasu Sharma and Gabriel Synnaeve and Hu Xu and Hervé Jegou and Julien Mairal and Patrick Labatut and Armand Joulin and Piotr Bojanowski},
24 year={2024},
25 eprint={2304.07193},
26 archivePrefix={arXiv},
27 primaryClass={cs.CV},
28 url={https://arxiv.org/abs/2304.07193},
29}