0
무작위 이미지 변환으로 내 데이터 집합을 보강하는 데 관심이 있습니다. 나는 Keras ImageDataGenerator를 사용하고, 하나의 이미지에 random_transform
을 적용 할 때 나는 다음과 같은 오류를 받고 있어요 : Keras ImageDataGenerator : 임의 변환
--> x = apply_transform(x, transform matrix, img_channel_axis, fill_mode, cval)
>>> RuntimeError: affine matrix has wrong number of rows.
은 내가 ImageDataGenerator
here의 소스 코드를 발견했다. 그러나 런타임 오류를 디버깅하는 방법을 잘 모르겠습니다. 아래 코드 나는이있다 :
random_transform
를 호출 할 때
from keras.preprocessing.image import img_to_array, load_img
from keras.preprocessing.image import ImageDataGenerator
from keras.applications.inception_v3 import preprocess_input
image_path = './figures/zebra.jpg'
#data augmentation
train_datagen = ImageDataGenerator(
rotation_range=40,
width_shift_range=0.2,
height_shift_range=0.2,
shear_range=0.2,
zoom_range=0.2,
horizontal_flip=True,
fill_mode='nearest')
print "\nloading image..."
image = load_img(image_path, target_size=(299, 299))
image = img_to_array(image)
image = np.expand_dims(image, axis=0) # 1 x input_shape
image = preprocess_input(image)
train_datagen.fit(image)
image = train_datagen.random_transform(image)
오류는 마지막 줄에서 발생한다.