简体   繁体   English

有没有一种简单的方法可以访问谷歌 ViT model 的预训练权重?

[英]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.

相关问题 如何使用预训练模型的 model 架构但没有权重 - How to use model architecture of pretrained models but no weights 迁移学习后如何查看预训练模型的权重? - How to view weights of a pretrained model after transfer learning? TorchVision 对整个 model 与骨干网络使用预训练权重 - TorchVision using pretrained weights for entire model vs backbone 从keras中的预训练模型加载权重时的层误差 - Error in layers while loading weights from a pretrained model in keras for finetuning 以易于访问的方式存储元组列表 django model - Store list of tuples django model in easy to access way 访问几层预训练的 DistilBERT 模型的输出 - Access the output of several layers of pretrained DistilBERT model 导出和使用 TensorFlow model 的最有效和/或最简单的方法是什么 - What's the most efficient and/or easy way of exporting and using a TensorFlow model 如何使用预训练的 keras 模型作为模型添加函数的参数? - How to use a pretrained keras model to be a parameter to a Model's add function? Google Drive 预训练 model 文件无法打开加载? - Google Drive pretrained model file can't be opened for loading? 在 Tensorflow 中,如何在计算损失时访问模型的权重? - In Tensorflow, how can I access my model's weights when computing loss?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM