Deep learning "1" Ubuntu using H5py to save a good Keras neural network model

Source: Internet
Author: User
Tags keras keras model

The model saved with H5py has very little space to take up. Before you can use H5py to save Keras trained models, you need to install h5py, and the specific installation process will refer to my blog post about H5py installation: http://blog.csdn.net/linmingan/article/details/50736300

the code to save and read the Keras model using H5py is as follows:

Import h5py from keras.models import model_from_json
json_string = Model.to_json ()
open (' My_model_ Architecture.json ', ' W '). Write (json_string)
model.save_weights (' my_model_weights.h5 ')
 #读取model
Model = Model_from_json (open (' My_model_architecture.json '). Read ())
model.load_weights (' My_model_weights.h5 ')


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.