dataset_images.py 文件源码

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

项目:lipnet 作者: grishasergei 项目源码 文件源码
def read_image(image_name, img_size=None):
        """
        Read image from file
        :param image_name: string, image full name including path
        :param img_size: tuple of two ints, optional, specify if you want to resize image
        :return: numpy 2d array
        """
        filename = image_name
        try:
            img = io.imread(filename)
        except IOError:
            return None
        img = img_as_float(img)
        if len(img.shape) > 2:
            img = img[:, :, 0]

        if img_size is not None:
            img = resize(img, (img_size[0], img_size[1]))
            img = img.reshape((1, img_size[0], img_size[1]))

        return img
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号