Description of the "Python series" HDF5 file

Source: Internet
Author: User

A HDF5 file is a container for two types of objects: DataSet and group. A dataset is an array-like DataSet, and group is a folder-like container that holds datasets and other group. When using h5py, you need to keep in mind a word: Groups analogy dictionary, dataset analogy numpy in the array.

Although the HDF5 dataset is similar to the NumPy array on the interface, it supports more externally transparent storage features such as data compression, error detection, and chunked transmission.

HDF5 storage model files or datasets are also commonly used in deep learning

ImportH5py#Importing the toolkitImportNumPy as NP#write to HDF5:Imgdata = Np.zeros ((30,3,128,256)) F= H5py. File ('Hdf5_file.h5','W')#Create a H5 file, the file pointer is Ff['Data'] = Imgdata#write data to the file's primary key data belowf['Labels'] = range (100)#write data to the file's primary key labels belowF.close ()#Close File  #read from HDF5:f = h5py. File ('Hdf5_file.h5','R')#Open h5 fileF.keys ()#You can view all the primary keysA = f['Data'][:]#Remove all key values for the primary key dataF.close ()

Description of the "Python series" HDF5 file

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.