Ich versuche, eine numpy Array in einer HDF-Datei mit h5py zu speichern, wie folgt:HDF-Datei speichert nicht richtig mit h5py
with h5py.File("mfcc_aligned.hdf", "w") as aligned_f:
# do stuff to create two numpy arrays, training_X and training_Y
print(len(training_X)) # this returns the number of elements I expect in the the numpy arr
aligned_f.create_dataset("train_X", data=training_X)
aligned_f.create_dataset("train_Y", data=training_Y)
# if I add a line here to access the datasets I just created, I see that aligned_f does indeed have two keys train_X and train_Y with the shapes I expect
Wenn jedoch das Programm beendet und ich überprüfen Sie die Datei mfcc_aligned.hdf
, es ist genau 800 Bytes (viel kleiner als ich erwarte), und es gibt keine Schlüssel. Ich weiß nicht, was hier vor sich geht.
Vielen Dank im Voraus für alle Einsichten!
haben Sie versuchen: mit h5py.File ('mfcc_aligned. hdf ',' r ') als hf: print = hf [' train_X '] [:] – user1269942