Xilinx / Vitis-AI

Vitis AI is Xilinx’s development stack for AI inference on Xilinx hardware platforms, including both edge devices and Alveo cards.
https://www.xilinx.com/ai
Apache License 2.0
1.48k stars 627 forks source link

about vai_q_caffe problem #17

Closed akioolin closed 4 years ago

akioolin commented 4 years ago

Hi, I try to use vai_q_caffe to do a caffe model quantization. the final message is W1219 00:02:05.692003 91 convert_proto.cpp:1401] [DEPLOY WARNING] Layer data's output blob is all zero, this may cause error for DNNC compiler. Please check the float model. I1219 00:02:05.696166 91 decent_q.cpp:399] Deploy Done!

Does this will has some side effect?

BR, Akio

jimheaton commented 4 years ago

Yes,

You do need to fix this.

I just ran into the exact same error message yesterday. In my case I was not properly pointing to the calibration images. You will typically need to edit your prototext file in order to quantize.

Here’s an example of what I had to do for tiny yolo:

[cid:image001.jpg@01D5B677.5928D7B0]

Thanks, Jim

From: akioolin notifications@github.com Sent: Thursday, December 19, 2019 12:05 AM To: Xilinx/Vitis-AI Vitis-AI@noreply.github.com Cc: Subscribed subscribed@noreply.github.com Subject: [Xilinx/Vitis-AI] about vai_q_caffe problem (#17)

EXTERNAL EMAIL

Hi, I try to use vai_q_caffe to do a caffe model quantization. the final message is W1219 00:02:05.692003 91 convert_proto.cpp:1401] [DEPLOY WARNING] Layer data's output blob is all zero, this may cause error for DNNC compiler. Please check the float model. I1219 00:02:05.696166 91 decent_q.cpp:399] Deploy Done!

Does this will has some side effect?

BR, Akio

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/Xilinx/Vitis-AI/issues/17?email_source=notifications&email_token=AA7KL772CDQOSJ7NHQAUTQTQZMTI5A5CNFSM4J464342YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4IBR7PVA, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AA7KL744FDWLT5HZYB4PB7TQZMTI5ANCNFSM4J46434Q.

akioolin commented 4 years ago

@jimheaton Thank you very much. for calibration images, where do I find the proper setting for vai_q_caffe to get these images for calibration?

BR, Akio

jimheaton commented 4 years ago

The calibration images are reference in the prototext file, and the vai_q_caffe quantizer will then read them in.

What type of model do you want to quantize? Typically you would use a subset of your validation images from training.

For our resenet50 examples we imagenet.

Regards, Jim

From: akioolin notifications@github.com Sent: Thursday, December 19, 2019 9:14 PM To: Xilinx/Vitis-AI Vitis-AI@noreply.github.com Cc: Jim Heaton jheaton@xilinx.com; Mention mention@noreply.github.com Subject: Re: [Xilinx/Vitis-AI] about vai_q_caffe problem (#17)

EXTERNAL EMAIL

@jimheatonhttps://github.com/jimheaton Thank you very much. for calibration images, where do I find the proper setting for vai_q_caffe to get these images for calibration?

BR, Akio

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/Xilinx/Vitis-AI/issues/17?email_source=notifications&email_token=AA7KL752DH4GF2IFBAGDNSTQZRIB7A5CNFSM4J464342YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEHL4Z3A#issuecomment-567790828, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AA7KL74WBBFH36N66JS64X3QZRIB7ANCNFSM4J46434Q.

jimheaton commented 4 years ago

@akioolin Here is my example prototxt showing @reference to calibration images. `name: "Darkent2Caffe"

input: "data"

input_dim: 1

input_dim: 3

input_dim: 416

input_dim: 416

Change input data layer to COCO validation images

layer { name: "data" type: "ImageData" top: "data" top: "label" include { phase: TRAIN } transform_param { mirror: false yolo_height:416 #change height according to Darknet model yolo_width:416 #change width according to Darknet model } image_data_param { source: "calib.txt" #list of calibration imaages
root_folder: "../darknet/data/coco/images/val2014/" #path to calibartion images

batch_size: 1
shuffle: false

} }

No changes to the below layers

layer { bottom: "data" top: "layer0-conv" name: "layer0-conv" type: "Convolution" convolution_param { num_output: 16 kernel_size: 3 pad: 1 stride: 1 bias_term: false } }`

akioolin commented 4 years ago

@jimheaton Thank you very much!!! the key field name is the following, image_data_param { source: "calib.txt" #list of calibration imaages root_folder: "../darknet/data/coco/images/val2014/" #path to calibartion images batch_size: 1 shuffle: false }

I'll try to add this setting in my caffe prototxt file.

BR,Akio

qianglin-xlnx commented 4 years ago

Hi @akioolin I wonder if you have solved this issue. If not, I will submit this issue to the engineer in charge of it. If it has been resolved, please close this issue. Note that if we do not receive any reply from you within 2 weeks, we will assume that this issue has been resolved and will close this issue. Thank you.