Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to load saved model #7

Open
Waffleboy opened this issue Sep 24, 2020 · 1 comment
Open

Unable to load saved model #7

Waffleboy opened this issue Sep 24, 2020 · 1 comment

Comments

@Waffleboy
Copy link

Waffleboy commented Sep 24, 2020

Hello,

I cloned and followed the instructions, and put the saved model as specified.

Tried predicting images, and it crashes. Any ideas?

Restored the saved Model in file: ./model/model.ckpt
Predicting images...
Traceback (most recent call last):
  File "main.py", line 266, in <module>
    predict_images(test_data_path, print_speed=True)
  File "main.py", line 246, in predict_images
    helper.pred_samples(runs_dir, test_data_path, sess, image_shape, logits, keep_prob, input_image, print_speed)
  File "/storage/git/semantic_segmentation/helper.py", line 203, in pred_samples
    for name, image, speed_ in image_outputs:
  File "/storage/git/semantic_segmentation/helper.py", line 175, in gen_output
    {keep_prob: 1.0, image_pl: [image]})
  File "/storage/anaconda3/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 905, in run
    run_metadata_ptr)
  File "/storage/anaconda3/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1113, in _run
    str(subfeed_t.get_shape())))
ValueError: Cannot feed value of shape (1, 576, 160, 4) for Tensor 'image_input:0', which has shape '(?, ?, ?, 3)'


@DogukanAltay
Copy link

That error caused by feeding 4-channel images to the network. You can solve the problem with the following fix.

In helper.py, after line 161 you should add line below:

image = scipy.misc.imresize(scipy.misc.imread(image_file), image_shape)
image = image[:, :, :3] # This line should be added.
startTime = time.clock() 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants