首页 > 解决方案 > weights = 'noisy-student' ValueError: `weights` 参数应该是 `None`、`imagenet` 或要加载的权重文件的路径

问题描述

我正在使用 Google Colab,我想使用 EfficientNet Noisy Student 的权重。https://www.kaggle.com/c/bengaliai-cv19/discussion/132894

首先,我通过以下方式安装了软件包:

!pip install git+https://github.com/qubvel/efficientnet

然后我尝试了上面提到的网站上的代码:

import efficientnet.keras as eff
model = eff.EfficientNetB0(weights='noisy-student')

并得到这个值错误:

ValueError: The `weights` argument should be either `None` (random initialization), `imagenet` (pre-training on ImageNet), or the path to the weights file to be loaded.

有人知道如何解决这个问题吗?

标签: pythonconv-neural-networkvalueerrorefficientnet

解决方案


你可以从这里下载权重。
并像这样手动加载它:

path_to_weights = "/..your..path../efficientnet-b5_noisy-student_notop.h5"
model = EfficientNetB5(include_top=False)
model.load_weights(path_to_weights, by_name=True)

推荐阅读