cancel
Showing results for 
Search instead for 
Did you mean: 
302 Views
Registered: ‎07-12-2019

DNNDK-decent-caffe questions about quantization

Hello everyone, I have a question about quantizing floating-point model and weights with the help of decent, dnndk.

My operations and its results are shown here.

I can't make sure whether it is well-done, and I can't find any output file, so I doubt that there is something wrong.

It's my first time to learn dnndk, and I will be very grateful to you for answering my questions!!!

1.png2.png3.png

0 Kudos
1 Reply
Highlighted
Xilinx Employee
Xilinx Employee
258 Views
Registered: ‎02-17-2011

Re: DNNDK-decent-caffe questions about quantization

Hi @liuyang151617 ,

What you are showing in the screenshot below is the help output of decent.  I think maybe in the command line you added a parameter that isn't quite right (weights_bit).  Generally, you don't need to add the weights_bit parameter - it should automatically quantize to 8 bit.  Otherwsie your command line should be ok (you can check the example command lines output in the help as well for examples).  

You also need to have calibration images for the quantization process and you need to ensure that your prototxt points to these as well as the calibration.txt as part of the the input layer.  The calibration.txt file just needs to list the image names along with a number in the right column (it can just be '0' for each entry).  I've attached an example here for reference from the SSD tutorial.

Our edge AI tutorials include information on this as well as the DNNDK user guide:

 

https://github.com/Xilinx/Edge-AI-Platform-Tutorials

https://www.xilinx.com/support/documentation/user_guides/ug1327-dnndk-user-guide.pdf

 

Here are a couple examples:

For Detection:

name: "VGG_VOC0712_SSD_300x300_train"
layer {
name: "data"
type: "ImageData"
top: "data"
top: "label"
include {
phase:TRAIN
}
transform_param {
crop_size: 300
mean_value: 104.0
mean_value: 117.0
mean_value: 123.0
resize_param {
prob: 1.0
resize_mode: WARP
height: 300
width: 300
interp_mode: LINEAR
interp_mode: AREA
interp_mode: NEAREST
interp_mode: CUBIC
interp_mode: LANCZOS4
}
}
image_data_param {
source: "./data/imagenet_320/calibration.txt"
root_folder:"./data/imagenet_320/calibration_images/"
batch_size: 10
shuffle: true
}
}

 

For Segmentation:

layer {
name: "data"
type: "ImageData"
top: "data"
top: "label"
include {
phase:TRAIN
}
image_data_param {
source: "../data/cityscapes/calibration.txt"
root_folder:"../data/cityscapes/calibration_images/"
batch_size: 1
new_height: 1024
new_width: 2048
shuffle: true
}
transform_param {
mean_value: 73
mean_value: 82
mean_value: 72
scale: 0.022
 
resize_param {
prob: 1.0
resize_mode: WARP
height: 1024
width: 2048
}
}
}
 
Thanks and hope this helps,
-JC
0 Kudos