Showing results for 
Search instead for 
Did you mean: 
Registered: ‎09-10-2018

customized for decent_q

I am trying to quantize a CNN network from tensorflow and I am dealing with sensor data, my input data are not images.

I stored the calibration data in NumPy array and I want to feed it to the quantizer with the function but I am confused, how the calib_input function works. This is my

decent_q quantize \
--input_frozen_graph frozen_graph.pb \
--input_nodes input \
--input_shapes ?,20,60,1 \
--output_nodes O \
--input_fn input_fn.calib_input \
--method 1 \
--gpu 0 \
--calib_iter 64 \
--output_dir ./quantize_results \

and this is my

import numpy as np

def calib_input(iter):

inputs = np.expand_dims(data, axis=3) # so the shape of the data is now equal 64 * 20 * 60 * 1

return {"input": inputs}


I get the following error:


File "/home/mehdi/anaconda2/envs/decent/lib/python3.6/site-packages/tensorflow/contrib/decent_q/python/", line 126, in gen_feed_dict
"key {} not found, please check your input_fn.".format(name))
ValueError: key I not found, please check your input_fn.


What is exactly key I ?

1 Reply
Registered: ‎09-10-2018

Re: customized for decent_q

I solved the error.

Actually my frozen graph has some pre-processing that I needed to skip when quantizing. The input of my frozen graph is named "I" (thus the error Key I not found) and the input of the part I want to quantize starts with "input".

Even if the decent_q script needs the input of the part that will be quantized (in this case --input_nodes input ), the must return the data that is fed to the input "I" of the whole graph so should look like:

def calib_input(iter):
#load the data before prerocessing to I
return {"I": inputs}


0 Kudos