titu1994/Image-Super-Resolution

error when run the example codes

tangyaohua opened this issue · 10 comments

Thanks for your code. When I train the simple 'Super Resolution' model as you suggested, a error came out:

Exception: Error when checking model target: expected output to have shape (None, 3, 33, 3) but got array with shape (35200, 3, 33, 33)

The line resulted in this error is:

self.model.fit(trainX, trainY, batch_size=batch_size, nb_epoch=nb_epochs, callbacks=callback_list, validation_data=(testX, testY))

could you help me on this? Thanks

@tangyaohua Are you using Tensorflow with image_dim_ordering = "tf"? Because this repo supports only theano at the moment (with image_dim_ordering="th")

no, i am using theano.I even didn't install Tensorflow on my server.
i tried other models and another data, the error were the same.

@tangyaohua Are you training via the lines:

sr = models.ImageSuperResolutionModel()
sr.create_model()
sr.fit(trainX, trainY, nb_epochs=100)

Cause I just used it and it had no problems. The training script is in the test.py file. Just uncomment whichever model you wish to train.

@tangyaohua Also, as of Keras 1.1.0, tensorflow is the default. To change it to theano, you have to manually edit the keras.json file under ~/.keras/keras.json

thanks for your reply. I have already edited the json file and I was exactly running these lines.

@tangyaohua This error is caused due to image_dim_ordering. It is thinking the 3x3 convolutional kernel is one of the inputs. Can you print your keras.json file?

sorry, it turns out i have edited the value of 'backend' to 'theano', but the value of 'image_dim_ordering' is still 'tf'.
now the codes start running.

Thanks very much.

@tangyaohua No problem.

hi @tangyaohua where to edit the value of 'backen' to 'theano'?
btw, hi @titu1994 ,how to set cpu mode?
thanks.

@zimenglan-sysu-512 If you are on Windows, go to C:/Users/{Your User Name}/.keras folder. Inside that is a keras.json file. Inside that, edit "backend" : "theano", "image_dim_ordering" : "th" to use Theano as backend.

Theano defaults to CPU mode unless you use the command given below inside the .theanorc file in the C:/Users/{Your User Name}/ folder

[global]
device=gpu
floatX=float32