tensorflow-deeplab-v3-plus icon indicating copy to clipboard operation
tensorflow-deeplab-v3-plus copied to clipboard

can't run inference.py

Open yannuoy opened this issue 6 years ago • 7 comments

Hello!
First thanks a lot for your code base! I am trying to run the inference.py without running the training. I downloaded the pre-trained model, and set up the data folders following your instructions. I ran into this error:

/usr/local/lib/python2.7/dist-packages/h5py/init.py:36: FutureWarning: Conversion of the second argument of issubdtype from float to np.floating is deprecated. In future, it will be treated as np.float64 == np.dtype(float).type. from ._conv import register_converters as _register_converters WARNING:tensorflow:From /usr/local/lib/python2.7/dist-packages/tensorflow/contrib/learn/python/learn/datasets/base.py:198: retry (from tensorflow.contrib.learn.python.learn.datasets.base) is deprecated and will be removed in a future version. Instructions for updating: Use the retry module or similar alternatives. INFO:tensorflow:Using default config. INFO:tensorflow:Using config: {'_save_checkpoints_secs': 600, '_session_config': None, '_keep_checkpoint_max': 5, '_task_type': 'worker', '_global_id_in_cluster': 0, '_is_chief': True, '_cluster_spec': <tensorflow.python.training.server_lib.ClusterSpec object at 0x7f4755d708d0>, '_evaluation_master': '', '_save_checkpoints_steps': None, '_keep_checkpoint_every_n_hours': 10000, '_service': None, '_num_ps_replicas': 0, '_tf_random_seed': None, '_master': '', '_num_worker_replicas': 1, '_task_id': 0, '_log_step_count_steps': 100, '_model_dir': './model', '_save_summary_steps': 100} ['dataset/hisi_images/hisi_000001.jpg'] yannuo debug <generator object predict at 0x7f4756090370> INFO:tensorflow:Calling model_fn. INFO:tensorflow:Done calling model_fn. INFO:tensorflow:Graph was finalized. 2018-04-27 16:34:02.949711: I tensorflow/core/platform/cpu_feature_guard.cc:140] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA INFO:tensorflow:Restoring parameters from ./model/model.ckpt-30358 INFO:tensorflow:Running local_init_op. INFO:tensorflow:Done running local_init_op. 2018-04-27 16:34:05.296762: W tensorflow/core/framework/op_kernel.cc:1273] OP_REQUIRES failed at iterator_ops.cc:891 : Invalid argument: Number of ways to split should evenly divide the split dimension, but got split_dim 2 (size = 4) and num_split 3 [[Node: split = Split[T=DT_FLOAT, num_split=3](split/split_dim, ToFloat)]] Traceback (most recent call last): File "inference_save.py", line 104, in tf.app.run(main=main, argv=[sys.argv[0]] + unparsed) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/platform/app.py", line 126, in run _sys.exit(main(argv)) File "inference_save.py", line 85, in main for pred_dict, image_path in zip(predictions, image_files): File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/estimator/estimator.py", line 501, in predict preds_evaluated = mon_sess.run(predictions) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/training/monitored_session.py", line 546, in run run_metadata=run_metadata) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/training/monitored_session.py", line 1022, in run run_metadata=run_metadata) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/training/monitored_session.py", line 1113, in run raise six.reraise(*original_exc_info) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/training/monitored_session.py", line 1098, in run return self._sess.run(*args, **kwargs) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/training/monitored_session.py", line 1170, in run run_metadata=run_metadata) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/training/monitored_session.py", line 950, in run return self._sess.run(*args, **kwargs) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py", line 905, in run run_metadata_ptr) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py", line 1140, in _run feed_dict_tensor, options, run_metadata) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py", line 1321, in _do_run run_metadata) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py", line 1340, in _do_call raise type(e)(node_def, op, message) tensorflow.python.framework.errors_impl.InvalidArgumentError: Number of ways to split should evenly divide the split dimension, but got split_dim 2 (size = 4) and num_split 3 [[Node: split = Split[T=DT_FLOAT, num_split=3](split/split_dim, ToFloat)]] [[Node: IteratorGetNext = IteratorGetNextoutput_shapes=[[?,?,?,3]], output_types=[DT_FLOAT], _device="/job:localhost/replica:0/task:0/device:CPU:0"]]

============================== I couldn't figure out what went wrong, really appreciate the help.

Thanks !! Yannuo

yannuoy avatar Apr 27 '18 23:04 yannuoy

Hi @yannuoy , thank you for your interest in the repo. Unfortunately, the repo is not supporting python 2.7 at the moment. Please use python 3.5+ with Tensorflow and I'm happy to help you with that.

rishizek avatar Apr 30 '18 06:04 rishizek

Alright, thanks a lot, will try python 3.5 -- Many thanks!

yannuoy avatar Apr 30 '18 20:04 yannuoy

I have similar issue with Python 3.5, Tensorflow 1.12, CUDA 8

tensorflow.python.framework.errors_impl.InvalidArgumentError: Number of ways to split should evenly divide the split dimension, but got split_dim 2 (size = 1) and num_split 3 [[{{node split}} = Split[T=DT_FLOAT, num_split=3, _device="/device:CPU:0"](split/split_dim, ToFloat)]] [[{{node IteratorGetNext}} = IteratorGetNextoutput_shapes=[[?,?,?,3]], output_types=[DT_FLOAT], _device="/job:localhost/replica:0/task:0/device:CPU:0"]]

lthngan avatar Dec 04 '18 08:12 lthngan

I have the similar problem in evaluate.py,the error is:ensorflow.python.framework.errors_impl.InvalidArgumentError: Number of ways to split should evenly divide the split dimension, but got split_dim 2 (size = 1) and num_split 3 [[{{node split}} = Split[T=DT_FLOAT, num_split=3, _device="/device:CPU:0"](split/split_dim, ToFloat)]] [{{node IteratorGetNext}} = IteratorGetNextoutput_shapes=[[?,?,?,3],[?,?,?,1]], output_types=[DT_FLOAT,DT_INT32], _device="/job:localhost/replica:0/task:0/device:CPU:0"]] Hope to get your answer,that will be great apperciate

HanChen-HUST avatar Dec 18 '18 03:12 HanChen-HUST

did u finish this bug?much thanks

HanChen-HUST avatar Feb 14 '19 07:02 HanChen-HUST

did u finish this bug?much thanks

ningxiangyun avatar Jul 05 '19 02:07 ningxiangyun

did u finish this bug?much thanks

My input PNG is RGBA mode.I have finish this bug when I convert PNG to JEPG.

ningxiangyun avatar Jul 06 '19 09:07 ningxiangyun