Deep learning基于theano的keras学习笔记(0)-keras常用的代码

一. 保存Keras模型

这里不推荐使用pickle或cPickle来保存Keras模型。
1. 一般使用model.save(filepath)将Keras模型和权重保存在一个HDF5文件中,该文件将包含:

  • 模型的结构,以便重构该模型
  • 模型的权重
  • 训练配置(损失函数,优化器等)
  • 优化器的状态,以便于从上次训练中断的地方开始
    使用keras.models.load_model(filepath)来重新实例化你的模型,如果文件中存储了训练配置的话,该函数还会同时完成模型的编译,例子如下:
from keras.models import load_model

model.save('my_model.h5')  # creates a HDF5 file 'my_model.h5'
del model  # deletes the existing model

# returns a compiled model
# identical to the previous one
model = load_model('my_model.h5')

2. 如果你只是希望保存模型的结构,而不包含其权重或配置信息,可以使用:

# save as JSON
json_string = model.to_json()

# save as YAML
yaml_string = model.to_yaml()

当然,你也可以从保存好的json文件或yaml文件中载入模型:

# mod
  • 2
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
pdf+epub One stop guide to implementing award-winning, and cutting-edge CNN architectures Key FeaturesFast-paced guide with use cases and real-world examples to get well versed with CNN techniquesImplement CNN models on image classification, transfer learning, Object Detection, Instance Segmentation, GANs and moreImplement powerful use-cases like image captioning, reinforcement learning for hard attention, and recurrent attention modelsBook Description Convolutional Neural Network (CNN) is revolutionizing several application domains such as visual recognition systems, self-driving cars, medical discoveries, innovative eCommerce and more.You will learn to create innovative solutions around image and video analytics to solve complex machine learning and computer vision related problems and implement real-life CNN models. This book starts with an overview of deep neural networkswith the example of image classification and walks you through building your first CNN for human face detector. We will learn to use concepts like transfer learning with CNN, and Auto-Encoders to build very powerful models, even when not much of supervised training data of labeled images is available. Later we build upon the learning achieved to build advanced vision related algorithms for object detection, instance segmentation, generative adversarial networks, image captioning, attention mechanisms for vision, and recurrent models for vision. By the end of this book, you should be ready to implement advanced, effective and efficient CNN models at your professional project or personal initiatives by working on complex image and video datasets. What you will learnFrom CNN basic building blocks to advanced concepts understand practical areas they can be applied toBuild an image classifier CNN model to understand how different components interact with each other, and then learn how to optimize itLearn different algorithms that can be applied to Object Detection, and Instance Segmentation Learn advanced concepts like attention mechanisms for CNN to improve prediction accuracyUnderstand transfer learning and implement award-winning CNN architectures like AlexNet, VGG, GoogLeNet, ResNet and moreUnderstand the working of generative adversarial networks and how it can create new, unseen imagesWho This Book Is For This book is for data scientists, machine learning and deep learning practitioners, Cognitive and Artificial Intelligence enthusiasts who want to move one step further in building Convolutional Neural Networks. Get hands-on experience with extreme datasets and different CNN architectures to build efficient and smart ConvNet models. Basic knowledge of deep learning concepts and Python programming language is expected. Table of ContentsDeep Neural Networks - OverviewIntroduction to Convolutional Neural NetworksBuild Your First CNN and Performance OptimizationPopular CNN Model's ArchitecturesTransfer LearningAutoencoders for CNNObject Detection with CNNGenerative Adversarial NetworkVisual Attention Based CNN
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值