2018年8月1日星期三

keras传入数据报错

TypeError: unsupported operand type(s) for /=: 'JpegImageFile' and 'float'

修改方法:
from keras.applications import xception
from keras.preprocessing import image


def preprocess_input_new(x):
    img = xception.preprocess_input(image.img_to_array(x))
    return image.array_to_img(img)

ImageDataGenerator(
      preprocessing_function=preprocess_input_new,
      rotation_range=30,
      width_shift_range=0.2,
      height_shift_range=0.2,
      shear_range=0.2,
      zoom_range=0.2,
      horizontal_flip=True
  )

没有评论:

发表评论

Failed to find TIFF library

ImportError: Failed to find TIFF library. Make sure that libtiff is installed and its location is listed in PATH|LD_LIBRARY_PATH|.. 解决方法: ...