MathiasGruber / PConv-Keras

Unofficial implementation of "Image Inpainting for Irregular Holes Using Partial Convolutions". Try at: www.fixmyphoto.ai
MIT License
909 stars 252 forks source link

Error when training in notebook with different image size #48

Open muxgt opened 5 years ago

muxgt commented 5 years ago

Hi! I'm trying to train the model on my dataset in notebook #4 with pictures of size 288x288. I have changed image sizes here:

`

Create training generator

train_datagen = AugmentingDataGenerator(
rotation_range=10, width_shift_range=0.1, height_shift_range=0.1, rescale=1./255, horizontal_flip=True ) train_generator = train_datagen.flow_from_directory( TRAIN_DIR, MaskGenerator(288, 288, 3), target_size=(288, 288), batch_size=BATCH_SIZE )

Create validation generator

val_datagen = AugmentingDataGenerator(rescale=1./255) val_generator = val_datagen.flow_from_directory( VAL_DIR, MaskGenerator(288, 288, 3), target_size=(288, 288), batch_size=20, classes=['val'], seed=42 )

Create testing generator

test_datagen = AugmentingDataGenerator(rescale=1./255) test_generator = test_datagen.flow_from_directory( TEST_DIR, MaskGenerator(288, 288, 3), target_size=(288, 288), batch_size=20, seed=42 )`

but receiving the following error:

ValueError: Error when checking input: expected inputs_img to have shape (512, 512, 3) but got array with shape (288, 288, 3)

in cell #44 when starting to train.

Is there a way to train on a different size or only 512x512?

ningscapr commented 4 years ago

I have the same probelm here. Did you find any solution?

muxgt commented 4 years ago

Yes, you also need to change size in the file pconv_model.py in line 21.