Keras 预训练权重下载(持续更新中)

Keras 模型权重(repo地址:https://github.com/fchollet/deep-learning-models/releases):

ResNet

DenseNet

InceptionResNetV2

MobileNet

  • List item

Xception model

  • List item

VGG16, VGG19

  • List item

下载Flyai提供的预训练模型

  1. 安装flyai框架
    建议使用conda环境安装,方便管理,安装时好像除了flyai还会装其他的库包括numpy,tensorflow之类
pip install flyai

2.调用flyai的库下载模型,模型可以在这个网址上找
找到要使用的模型,点击复制使用,运行代码会自动下载,keras是下载到用户目录下的.Keras文件夹下
这里直接引用flyai网站上keras使用flyai预训练模型说明。

from keras.applications import densenet
from flyai.utils import remote_helper
path=remote_helper.get_remote_date("https://www.flyai.com/m/v0.8|densenet169_weights_tf_dim_ordering_tf_kernels_notop.h5")   #参数替换为想要下载的模型地址
densenet_notop = densenet.DenseNet169(include_top=False, weights=None)
densenet_notop.load_weights(path)
# densenet_notop = densenet.DenseNet169(include_top=False, weights='imagenet')
# 这行代码与上面等同,只不过一个是调用FlyAI提供的预训练模型地址,一个是外网的地址
x = densenet_notop.output
x = GlobalAveragePooling2D()(x)
x = Dense(2048, activation='relu')(x)
predictions = Dense(200, activation='softmax')(x)
model = Model(inputs=densenet_notop.input, outputs=predictions)
model.compile(...)
model.fit_generator(...)

下载模型,只需运行remote_helper.get_remote_date()这行代码就可以了。

参考

  • 0
    点赞
  • 17
    收藏
    觉得还不错? 一键收藏
  • 10
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 10
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值