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: 
Visitor daedeepya.y
Visitor
1,000 Views
Registered: ‎10-16-2018

Error when running the object detection SSD model

Hi,

 

I am trying to run the Object detection SSD caffe model on Deephi DNNK using a ZCU102 board. But I get the following error when I run the compiler(./dnnc),

 

Compiling network: ObjectDetection
[DNNC][Error] Unrecognized layer type [Normalize], Maybe you can delete it in deploy.prototxt and try again.
[DNNC][Error] Parsing layer graph failed.

 

When I try deleting this layer from the deploy.prototxt file, I get the following error,

 

Compiling network: ObjectDetection
[DNNC][Error] Unrecognized layer type [Reshape], Maybe you can delete it in deploy.prototxt and try again.
[DNNC][Error] Parsing layer graph failed.

 

After deleting the reshape layer, I still get the following error,

 

Compiling network: ObjectDetection
[DNNC][Warning] layer [mbox_conf_softmax] is not supported in DPU, deploy it in CPU instead.
4: 1-0-11 Field is too long!
./dnnc_mobilenet.sh: line 13: 31155 Aborted                 (core dumped) dnnc --prototxt=${model_dir}/deploy.prototxt --caffemodel=${model_dir}/deploy.caffemodel --output_dir=${output_dir} --net_name=${net} --dpu=4096FA --cpu_arch=arm64

 

Are the Normalize and Reshape caffe layers not supported? Also, what does field too long mean?

 

Thank you for all the assistance,

Daedeepya Y

 

0 Kudos
7 Replies
Visitor dsskjelb
Visitor
873 Views
Registered: ‎11-01-2018

Re: Error when running the object detection SSD model

I have the same issue - any updates here? It would be great to test out other algorithms on the DeePhi platform, but having issues like this one when I try.

0 Kudos
Visitor lixun123
Visitor
841 Views
Registered: ‎09-29-2018

Re: Error when running the object detection SSD model

Hi!

      I have the same problem. Have you solved this problem?Can you tell me how to solve it?

Thans!

0 Kudos
Xilinx Employee
Xilinx Employee
821 Views
Registered: ‎02-17-2011

Re: Error when running the object detection SSD model

You'll need to replace the Normalize layer with BatchNorm and Scale layers because the DPU does not support Normalize. In the original SSD model, this is usually called "conv4_3_norm".

The following steps can be used to replace the layer:

1) Delete the Normalize layer named "conv4_3_norm" 

2) Insert the Batchnorm layer and scale layer between "conv4_3" and "relu4_3" layers. The layers should look something like this:

layer{
name: "conv4_3_bn"
type: "BatchNorm"
bottom: "conv4_3"
top: "conv4_3"
param {
lr_mult:0
decay_mult:0
}
param{
lr_mult:0
decay_mult:0
}
param{
lr_mult:0
decay_mult:0
}
}
layer{
name:"conv4_3_scale"
type: "Scale"
bottom:"conv4_3"
top: "conv4_3"
param{
lr_mult:1
decay_mult:0
}
param{
lr_mult:1
decay_mult:0
}
scale_param{
bias_term:true
}
}

3) now you'll need to rename the connections on the other layers for bottom: "conv4_3_norm"  to bottom: "conv4_3"

4) the reshape layer should have the following parameter included in it (during training)

include{
phase:TEST
}

5) The last 5 layers of the SSD model should have the same parameter so that they are not included in the trained model.  These include mbox_conf_reshape (Reshape), mbox_conf_softmax (Softmax), mbox_conf_flatten (Flatten), detection_out (DetectionOutput), and detection_eval (DetectionEvaluate) which 

 

6)  After making these modifications, you'll need to retrain the model because they make structural changes to the .caffemodel.

The resultant prototxt and caffemodel should be usable by DNNDK.

0 Kudos
Visitor dsskjelb
Visitor
798 Views
Registered: ‎11-01-2018

Re: Error when running the object detection SSD model

Hi,

Thanks for guidance - re-training makes sense. I just wondered if it is correct to have the same name for top and bottom in the Batchnorm and Scale layers as you have in step 2? 

0 Kudos
Xilinx Employee
Xilinx Employee
778 Views
Registered: ‎02-17-2011

Re: Error when running the object detection SSD model

Yes, this should be the correct configuration of these layers.  Please follow up with a post to let us know if this works for you!

 

Thanks,

JC

 

0 Kudos
Visitor dsskjelb
Visitor
770 Views
Registered: ‎11-01-2018

Re: Error when running the object detection SSD model

Thanks - yes I think it works as you describe it; at least the decent tool manages to do quantization and pruning. I tried to do this on googlenet rather than an SSD algorithm right now - and after replacing Normalize with BatchNorm and Scale, I get this error from the DNNC compiler (version v2.03) :

dnnc version v2.03
DPU Target : v1.3.0
Build Label: Dec 11 2018 11:52:13
Copyright @2018 Xilinx Inc. All Rights Reserved.

dnnc --prototxt=quantize_results/deploy.prototxt --caffemodel=quantize_results/deploy.caffemodel --net_name=googlenet --dpu=4096FA --cpu_arch=arm64 --output_dir=dnnc_output --dump=all
[DNNC][Warning] Only max pooling is supported, but [pool5_7x7_s1] layer has average pooling type.
[DNNC][Warning] layer [pool5_7x7_s1] is not supported in DPU, deploy it in CPU instead.
[DNNC][Warning] layer [prob] is not supported in DPU, deploy it in CPU instead.
[DNNC][Error] Failed to find available backend optimization pattern for current layer [pool2_bn].

The layer it complains about is the Normalize and Scale layer - snipping out surrounding code in quantized deploy.prototxt here : 

layer {
name: "conv2/relu_3x3"
type: "ReLU"
bottom: "conv2/3x3"
top: "conv2/3x3"
phase: TRAIN
}
layer {
name: "pool2/bn"
type: "Scale"
bottom: "conv2/3x3"
top: "conv2/3x3"
param {
lr_mult: 1
decay_mult: 1
}
param {
lr_mult: 1
decay_mult: 0
}
phase: TRAIN
scale_param {
bias_term: true
}
}
layer {
name: "pool2/3x3_s2"
type: "Pooling"
bottom: "conv2/3x3"
top: "pool2/3x3_s2"
phase: TRAIN
pooling_param {
pool: MAX
kernel_size: 3
stride: 2
}
}

0 Kudos
Xilinx Employee
Xilinx Employee
758 Views
Registered: ‎02-17-2011

Re: Error when running the object detection SSD model

I think we generally insert the batchnorm/scale combination in between the convolutional and relu layers.  It's hard to tell from the code snippet where this was inserted.

A second note is that when deploying inception_v1, I believe scale layer is not used with batchnorm.  I believe something like the following will be used to directly replace the Normalize layer where "conv2/3x3_raw" is the top connection for conv2/3x3 convolution layer:

 

layer{

name: "conv2/3x3_BN"

type: "BatchNorm"

bottom:"conv2/3x3_raw"

top:"conv2/3x3"

param {

lr_mult:1

decay_mult:0

}

param {

lr_mult:1

decay_mult:0

}

param {

lr_mult:0

decay_mult:0

}

param {

lr_mult:0

decay_mult:0

}

batch_norm_param {

scale_filler {

type: "constant"
value: 1

}

bias_filler{

type: "constant"

value:0

}

}

}