[英]Is there an easy way to access the pretrained weights for Google's ViT model?
I'm doing a project where I'm using a ViT.我正在做一个使用 ViT 的项目。 I heard that they need a lot of pretraining to beat out CNNs, so I want to use Google's pretrained weights and load them into a Keras model. However, it doesn't look like theres an easy way to do it and I can't find the model weights on google's github. If I can't get this to work I'll probably try using a Hugging Face model.
我听说他们需要大量的预训练才能击败 CNN,所以我想使用 Google 的预训练权重并将它们加载到 Keras model 中。但是,看起来没有简单的方法可以做到这一点,我做不到在 google 的 github 上找到 model 权重。如果我不能让它工作,我可能会尝试使用 Hugging Face model。
So I found this github repo that allows you to load the pre-trained weights of the model. In the documentation there is also a snippet for fine-tuning.所以我找到了这个github repo ,它允许你加载 model 的预训练权重。在文档中还有一个用于微调的片段。 Like so:
像这样:
image_size = 224
model = vit.vit_l32(
image_size=image_size,
activation='sigmoid',
pretrained=True,
include_top=True,
pretrained_top=False,
classes=200
)
# Train this model on your data as desired.
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.