Views
No views yet
DISABLE_CUSTOM_KERNELS=1 before loading the model.1import birder
2from birder.inference.detection import infer_image
3
4(net, model_info) = birder.load_pretrained_model("deformable_detr_boxref_coco_convnext_v2_tiny_imagenet21k", inference=True)
5# Can also load model with Soft-NMS by passing custom_config={"soft_nms": True}
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.detection_transform(size, model_info.rgb_stats, dynamic_size=model_info.signature["dynamic"])
12
13image = "path/to/image.jpeg" # or a PIL image, must be loaded in RGB format
14detections = infer_image(net, image, transform)
15# detections is a dict with keys: 'boxes', 'labels', 'scores'
16# boxes: torch.Tensor with shape (N, 4) in [x1, y1, x2, y2] format
17# labels: torch.Tensor with shape (N,) containing class indices
18# scores: torch.Tensor with shape (N,) containing confidence scores1@misc{zhu2021deformabledetrdeformabletransformers,
2 title={Deformable DETR: Deformable Transformers for End-to-End Object Detection},
3 author={Xizhou Zhu and Weijie Su and Lewei Lu and Bin Li and Xiaogang Wang and Jifeng Dai},
4 year={2021},
5 eprint={2010.04159},
6 archivePrefix={arXiv},
7 primaryClass={cs.CV},
8 url={https://arxiv.org/abs/2010.04159},
9}
10
11@misc{bodla2017softnmsimprovingobject,
12 title={Soft-NMS -- Improving Object Detection With One Line of Code},
13 author={Navaneeth Bodla and Bharat Singh and Rama Chellappa and Larry S. Davis},
14 year={2017},
15 eprint={1704.04503},
16 archivePrefix={arXiv},
17 primaryClass={cs.CV},
18 url={https://arxiv.org/abs/1704.04503},
19}
20
21@misc{woo2023convnextv2codesigningscaling,
22 title={ConvNeXt V2: Co-designing and Scaling ConvNets with Masked Autoencoders},
23 author={Sanghyun Woo and Shoubhik Debnath and Ronghang Hu and Xinlei Chen and Zhuang Liu and In So Kweon and Saining Xie},
24 year={2023},
25 eprint={2301.00808},
26 archivePrefix={arXiv},
27 primaryClass={cs.CV},
28 url={https://arxiv.org/abs/2301.00808},
29}