Open bury-source opened 5 years ago
As you mention the problem is caused because you are using tensorflow instead of theano, and the order of the image dimensions is different by default. You should change it on keras' configuration in ~/.keras/keras.json
.
Just change the image_dim_ordering parameter to th
instead of tf
.
@MarcBS
Thanks a lot! It solved the problem.
Hi, I start training the Ingredients model and when it's going to evaluate model outputs on val set, it throws out an error:
Epoch 1/200
3400/3409 [============================>.] - ETA: 0s - loss: 0.0626[07/01/2019 22:03:51] <<< Predicting outputs of val set >>>
[07/01/2019 22:04:05] Evaluating on metric multilabel_metrics
Traceback (most recent call last):
File "main.py", line 199, in <module>
train_model(params)
File "main.py", line 73, in train_model
ing_model.trainNet(dataset, training_params)
File "/disk/lucy/sourceCode/multimodal_keras_wrapper-0.7/multimodal_keras_wrapper-0.7/keras_wrapper/cnn_model.py", line 677, in trainN
et self.__train(ds, params)
File "/disk/lucy/sourceCode/multimodal_keras_wrapper-0.7/multimodal_keras_wrapper-0.7/keras_wrapper/cnn_model.py", line 862, in __trai
n initial_epoch=params['epoch_offset'])
File "/disk/lucy/sourceCode/keras-1.2.3/keras-1.2.3/keras/engine/training.py", line 1565, in fit_generator
callbacks.on_epoch_end(epoch, epoch_logs)
File "/disk/lucy/sourceCode/keras-1.2.3/keras-1.2.3/keras/callbacks.py", line 43, in on_epoch_end
callback.on_epoch_end(epoch, logs)
File "/disk/lucy/sourceCode/multimodal_keras_wrapper-0.7/multimodal_keras_wrapper-0.7/keras_wrapper/extra/callbacks.py", line 170, in
on_epoch_end self.evaluate(epoch, counter_name='epoch')
File "/disk/lucy/sourceCode/multimodal_keras_wrapper-0.7/multimodal_keras_wrapper-0.7/keras_wrapper/extra/callbacks.py", line 290, in
evaluate split=s)
File "/disk/lucy/sourceCode/multimodal_keras_wrapper-0.7/multimodal_keras_wrapper-0.7/keras_wrapper/extra/evaluation.py", line 146, in
multilabel_metrics y_pred[i_s, word2idx[word]] = 1
KeyError: 0.69028074
It seems that the argument pred_list of method multilabel_metrics in evaluation.py is composed of probability rather that word dictionary. Is there any clue to solve the problem? Thanks a lot!
BTW: I'm using custom keras==1.2.3, multimodal_keras_wrapper-0.7, with backend=tensorflow-gpu==1.5.0, python2.7, run train_recipe5k.sh
Hi, I start training the Ingredients model and when it's going to evaluate model outputs on val set, it throws out an error:
Epoch 1/200 3400/3409 [============================>.] - ETA: 0s - loss: 0.0626[07/01/2019 22:03:51] <<< Predicting outputs of val set >>> [07/01/2019 22:04:05] Evaluating on metric multilabel_metrics Traceback (most recent call last): File "main.py", line 199, in <module> train_model(params) File "main.py", line 73, in train_model ing_model.trainNet(dataset, training_params) File "/disk/lucy/sourceCode/multimodal_keras_wrapper-0.7/multimodal_keras_wrapper-0.7/keras_wrapper/cnn_model.py", line 677, in trainN et self.__train(ds, params) File "/disk/lucy/sourceCode/multimodal_keras_wrapper-0.7/multimodal_keras_wrapper-0.7/keras_wrapper/cnn_model.py", line 862, in __trai n initial_epoch=params['epoch_offset']) File "/disk/lucy/sourceCode/keras-1.2.3/keras-1.2.3/keras/engine/training.py", line 1565, in fit_generator callbacks.on_epoch_end(epoch, epoch_logs) File "/disk/lucy/sourceCode/keras-1.2.3/keras-1.2.3/keras/callbacks.py", line 43, in on_epoch_end callback.on_epoch_end(epoch, logs) File "/disk/lucy/sourceCode/multimodal_keras_wrapper-0.7/multimodal_keras_wrapper-0.7/keras_wrapper/extra/callbacks.py", line 170, in on_epoch_end self.evaluate(epoch, counter_name='epoch') File "/disk/lucy/sourceCode/multimodal_keras_wrapper-0.7/multimodal_keras_wrapper-0.7/keras_wrapper/extra/callbacks.py", line 290, in evaluate split=s) File "/disk/lucy/sourceCode/multimodal_keras_wrapper-0.7/multimodal_keras_wrapper-0.7/keras_wrapper/extra/evaluation.py", line 146, in multilabel_metrics y_pred[i_s, word2idx[word]] = 1 KeyError: 0.69028074
It seems that the argument pred_list of method multilabel_metrics in evaluation.py is composed of probability rather that word dictionary. Is there any clue to solve the problem? Thanks a lot!
BTW: I'm using custom keras==1.2.3, multimodal_keras_wrapper-0.7, with backend=tensorflow-gpu==1.5.0, python2.7, run train_recipe5k.sh
I think I solved the problem by modifying multimodal_keras_wrapper-0.7\multimodal_keras_wrapper-0.7\keras_wrapper\extra\callbacks.py, line 254, change elif to else statement, because I found the self.is_multilabel is always False `
else: ` After modifying this file, I got another error:
Traceback (most recent call last):
File "main.py", line 199, in <module>
train_model(params)
File "main.py", line 73, in train_model
ing_model.trainNet(dataset, training_params)
File "/disk/lucy/sourceCode/multimodal_keras_wrapper-0.7/multimodal_keras_wrapper-0.7/keras_wrapper/cnn_model.py", line 677, in trainN
et self.__train(ds, params)
File "/disk/lucy/sourceCode/multimodal_keras_wrapper-0.7/multimodal_keras_wrapper-0.7/keras_wrapper/cnn_model.py", line 862, in __trai
n initial_epoch=params['epoch_offset'])
File "/disk/lucy/sourceCode/keras-1.2.3/keras-1.2.3/keras/engine/training.py", line 1565, in fit_generator
callbacks.on_epoch_end(epoch, epoch_logs)
File "/disk/lucy/sourceCode/keras-1.2.3/keras-1.2.3/keras/callbacks.py", line 43, in on_epoch_end
callback.on_epoch_end(epoch, logs)
File "/disk/lucy/sourceCode/multimodal_keras_wrapper-0.7/multimodal_keras_wrapper-0.7/keras_wrapper/extra/callbacks.py", line 170, in
on_epoch_end self.evaluate(epoch, counter_name='epoch')
File "/disk/lucy/sourceCode/multimodal_keras_wrapper-0.7/multimodal_keras_wrapper-0.7/keras_wrapper/extra/callbacks.py", line 296, in
evaluate split=s)
File "/disk/lucy/sourceCode/multimodal_keras_wrapper-0.7/multimodal_keras_wrapper-0.7/keras_wrapper/extra/evaluation.py", line 154, in
multilabel_metrics gt_list = extra_vars[split]['references']
KeyError: 'references'
I modified the main.py in this repository, line 162, adding the following code:
exec("extra_vars[s]['references'] = dataset.Y_"+s+"[params['OUTPUTS_IDS_DATASET'][0]]")
when I'm training with Recipe5k using InceptionV3 model, it comes to a problem which I cannot fix it.
Can you tell me do I need to modify anything? By the way, I am using the source code and I use tensorflow as backend for keras instead of theano. Is it cause any problem?
Thanks a lot!