def test_read_mnist(self):
"""
Tests reading from the MNIST LMDB.
"""
lmdb_path = 'tests/mnist_test_lmdb'
lmdb = tools.lmdb_io.LMDB(lmdb_path)
keys = lmdb.keys(5)
for key in keys:
image, label, key = lmdb.read(key)
image_path = 'tests/mnist_test/' + key + '.png'
assert os.path.exists(image_path)
image = cv2.imread(image_path, cv2.CV_LOAD_IMAGE_GRAYSCALE)
for i in range(image.shape[0]):
for j in range(image.shape[1]):
self.assertEqual(image[i, j], image[i, j])
评论列表
文章目录