cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Jerry_Wang
Contributor
Contributor
462 Views
Registered: ‎08-15-2020

quantizing problem

Jump to solution

Dear Staff,

Hello, I am quantizing my customized CNN model by Vitis-ai quantizer, however, it reports the error as following:

1.jpg

it seems like the quantizer misread my frozen model because it should be this for my max_pooling2d_1 layer:

2.jpg

 how can it get an input of (512,1,32)? 

I also evaluate my frozen model, it can run the model properly.

Can anyone help with this? Thank you very much!

The attached file is my frozen pb file

0 Kudos
1 Solution

Accepted Solutions
jbeckwi
Xilinx Employee
Xilinx Employee
334 Views
Registered: ‎08-30-2011

That's correct.  I created a quantizer input file with random numpy data and passed that to the quantizer and it worked.

 

data=np.random.rand(100,512,4,1)

def calib_input(iter):

  data_out=data[iter]

  data_out=data_out.reshape(1,512,4,1)

  return {"input":data_out}

 

Then specify this calib_input as the input function when you call the quantizer

View solution in original post

3 Replies
jbeckwi
Xilinx Employee
Xilinx Employee
388 Views
Registered: ‎08-30-2011

Take a look at the documentation around the quantizer, specifically the input function.  Although I can't test for accuracy I was able to get the quantizer to run by creating an input function that uses a (100, 512, 4, 1) numpy array of random data, based on the template and examples below:

 

https://www.xilinx.com/html_docs/vitis_ai/1_2/tensorflowversion.html#xuy1576231723436

https://github.com/Xilinx/Vitis-AI-Tutorials/blob/CIFAR10-Classification-with-TensorFlow/files/image_input_fn.py

 

0 Kudos
Jerry_Wang
Contributor
Contributor
360 Views
Registered: ‎08-15-2020

do you mean this (100,512,4,1) input can run successfully for my pb file?

0 Kudos
jbeckwi
Xilinx Employee
Xilinx Employee
335 Views
Registered: ‎08-30-2011

That's correct.  I created a quantizer input file with random numpy data and passed that to the quantizer and it worked.

 

data=np.random.rand(100,512,4,1)

def calib_input(iter):

  data_out=data[iter]

  data_out=data_out.reshape(1,512,4,1)

  return {"input":data_out}

 

Then specify this calib_input as the input function when you call the quantizer

View solution in original post