Views
No views yet
1from transformers import AutoModelForImageClassification
2import torch
3
4# Load model
5model = AutoModelForImageClassification.from_pretrained(
6 "BiliSakura/RSP-ViTAEv2-S",
7 trust_remote_code=True
8)
9
10# Inference
11model.eval()
12input_image = torch.randn(1, 3, 224, 224) # (batch, channels, height, width)
13
14with torch.no_grad():
15 outputs = model(pixel_values=input_image)
16 logits = outputs["logits"] # Shape: (1, 51)
17 predicted_class = logits.argmax(dim=-1).item()1@ARTICLE{rsp,
2 author={Wang, Di and Zhang, Jing and Du, Bo and Xia, Gui-Song and Tao, Dacheng},
3 journal={IEEE Transactions on Geoscience and Remote Sensing},
4 title={An Empirical Study of Remote Sensing Pretraining},
5 year={2023},
6 volume={61},
7 number={},
8 pages={1-20},
9 doi={10.1109/TGRS.2022.3176603}
10}