Views
No views yet
rdnet_t_ibot-bioscan5m encoder.
The linear probing was conducted using 289,203 samples for all taxonomic levels, and the model was evaluated on the validation (14,757 samples) and test (39,373 samples) splits of the BIOSCAN-5M dataset.| Taxonomic Level | Classes (N) | Val Top-1 Acc. (%) | Test Top-1 Acc. (%) |
|---|---|---|---|
| Order | 42 | 99.36 | 99.01 |
| Family | 606 | 95.79 | 92.89 |
| Genus | 4930 | 88.09 | 78.51 |
| Species | 11846 | 79.74 | 65.26 |
| Taxonomic Level | AMI Score (%) |
|---|---|
| Genus | 39.14 |
| Species | 26.91 |
order, family, genus, and species.1import torch
2import birder
3from birder.inference.classification import infer_image
4
5(net, model_info) = birder.load_pretrained_model("rdnet_t_ibot-bioscan5m", inference=True)
6
7# Load a linear probing classification head (e.g., for 'family')
8head_data = torch.load("models/rdnet_t_ibot-bioscan5m-family.head.pt")
9
10# Reset the classifier layer and load the head weights
11net.reset_classifier(len(head_data["class_to_idx"]))
12net.classifier.load_state_dict(head_data["state"])
13
14# Get the image size the model was trained on
15size = birder.get_size_from_signature(model_info.signature)
16
17# Create an inference transform
18transform = birder.classification_transform(size, model_info.rgb_stats)
19
20image = "path/to/image.jpeg" # or a PIL image, must be loaded in RGB format
21(out, _) = infer_image(net, image, transform)
22# out is a NumPy array with shape of (1, N_CLASSES) for the chosen level, representing class probabilities.1import birder
2from birder.inference.classification import infer_image
3
4(net, model_info) = birder.load_pretrained_model("rdnet_t_ibot-bioscan5m", 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, 1040)1from PIL import Image
2import birder
3
4(net, model_info) = birder.load_pretrained_model("rdnet_t_ibot-bioscan5m", 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, 256, 56, 56])),
18# ('stage2', torch.Size([1, 440, 28, 28])),
19# ('stage3', torch.Size([1, 744, 14, 14])),
20# ('stage4', torch.Size([1, 1040, 7, 7]))]1@misc{kim2024densenetsreloadedparadigmshift,
2 title={DenseNets Reloaded: Paradigm Shift Beyond ResNets and ViTs},
3 author={Donghyun Kim and Byeongho Heo and Dongyoon Han},
4 year={2024},
5 eprint={2403.19588},
6 archivePrefix={arXiv},
7 primaryClass={cs.CV},
8 url={https://arxiv.org/abs/2403.19588},
9}
10
11@misc{zhou2022ibotimagebertpretraining,
12 title={iBOT: Image BERT Pre-Training with Online Tokenizer},
13 author={Jinghao Zhou and Chen Wei and Huiyu Wang and Wei Shen and Cihang Xie and Alan Yuille and Tao Kong},
14 year={2022},
15 eprint={2111.07832},
16 archivePrefix={arXiv},
17 primaryClass={cs.CV},
18 url={https://arxiv.org/abs/2111.07832},
19}
20
21@inproceedings{gharaee2024bioscan5m,
22 title={{BIOSCAN-5M}: A Multimodal Dataset for Insect Biodiversity},
23 booktitle={Advances in Neural Information Processing Systems},
24 author={Zahra Gharaee and Scott C. Lowe and ZeMing Gong and Pablo Millan Arias
25 and Nicholas Pellegrino and Austin T. Wang and Joakim Bruslund Haurum
26 and Iuliia Zarubiieva and Lila Kari and Dirk Steinke and Graham W. Taylor
27 and Paul Fieguth and Angel X. Chang
28 },
29 editor={A. Globerson and L. Mackey and D. Belgrave and A. Fan and U. Paquet and J. Tomczak and C. Zhang},
30 pages={36285--36313},
31 publisher={Curran Associates, Inc.},
32 year={2024},
33 volume={37},
34 url={https://proceedings.neurips.cc/paper_files/paper/2024/file/3fdbb472813041c9ecef04c20c2b1e5a-Paper-Datasets_and_Benchmarks_Track.pdf},
35}
36