utils.py 文件源码

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

项目:deep-learning-experiments 作者: raghakot 项目源码 文件源码
def load_img(path, grayscale=False, target_size=None):
    """Utility function to load an image from disk.

    Args:
      path: The image file path.
      grayscale: True to convert to grayscale image (Default value = False)
      target_size: (w, h) to resize. (Default value = None)

    Returns:
        The loaded numpy image.
    """
    img = io.imread(path, grayscale)
    img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
    if target_size:
        img = cv2.resize(img, (target_size[1], target_size[0]))
    return img
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号