UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Visitor ek9852
Visitor
324 Views
Registered: ‎05-28-2019

Grayscale image input to decent-cpu does not work

Jump to solution

Our model use grayscale (1 channel) as input.

layer {
name: "blob1"
type: "ImageData"
top: "blob1"
top: "label"
include {
phase: TRAIN
}
transform_param {
force_gray: true
mirror: false
}
image_data_param {
source: "./dataset.txt"
batch_size: 50
is_color: false
new_width: 160
new_height: 120
}
}

Even we use is_color=false or "force_gray: true", it still outputing 3 channels data:

decent-cpu quantize -model /tmp/unet.prototxt -weights /tmp/unet.caffemodel -input_blob blob1   -net_type segmentation      

Cannot copy param 0 weights from layer 'conv1'; shape mismatch.  Source param shape is 8 1 3 3 (72); target param shape is 8 3 3 3 (216). To learn this layer's parameters from scratch rather than copying from a saved net, rename the layer.

Without using any dataset for quantitization , the conversion works but  inferening output is incorrect.

0 Kudos
1 Solution

Accepted Solutions
Visitor ek9852
Visitor
195 Views
Registered: ‎05-28-2019

Re: Grayscale image input to decent-cpu does not work

Jump to solution

We just notice there where two v3.0 released (or more than that we don't aware)
The one we ere using is xlnx_dnndk_v3.0_190430.tar.gz.
After upgrade to xlnx_dnndk_v3.0_190531.tar.gz, the problem was resolved.
We still cannot get correct inferencing result, but we will open new ticket for that.
Thanks.

0 Kudos
7 Replies
Xilinx Employee
Xilinx Employee
297 Views
Registered: ‎12-09-2015

Re: Grayscale image input to decent-cpu does not work

Jump to solution

(^^)/

 

What DNNDK tool version are you using? If you are not using DNNDK v3.0, please try it with this release.

Capture.PNG

0 Kudos
Visitor ek9852
Visitor
291 Views
Registered: ‎05-28-2019

Re: Grayscale image input to decent-cpu does not work

Jump to solution

We were  using 3.0:

dnndk_3.0_tools/ubuntu16.04/decent-cpu

0 Kudos
Xilinx Employee
Xilinx Employee
283 Views
Registered: ‎12-09-2015

Re: Grayscale image input to decent-cpu does not work

Jump to solution

(^^)/

 

1. The images are in the same directory as dataset.txt?

2. A calibration dataset is *required* for proper quantization. Please see UG1327 (v1.4) Chapter 6. Improper quantization will result in poor inference.

3. Please add test dataset to confirm proper quantization with the "auto_test" option.

4. Doing an internet search with the keywords, "caffe shape mismatch" may provide some hints. Might be a naming issue.

 

0 Kudos
Visitor ek9852
Visitor
277 Views
Registered: ‎05-28-2019

Re: Grayscale image input to decent-cpu does not work

Jump to solution

> 1. The images are in the same directory as dataset.txt?
Yes. I can find the images for sure:
I0605 19:47:58.075896 28173 image_data_layer.cpp:87] Opening file dataset.txt
I0605 19:47:58.079840 28173 image_data_layer.cpp:102] A total of 1736 images.
I0605 19:47:58.088650 28173 image_data_layer.cpp:130] output data size: 50,3,120,160

2. A calibration dataset is *required* for proper quantization. Please see UG1327 (v1.4) Chapter 6. Improper quantization will result in poor inference.
We tried to use it, but it have problem with grayscale, 1 channel input. Did you test it with 1 channel input instead of 3 channels input ?

3. Please add test dataset to confirm proper quantization with the "auto_test" option.
I repeated again, decent-cpu failed to convert the model with grayscale image.

4. Doing an internet search with the keywords, "caffe shape mismatch"
Becuase your convertor tools assume the input image is always with 3 channels and pass to it. While our model is using 1 channel as input. So (8 1 3 3) does not matched with (8 3 3 3)

Cannot copy param 0 weights from layer 'conv1'; shape mismatch.  Source param shape is 8 1 3 3 (72); target param shape is 8 3 3 3 (216). To learn this layer's parameters from scratch rather than copying from a saved net, rename the layer.

0 Kudos
Contributor
Contributor
254 Views
Registered: ‎04-10-2019

Re: Grayscale image input to decent-cpu does not work

Jump to solution

The DNNDK User Guide (ug1327) never says that DECENT doesn't support grayscale. But on page 46, it has a note under the figure that says:

Note: Only the 3-mean-value format is supported by DECENT. Convert to the 3-mean-value format as required.

If it only supports 3-channels for centering around the mean, I suppose it's possible that 3-channels are all that is supported by the tool.

But that's speculation. A Xilinx employee would have to confirm.

0 Kudos
Visitor ek9852
Visitor
196 Views
Registered: ‎05-28-2019

Re: Grayscale image input to decent-cpu does not work

Jump to solution

We just notice there where two v3.0 released (or more than that we don't aware)
The one we ere using is xlnx_dnndk_v3.0_190430.tar.gz.
After upgrade to xlnx_dnndk_v3.0_190531.tar.gz, the problem was resolved.
We still cannot get correct inferencing result, but we will open new ticket for that.
Thanks.

0 Kudos
Xilinx Employee
Xilinx Employee
166 Views
Registered: ‎11-29-2007

Re: Grayscale image input to decent-cpu does not work

Jump to solution

Quick update on this post

The bug was fixed in latest release, please use xlnx_dnndk_v3.0_190531

Regarding inferencing problems, if you mean the need to scale to a new range and the HWC channel format, I think also these points were clarified by the Customer. Thanks Keith for your feedback!