def read_lmdb(lmdb_path):
env = lmdb.open(lmdb_path)
with env.begin() as txn:
cursor = txn.cursor()
for (idx, (key, value)) in enumerate(cursor):
image = np.fromstring(value, dtype = np.float32)
#image = np.reshape(image, (3,225,225))/255.0
image = np.reshape(image, (27, 27))
#image = image.transpose((1,2,0))
print(image)
plt.imshow(image, cmap = 'hot')
plt.show()
break
#image = txn.get('0')
#image = np.fromstring(image)[0]
#print image.shape
评论列表
文章目录