lmdb_io.py 文件源码

python
阅读 19 收藏 0 点赞 0 评论 0

项目:caffe-tools 作者: davidstutz 项目源码 文件源码
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])
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号