许可协议: cc-by-nc-4.0
模型库: timm
标签:
vit_large_patch16_224.mae 模型卡片
一个基于视觉变换器(ViT)的图像特征模型。采用自监督掩码自编码器(MAE)方法在ImageNet-1k数据集上预训练。
模型详情
- 模型类型: 图像分类/特征主干网络
- 模型统计:
- 参数量(M): 303.3
- 计算量(GMACs): 61.6
- 激活值(M): 63.5
- 图像尺寸: 224×224像素
- 相关论文:
- 《掩码自编码器是可扩展的视觉学习者》: https://arxiv.org/abs/2111.06377
- 《一张图像等价于16×16个单词: 大规模图像识别的变换器》: https://arxiv.org/abs/2010.11929v2
- 预训练数据集: ImageNet-1k
- 原始实现: https://github.com/facebookresearch/mae
模型使用
图像分类
from urllib.request import urlopen
from PIL import Image
import timm
img = Image.open(urlopen(
'https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/beignets-task-guide.png'
))
model = timm.create_model('vit_large_patch16_224.mae', pretrained=True)
model = model.eval()
data_config = timm.data.resolve_model_data_config(model)
transforms = timm.data.create_transform(**data_config, is_training=False)
output = model(transforms(img).unsqueeze(0))
top5_probabilities, top5_class_indices = torch.topk(output.softmax(dim=1) * 100, k=5)
图像嵌入
from urllib.request import urlopen
from PIL import Image
import timm
img = Image.open(urlopen(
'https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/beignets-task-guide.png'
))
model = timm.create_model(
'vit_large_patch16_224.mae',
pretrained=True,
num_classes=0,
)
model = model.eval()
data_config = timm.data.resolve_model_data_config(model)
transforms = timm.data.create_transform(**data_config, is_training=False)
output = model(transforms(img).unsqueeze(0))
output = model.forward_features(transforms(img).unsqueeze(0))
output = model.forward_head(output, pre_logits=True)
模型比较
在timm的模型结果中查看该模型的数据集和运行时指标。
引用文献
@Article{MaskedAutoencoders2021,
作者 = {何恺明 and 陈新雷 and 谢赛宁 and 李阳浩 and Piotr Dollár and Ross Girshick},
期刊 = {arXiv:2111.06377},
标题 = {掩码自编码器是可扩展的视觉学习者},
年份 = {2021},
}
@article{dosovitskiy2020vit,
标题 = {一张图像等价于16×16个单词: 大规模图像识别的变换器},
作者 = {Alexey Dosovitskiy and Lucas Beyer and Alexander Kolesnikov and Dirk Weissenborn and 翟晓华 and Thomas Unterthiner and Mostafa Dehghani and Matthias Minderer and Georg Heigold and Sylvain Gelly and Jakob Uszkoreit and Neil Houlsby},
期刊 = {ICLR},
年份 = {2021}
}
@misc{rw2019timm,
作者 = {Ross Wightman},
标题 = {PyTorch图像模型库},
年份 = {2019},
出版商 = {GitHub},
期刊 = {GitHub仓库},
DOI = {10.5281/zenodo.4414861},
发布方式 = {\url{https://github.com/huggingface/pytorch-image-models}}
}