最近要使用一下,姑且记录一下
安装
pip install timm
作为特征提取
import torch
import timm
m = timm.create_model('resnet50', pretrained=True, num_classes=0)
o = m(torch.randn(2, 3, 224, 224))
print(f'Pooled shape: {o.shape}')
VIT
import timm
model = timm.create_model('vit_base_patch16_224', pretrained=True)
model.eval()
本文介绍了如何通过pip安装timm库,以及如何将其用于特征提取,如使用预训练的ResNet50模型进行图像处理,并展示了如何加载和运行ViT模型。
552

被折叠的 条评论
为什么被折叠?



