Views
No views yet
eu-common dataset containing common European bird species.moganet_s_eu-common256px.1import birder
2from birder.inference.classification import infer_image
3
4(net, model_info) = birder.load_pretrained_model("moganet_s_eu-common", inference=True)
5# Note: A 256x256 variant is available as "moganet_s_eu-common256px"
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, 707), representing class probabilities.1import birder
2from birder.inference.classification import infer_image
3
4(net, model_info) = birder.load_pretrained_model("moganet_s_eu-common", 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, 512)1from PIL import Image
2import birder
3
4(net, model_info) = birder.load_pretrained_model("moganet_s_eu-common", 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, 64, 96, 96])),
18# ('stage2', torch.Size([1, 128, 48, 48])),
19# ('stage3', torch.Size([1, 320, 24, 24])),
20# ('stage4', torch.Size([1, 512, 12, 12]))]1@misc{li2025moganetmultiordergatedaggregation,
2 title={MogaNet: Multi-order Gated Aggregation Network},
3 author={Siyuan Li and Zedong Wang and Zicheng Liu and Cheng Tan and Haitao Lin and Di Wu and Zhiyuan Chen and Jiangbin Zheng and Stan Z. Li},
4 year={2025},
5 eprint={2211.03295},
6 archivePrefix={arXiv},
7 primaryClass={cs.CV},
8 url={https://arxiv.org/abs/2211.03295},
9}