AM-RADIO:万域归一的视觉基础模型
迈克·兰辛格、格雷格·海因里希、扬·考茨、帕夫洛·莫尔恰诺夫
NVIDIA研究院
[AM-RADIO论文]
[PHI-S论文]
[BibTex引用]
[GitHub示例]
[v2.5技术报告]
HuggingFace模型库
可通过Python脚本加载模型:
import torch
from PIL import Image
from transformers import AutoModel, CLIPImageProcessor
hf_repo = "nvidia/RADIO-L"
image_processor = CLIPImageProcessor.from_pretrained(hf_repo)
model = AutoModel.from_pretrained(hf_repo, trust_remote_code=True)
model.eval().cuda()
image = Image.open('./assets/radio.png').convert('RGB')
pixel_values = image_processor(images=image, return_tensors='pt', do_resize=True).pixel_values
pixel_values = pixel_values.cuda()
summary, features = model(pixel_values)
使用说明
RADIO模型返回包含两个张量的元组:
summary
:类似ViT中的cls_token
,表征图像整体概念,形状为$(B,C)$(B为批次维度,C为通道数)
spatial_features
:表征局部特征,适用于语义分割等密集任务或LLM集成,形状为$(B,T,D)$(T为展平的空间标记,D为空间特征通道数)。注意通常$C \neq D$
转换为空间张量格式(适用于计算机视觉任务的标准$(B,D,H,W)$形状):
from einops import rearrange
spatial_features = rearrange(spatial_features, 'b (h w) d -> b d h w', h=x.shape[-2] // patch_size, w=x.shape[-1] // patch_size)
RADIOv2.5说明
详见RADIOv2.5技术报告
许可协议
RADIO代码及权重采用NSCLv1许可发布
引用RADIO
若使用本仓库,请考虑加星并引用:
@InProceedings{Ranzinger_2024_CVPR,
author = {Ranzinger, Mike and Heinrich, Greg and Kautz, Jan and Molchanov, Pavlo},
title = {AM-RADIO: Agglomerative Vision Foundation Model Reduce All Domains Into One},
booktitle = {Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR)},
month = {June},
year = {2024},
pages = {12490-12500}
}
@misc{ranzinger2024phisdistributionbalancinglabelfree,
title={PHI-S: Distribution Balancing for Label-Free Multi-Teacher Distillation},
author={Mike Ranzinger and Jon Barker and Greg Heinrich and Pavlo Molchanov and Bryan Catanzaro and Andrew Tao},
year={2024},
eprint={2410.01680},
archivePrefix={arXiv},
primaryClass={cs.LG},
url={https://arxiv.org/abs/2410.01680},
}