GeorgeSeif / Semantic-Segmentation-Suite

Semantic Segmentation Suite in TensorFlow. Implement, train, and test new Semantic Segmentation models easily!
2.51k stars 879 forks source link

python main.py --mode predict #42

Closed enomto closed 6 years ago

enomto commented 6 years ago

Traceback (most recent call last): File "main.py", line 522, in sys.stdout.write("Testing image " + args.image) TypeError: cannot concatenate 'str' and 'NoneType' objects

Still, can not predict?

GeorgeSeif commented 6 years ago

Hi there enomto,

Did you pass a valid image string file path as a command line argument?

enomto commented 6 years ago

Thank you for your reply.

I specified the image pass on the command line but I can not. How do I specifically specify pass? Folder specification?

enomto commented 6 years ago

Begin prediction Dataset --> CamVid Model --> FC-DenseNet103 Crop Height --> 256 Crop Width --> 256 Num Classes --> 32 Image --> ./CamVid/test/0001TP_007170.png

Testing image ./CamVid/test/0001TP_007170.pngTraceback (most recent call last): File "main.py", line 534, in output_image = sess.run(network,feed_dict={input:input_image}) File "/home/atsushi/tensorflow/local/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 789, in run run_metadata_ptr) File "/home/atsushi/tensorflow/local/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 997, in _run feed_dict_string, options, run_metadata) File "/home/atsushi/tensorflow/local/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 1132, in _do_run target_list, options, run_metadata) File "/home/atsushi/tensorflow/local/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 1152, in _do_call raise type(e)(node_def, op, message) tensorflow.python.framework.errors_impl.InvalidArgumentError: ConcatOp : Dimensions of inputs should match: shape[0] = [1,14,16,240] vs. shape[1] = [1,15,16,656] [[Node: FC-DenseNet103/transitionup6/concat = ConcatV2[N=2, T=DT_FLOAT, Tidx=DT_INT32, _device="/job:localhost/replica:0/task:0/gpu:0"](FC-DenseNet103/transitionup6/Conv2d_transpose/BiasAdd, FC-DenseNet103/denseblock5/concat_11, FC-DenseNet103/transitionup6/concat/axis)]]

Caused by op u'FC-DenseNet103/transitionup6/concat', defined at: File "main.py", line 153, in network = build_fc_densenet(input, preset_model = args.model, num_classes=num_classes) File "models/FC_DenseNet_Tiramisu.py", line 150, in build_fc_densenet stack = TransitionUp(block_to_upsample, skip_connection_list[i], n_filters_keep, scope='transitionup%d' % (n_pool + i + 1)) File "models/FC_DenseNet_Tiramisu.py", line 63, in TransitionUp l = tf.concat([l, skip_connection], axis=-1) File "/home/atsushi/tensorflow/local/lib/python2.7/site-packages/tensorflow/python/ops/array_ops.py", line 1048, in concat name=name) File "/home/atsushi/tensorflow/local/lib/python2.7/site-packages/tensorflow/python/ops/gen_array_ops.py", line 495, in _concat_v2 name=name) File "/home/atsushi/tensorflow/local/lib/python2.7/site-packages/tensorflow/python/framework/op_def_library.py", line 767, in apply_op op_def=op_def) File "/home/atsushi/tensorflow/local/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 2506, in create_op original_op=self._default_original_op, op_def=op_def) File "/home/atsushi/tensorflow/local/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 1269, in init self._traceback = _extract_stack()

InvalidArgumentError (see above for traceback): ConcatOp : Dimensions of inputs should match: shape[0] = [1,14,16,240] vs. shape[1] = [1,15,16,656] [[Node: FC-DenseNet103/transitionup6/concat = ConcatV2[N=2, T=DT_FLOAT, Tidx=DT_INT32, _device="/job:localhost/replica:0/task:0/gpu:0"](FC-DenseNet103/transitionup6/Conv2d_transpose/BiasAdd, FC-DenseNet103/denseblock5/concat_11, FC-DenseNet103/transitionup6/concat/axis)]]

GeorgeSeif commented 6 years ago

Ah okay so you have passed the image correctly. The issue here is the image size. See issue #27 and let me know if you have any questions on it! I might just add some automatic cropping for the prediction part as some people have been having the same errors as you. Cheers!

https://github.com/GeorgeSeif/Semantic-Segmentation-Suite/issues/27