Image-Caption-Generator icon indicating copy to clipboard operation
Image-Caption-Generator copied to clipboard

Error while running test.py

Open LinuxBeginner opened this issue 6 years ago • 0 comments

The training was successful.

After that, I put all the test images inside the test_data-> crop_test, changed the path as 'test_data_path': 'test_data/crop_test/'

Changed this also after the completion of training

'model_load_path': 'model_data/model_inceptionv3_epoch-07_train_loss-2.7715_val_loss-3.5321.hdf5'

Generating caption for 2377.jpg Traceback (most recent call last): File "test.py", line 59, in generated_caption = generate_caption_beam_search(caption_model, tokenizer, image, max_length, beam_index=config['beam_search_k']) File "/home/Image-Caption-Generator/utils/model.py", line 140, in generate_caption_beam_search preds = model.predict([image,padded_seq], verbose=0) File "/home/img-cap/lib/python3.6/site-packages/keras/engine/training.py", line 1149, in predict x, _, _ = self._standardize_user_data(x) File "/home/img-cap/lib/python3.6/site-packages/keras/engine/training.py", line 751, in _standardize_user_data exception_prefix='input') File "/home/img-cap/lib/python3.6/site-packages/keras/engine/training_utils.py", line 138, in standardize_input_data str(data_shape)) ValueError: Error when checking input: expected input_2 to have shape (33,) but got array with shape (40,)

Thank you.

LinuxBeginner avatar Aug 09 '19 14:08 LinuxBeginner