使用keras ImageDataGenerator进行图像预处理

时间:2020-07-01 17:35:04

标签: python tensorflow image-processing keras deep-learning

我试图使用preprocessing_function在ImageDataGenerator中放置预处理功能。数据由图像组成。我做了如下预处理图像。

def preprocessing(images):
    images = alignment(images)
    images = crop(images)
    return images

我已经用另一张图片检查了此功能,它工作正常,但无法进行预处理和训练模型。出现的错误是-“不支持的图像类型,必须是8位灰度或RGB图像。” 。该错误是针对对齐功能的。

def alignment(image):
    gray_image = cv2.cvtColor(image ,cv2.COLOR_BGR2GRAY)
    # other stuffs

错误出现在对齐功能的第一行。请帮助我。

0 个答案:

没有答案