cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
louisli
Observer
Observer
1,118 Views
Registered: ‎05-21-2014

failed to excute decent_q.sh in tensorflow version

Hi,

Thanks for the support! I have successfully install the decent and dnnc tools with the compatible CUDA 9.0 and cuDNN 7.0.5 on my Ubuntu 16.04 LTS. However, I faced a new problem when excuting the script decent.sh. The errors can be seen below. Can you please help with this issue? Thank you!

PS: I have downloaded the dataset from ImageNet and put 100 images (size 32x32) under the folder $dnndk_pkg/host_x86/models/calibration/image/ and the image size has been changed from 224x224 to 32x32 in file decent_q.sh and resnet_v1_50_input_fn.py

$ sh decent_q.sh
INFO: Start Float Graph Check
Traceback (most recent call last):
File "/home/xiangwei/.conda/envs/decent/bin/decent_q", line 10, in <module>
sys.exit(run_main())
File "/home/xiangwei/.conda/envs/decent/lib/python2.7/site-packages/tensorflow/contrib/decent_q/python/decent_q.py", line 565, in run_main
app.run(main=my_main, argv=[sys.argv[0]] + unparsed)
File "/home/xiangwei/.conda/envs/decent/lib/python2.7/site-packages/tensorflow/python/platform/app.py", line 125, in run
_sys.exit(main(argv))
File "/home/xiangwei/.conda/envs/decent/lib/python2.7/site-packages/tensorflow/contrib/decent_q/python/decent_q.py", line 564, in <lambda>
my_main = lambda unused_args: main(unused_args, FLAGS)
File "/home/xiangwei/.conda/envs/decent/lib/python2.7/site-packages/tensorflow/contrib/decent_q/python/decent_q.py", line 357, in main
s_config)
File "/home/xiangwei/.conda/envs/decent/lib/python2.7/site-packages/tensorflow/contrib/decent_q/python/decent_q.py", line 328, in quantize
check_float_graph(input_graph_def, q_config, i_config, s_config)
File "/home/xiangwei/.conda/envs/decent/lib/python2.7/site-packages/tensorflow/contrib/decent_q/python/decent_q.py", line 187, in check_float_graph
inputs = input_fn(iter=0)
File "/home/xiangwei/.conda/envs/decent/lib/python2.7/site-packages/tensorflow/contrib/decent_q/python/input_fn.py", line 176, in __call__
return self.input_fn(iter=iter)
File "./resnet_v1_50_input_fn.py", line 28, in calib_input
curline = line[iter * calib_batch_size + index]
IndexError: list index out of range
- |#

 

regards,

Louis

0 Kudos
5 Replies
lvalena
Xilinx Employee
Xilinx Employee
1,107 Views
Registered: ‎12-09-2015

(^^)/

 

This error "IndexError: list index out of range" seems to be a TensorFlow error and not a DNNDK error (ref).

 

Please make sure that you are able to run inference using the frozen graph before using the DNNDK tools.

 

"Save, Load and Inference from TensorFlow Frozen Graph" may help.

0 Kudos
louisli
Observer
Observer
1,069 Views
Registered: ‎05-21-2014

Hi Ivalena,

Thanks for your help! The problem was caused by the blank calib.txt. I have typed the calibration images' name and solved that problem. However, there is another issue after that when executing decent_q.sh. Can you please have a look?

INFO: Start Calibration for 2 iterations:
50% (1 of 2) |################# | Elapsed Time: 0:00:07 ETA: 0:00:07Traceback (most recent call last):
File "/home/xiangwei/.conda/envs/decent/bin/decent_q", line 10, in <module>
sys.exit(run_main())
File "/home/xiangwei/.conda/envs/decent/lib/python2.7/site-packages/tensorflow/contrib/decent_q/python/decent_q.py", line 565, in run_main
app.run(main=my_main, argv=[sys.argv[0]] + unparsed)
File "/home/xiangwei/.conda/envs/decent/lib/python2.7/site-packages/tensorflow/python/platform/app.py", line 125, in run
_sys.exit(main(argv))
File "/home/xiangwei/.conda/envs/decent/lib/python2.7/site-packages/tensorflow/contrib/decent_q/python/decent_q.py", line 564, in <lambda>
my_main = lambda unused_args: main(unused_args, FLAGS)
File "/home/xiangwei/.conda/envs/decent/lib/python2.7/site-packages/tensorflow/contrib/decent_q/python/decent_q.py", line 357, in main
s_config)
File "/home/xiangwei/.conda/envs/decent/lib/python2.7/site-packages/tensorflow/contrib/decent_q/python/decent_q.py", line 329, in quantize
return quantize_with_config(input_graph_def, q_config, i_config, s_config)
File "/home/xiangwei/.conda/envs/decent/lib/python2.7/site-packages/tensorflow/contrib/decent_q/python/decent_q.py", line 215, in quantize_with_config
sess.run(output_tensors, feed_dict)
File "/home/xiangwei/.conda/envs/decent/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 900, in run
run_metadata_ptr)
File "/home/xiangwei/.conda/envs/decent/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 1104, in _run
np_val = np.asarray(subfeed_val, dtype=subfeed_dtype)
File "/home/xiangwei/.conda/envs/decent/lib/python2.7/site-packages/numpy/core/numeric.py", line 538, in asarray
return array(a, dtype, copy=False, order=order)
ValueError: setting an array element with a sequence.

Regards,

Louis

0 Kudos
lvalena
Xilinx Employee
Xilinx Employee
1,050 Views
Registered: ‎12-09-2015

(^^)/

 

A google search using the keywords, "setting an array element with a sequence tensorflow" provides several hits. Some of them may provide hints. E.g.,

 

Tensorflow (python): “ValueError: setting an array element with a sequence” in train_step.run(…)

 

0 Kudos
gchauvel
Observer
Observer
887 Views
Registered: ‎07-08-2019


@louisli wrote:

Hi Ivalena,

Thanks for your help! The problem was caused by the blank calib.txt. I have typed the calibration images' name and solved that problem. However, there is another issue after that when executing decent_q.sh. Can you please have a look?

INFO: Start Calibration for 2 iterations:
50% (1 of 2) |################# | Elapsed Time: 0:00:07 ETA: 0:00:07Traceback (most recent call last):
File "/home/xiangwei/.conda/envs/decent/bin/decent_q", line 10, in <module>
sys.exit(run_main())
File "/home/xiangwei/.conda/envs/decent/lib/python2.7/site-packages/tensorflow/contrib/decent_q/python/decent_q.py", line 565, in run_main
app.run(main=my_main, argv=[sys.argv[0]] + unparsed)
File "/home/xiangwei/.conda/envs/decent/lib/python2.7/site-packages/tensorflow/python/platform/app.py", line 125, in run
_sys.exit(main(argv))
File "/home/xiangwei/.conda/envs/decent/lib/python2.7/site-packages/tensorflow/contrib/decent_q/python/decent_q.py", line 564, in <lambda>
my_main = lambda unused_args: main(unused_args, FLAGS)
File "/home/xiangwei/.conda/envs/decent/lib/python2.7/site-packages/tensorflow/contrib/decent_q/python/decent_q.py", line 357, in main
s_config)
File "/home/xiangwei/.conda/envs/decent/lib/python2.7/site-packages/tensorflow/contrib/decent_q/python/decent_q.py", line 329, in quantize
return quantize_with_config(input_graph_def, q_config, i_config, s_config)
File "/home/xiangwei/.conda/envs/decent/lib/python2.7/site-packages/tensorflow/contrib/decent_q/python/decent_q.py", line 215, in quantize_with_config
sess.run(output_tensors, feed_dict)
File "/home/xiangwei/.conda/envs/decent/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 900, in run
run_metadata_ptr)
File "/home/xiangwei/.conda/envs/decent/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 1104, in _run
np_val = np.asarray(subfeed_val, dtype=subfeed_dtype)
File "/home/xiangwei/.conda/envs/decent/lib/python2.7/site-packages/numpy/core/numeric.py", line 538, in asarray
return array(a, dtype, copy=False, order=order)
ValueError: setting an array element with a sequence.

Regards,

Louis


I had the same error message, and i just made sure each image was at least greater than 224 for H or W and it worked.

I didn't modify dimensions in the .py files

this topic https://forums.xilinx.com/t5/Deephi-DNNDK/trouble-using-decent-sh/td-p/987651 and a few traces helped me to solve calibration format

vens
Contributor
Contributor
730 Views
Registered: ‎08-31-2019

I encountered the same question this week, and searched a lot on the Internet, and no result. Finally, I fingered out what was wrong, because  the resolution of the 87th figure in ILSVRC2012_img_val dataset is less than 224x224, and the instruction didn't give any clue. As a result, both of us were got into tragedy.