data_loader.py 文件源码

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

项目:keras_zoo 作者: david-vazquez 项目源码 文件源码
def load_img(path, grayscale=False, resize=None, order=1):
    # Load image
    img = io.imread(path)

    # Resize
    # print('Desired resize: ' + str(resize))
    if resize is not None:
        img = skimage.transform.resize(img, resize, order=order,
                                       preserve_range=True)
        # print('Final resize: ' + str(img.shape))

    # Color conversion
    if len(img.shape) == 2 and not grayscale:
        img = gray2rgb(img)
    elif len(img.shape) > 2 and img.shape[2] == 3 and grayscale:
        img = rgb2gray(img)

    # Return image
    return img
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号