ludwig: Cannot feed value of shape for Tensor when predicting model with image
I get this error when trying to perform prediction with a new image on trained model:
Traceback (most recent call last):
File "/home/andrey/.venvs/ludwig-learn/bin/ludwig", line 11, in <module>
sys.exit(main())
File "/home/andrey/.venvs/ludwig-learn/lib/python3.6/site-packages/ludwig/cli.py", line 86, in main
CLI()
File "/home/andrey/.venvs/ludwig-learn/lib/python3.6/site-packages/ludwig/cli.py", line 64, in __init__
getattr(self, args.command)()
File "/home/andrey/.venvs/ludwig-learn/lib/python3.6/site-packages/ludwig/cli.py", line 73, in predict
predict.cli(sys.argv[2:])
File "/home/andrey/.venvs/ludwig-learn/lib/python3.6/site-packages/ludwig/predict.py", line 379, in cli
full_predict(**vars(args))
File "/home/andrey/.venvs/ludwig-learn/lib/python3.6/site-packages/ludwig/predict.py", line 104, in full_predict
debug
File "/home/andrey/.venvs/ludwig-learn/lib/python3.6/site-packages/ludwig/predict.py", line 173, in predict
gpu_fraction=gpu_fraction
File "/home/andrey/.venvs/ludwig-learn/lib/python3.6/site-packages/ludwig/models/model.py", line 1182, in predict
only_predictions=only_predictions
File "/home/andrey/.venvs/ludwig-learn/lib/python3.6/site-packages/ludwig/models/model.py", line 756, in batch_evaluation
is_training=is_training
File "/home/andrey/.venvs/ludwig-learn/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 929, in run
run_metadata_ptr)
File "/home/andrey/.venvs/ludwig-learn/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1128, in _run
str(subfeed_t.get_shape())))
ValueError: Cannot feed value of shape (1,) for Tensor 'image_path/image_path:0', which has shape '(?, 100, 100, 3)'
The model definition I use:
input_features:
-
name: image_path
type: image
encoder: stacked_cnn
in_memory: false
height: 100
width: 100
output_features:
-
name: tags
type: set`
Example of testing csv-file:
image_path,tags
testdata/cat.101.jpg
I’ve tried output features with category and set types but eventually get that error.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 18 (1 by maintainers)
Commits related to this issue
- Fix API online training for images (#219) * Fix hdf5 / csv file reference (#229 #100) * Fix incorrect logging in read_csv (#222) — committed to ludwig-ai/ludwig by ydudin3-zz 5 years ago
- Fixes predict for images (#237) Should solve #100 and #225 — committed to ludwig-ai/ludwig by ydudin3-zz 5 years ago
@w4nderlust Ok, thanks, here the link to my dataset sample and commands I use ludwig-prediction-example.zip
Got it, it may be the case that I’m not correctly applying the preprocessing to image features in prediction. Will look into it. @ydudin3 can you also try to check this out?