Views
No views yet

| huggingface name | model name | pretrain | resolution | #param |
|---|---|---|---|---|
| internimage_l_22k_384 | InternImage-L | IN-22K | 384x384 | 223M |
| internimage_xl_22k_384 | InternImage-XL | IN-22K | 384x384 | 335M |
| internimage_h_jointto22k_384 | InternImage-H | Joint 427M -> IN-22K | 384x384 | 1.08B |
| internimage_g_jointto22k_384 | InternImage-G | Joint 427M -> IN-22K | 384x384 | 3B |
| huggingface name | model name | pretrain | resolution | acc@1 | #param | FLOPs |
|---|---|---|---|---|---|---|
| internimage_t_1k_224 | InternImage-T | IN-1K | 224x224 | 83.5 | 30M | 5G |
| internimage_s_1k_224 | InternImage-S | IN-1K | 224x224 | 84.2 | 50M | 8G |
| internimage_b_1k_224 | InternImage-B | IN-1K | 224x224 | 84.9 | 97M | 16G |
| internimage_l_22kto1k_384 | InternImage-L | IN-22K | 384x384 | 87.7 | 223M | 108G |
| internimage_xl_22kto1k_384 | InternImage-XL | IN-22K | 384x384 | 88.0 | 335M | 163G |
| internimage_h_22kto1k_640 | InternImage-H | Joint 427M -> IN-22K | 640x640 | 89.6 | 1.08B | 1478G |
| internimage_g_22kto1k_512 | InternImage-G | Joint 427M -> IN-22K | 512x512 | 90.1 | 3B | 2700G |
1git clone https://github.com/OpenGVLab/InternImage.git
2cd InternImage/classification/ops_dcnv3sh make.sh1import torch
2from PIL import Image
3from transformers import AutoModel, CLIPImageProcessor
4
5# Replace 'model_name' with the appropriate model identifier
6model_name = "OpenGVLab/internimage_t_1k_224" # example model
7
8# Prepare the image
9image_path = 'img.png'
10image_processor = CLIPImageProcessor.from_pretrained(model_name)
11image = Image.open(image_path)
12image = image_processor(images=image, return_tensors='pt').pixel_values
13print('image shape:', image.shape)
14
15# Load the model as a backbone
16model = AutoModel.from_pretrained(model_name, trust_remote_code=True)
17# 'hidden_states' contains the outputs from the 4 stages of the InternImage backbone
18hidden_states = model(image).hidden_states1import torch
2from PIL import Image
3from transformers import AutoModelForImageClassification, CLIPImageProcessor
4
5# Replace 'model_name' with the appropriate model identifier
6model_name = "OpenGVLab/internimage_t_1k_224" # example model
7
8# Prepare the image
9image_path = 'img.png'
10image_processor = CLIPImageProcessor.from_pretrained(model_name)
11image = Image.open(image_path)
12image = image_processor(images=image, return_tensors='pt').pixel_values
13print('image shape:', image.shape)
14
15# Load the model as an image classifier
16model = AutoModelForImageClassification.from_pretrained(model_name, trust_remote_code=True)
17logits = model(image).logits
18label = torch.argmax(logits, dim=1)
19print("Predicted label:", label.item())1@inproceedings{wang2023internimage,
2 title={Internimage: Exploring large-scale vision foundation models with deformable convolutions},
3 author={Wang, Wenhai and Dai, Jifeng and Chen, Zhe and Huang, Zhenhang and Li, Zhiqi and Zhu, Xizhou and Hu, Xiaowei and Lu, Tong and Lu, Lewei and Li, Hongsheng and others},
4 booktitle={Proceedings of the IEEE/CVF conference on computer vision and pattern recognition},
5 pages={14408--14419},
6 year={2023}
7}