python 读取h5文件示例
import h5pyimport pandas as pdimport numpy as npimport matplotlib.pyplot as plt # plt 用于显示图片import matplotlib.image as mpimg # mpimg 用于读取图片import numpy as npf=h5py.File("/content/sample_data/100091.pn
·
import h5py
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt # plt 用于显示图片
import matplotlib.image as mpimg # mpimg 用于读取图片
import numpy as np
f=h5py.File("/content/sample_data/100091.png.h5","r+")
print(f.values)
for key in f.keys():
print(key)
print(f[key].name)
print(f[key].values())
for value in f[key].values():
print(value)
print(np.array(value).shape)
# plt.imshow(np.array(value)) # 显示图片
plt.imshow(value) # 显示图片
plt.axis('off') # 不显示坐标轴
plt.show()
plt.close()
f.close()
更多推荐
已为社区贡献2条内容
所有评论(0)