Closed np000 closed 6 years ago
Hey, Im sorry for that. I forgot to change the variable num_classes
back
You can change line 16 in inference.py
in to:
num_classes = 19
@npv0 , I have fixed the problem, you can take a look at the new version
Thanks for the quick reply. Yes it worked.
I was trying to run inference.py with example images
I am trying to run inference.py with example images, I got tensorflow ValueError like this
Example run 1, model=train
user@instance-2-cudnnv5:~/exp/tf_codes_new/ICNet-tensorflow$ python inference.py --img-path=input/IMG_0416_640x480.png --model=train successful load img: input/IMG_0416_640x480.png input image shape: (480, 640, 3) WARNING:tensorflow:From inference.py:119: calling argmax (from tensorflow.python.ops.math_ops) with dimension is deprecated and will be removed in a future version. Instructions for updating: Use the
main()
File "inference.py", line 134, in main
net.load(model_train30k, sess)
File "/home/user/exp/tf_codes_new/ICNet-tensorflow/network.py", line 77, in load
session.run(var.assign(data))
File "/home/user/.local/lib/python2.7/site-packages/tensorflow/python/ops/variables.py", line 573, in assign
return state_ops.assign(self._variable, value, use_locking=use_locking)
File "/home/user/.local/lib/python2.7/site-packages/tensorflow/python/ops/state_ops.py", line 276, in assign
validate_shape=validate_shape)
File "/home/user/.local/lib/python2.7/site-packages/tensorflow/python/ops/gen_state_ops.py", line 57, in assign
use_locking=use_locking, name=name)
File "/home/user/.local/lib/python2.7/site-packages/tensorflow/python/framework/op_def_library.py", line 787, in _apply_op_helper
op_def=op_def)
File "/home/user/.local/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 2958, in create_op
set_shapes_for_outputs(ret)
File "/home/user/.local/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 2209, in set_shapes_for_outputs
shapes = shape_func(op)
File "/home/user/.local/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 2159, in call_with_requiring
return call_cpp_shape_fn(op, require_shape_fn=True)
File "/home/user/.local/lib/python2.7/site-packages/tensorflow/python/framework/common_shapes.py", line 627, in call_cpp_shape_fn
require_shape_fn)
File "/home/user/.local/lib/python2.7/site-packages/tensorflow/python/framework/common_shapes.py", line 691, in _call_cpp_shape_fn_impl
raise ValueError(err.message)
ValueError: Dimension 3 in both shapes must be equal, but are 27 and 19 for 'conv6_cls_1/Assign' (op: 'Assign') with input shapes: [1,1,128,27], [1,1,128,19].
axis
argument instead 2017-11-18 18:19:04.969994: I tensorflow/core/platform/cpu_feature_guard.cc:137] Your CPU supports instructions that this TensorFlow binary was not compiled to use: SSE4.1 SSE4.2 AVX AVX2 FMA Restore from train30k model... Traceback (most recent call last): File "inference.py", line 160, inExample run 2, model=trainval_bn
user@instance-2-cudnnv5:~/exp/tf_codes_new/ICNet-tensorflow$ python inference.py --img-path=input/indoor3.jpg --model=trainval_bn successful load img: input/indoor3.jpg input image shape: (360, 640, 3) Image shape cannot divided by 32, padding to (384, 672) WARNING:tensorflow:From inference.py:119: calling argmax (from tensorflow.python.ops.math_ops) with dimension is deprecated and will be removed in a future version. Instructions for updating: Use the
main()
File "inference.py", line 143, in main
net.load(model_trainval90k_bn, sess)
File "/home/user/exp/tf_codes_new/ICNet-tensorflow/network.py", line 68, in load
data_dict = np.load(data_path).item()
File "/home/user/.local/lib/python2.7/site-packages/numpy/lib/npyio.py", line 419, in load
pickle_kwargs=pickle_kwargs)
File "/home/user/.local/lib/python2.7/site-packages/numpy/lib/format.py", line 640, in read_array
array = pickle.load(fp, **pickle_kwargs)
cPickle.UnpicklingError: invalid load key, '4'.
axis
argument instead 2017-11-18 18:06:18.996643: I tensorflow/core/platform/cpu_feature_guard.cc:137] Your CPU supports instructions that this TensorFlow binary was not compiled to use: SSE4.1 SSE4.2 AVX AVX2 FMA Restore from trainval90k bnnomerge model... Traceback (most recent call last): File "inference.py", line 160, inTensorflow version 1.4.0 Python 2.7.12
I'm hoping you will help me to resolve this issue. Thanks