cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
539 Views
Registered: ‎01-07-2013

Resnet50 incorrect result

I am using Vivado 2019.1.1. I pulled the latest version of the Edge-AI-Platform-Tutorial (Before they were taken offline). I built a block design that incorporated the DPU v2.0 (1 DPU Core, B1152, Low RAM usage, ReLU + LeakyReLU + ReLU6, 1 SFM core). I am running the design on the Ultrazed-EV SOM. So the FPGA is a XCZU7EV. I built this design, exported the hardware, created the Petalinux 2019.1 project, I configured the root FS with the necessary packages, added the app recipe for DNNDK v3.0, added the module recipe for the DPU driver, added the DPU to the device tree like this:

&amba{
	dpu{
		compatible = "xilinx,dpu";
		base-addr = <0x80000000>;

		dpucore {
			compatible = "xilinx,dpucore";
			interrupt-parent = <&gic>;
			interrupts = <0x0 91 0x4>;
			core-num = <0x1>;
		};

		softmax {
			compatible = "xilinx,smfc";
			interrupt-parent = <&gic>;
			interrupts = <0x0 92 0x4>;
			core-num = <0x1>;
		};
	};
};

I also had to patch the kernel to increase the max size of the TLB buffer.

I built, packaged, and copied the Petalinux generated files to my SD Card. I built the SDK. I created application projects for face_detect and resnet50. I was able to build the code and copy the .elf files over to the device. I copied the word_list.txt file and the image directory from this location in the repository:

Edge-AI-Platform-Tutorials/docs/DPU-Integration/reference-files/sdcard/resnet50

dexplorer gives me:

# dexplorer -v
DNNDK version  3.0
Copyright @ 2018-2019 Xilinx Inc. All Rights Reserved.

DExplorer version 1.5
Build Label: Apr 25 2019 09:53:22

DSight version 1.4
Build Label: Apr 25 2019 09:53:22

N2Cube Core library version 2.3
Build Label: Apr 25 2019 09:53:36

DPU Driver version 2.2.0
Build Label: Feb  6 2020 16:13:15

# dexplorer -w
[DPU IP Spec]
IP  Timestamp   : 2020-02-05 10:00:00
DPU Core Count  : 1

[DPU Core List]
DPU Core        : #0
DPU Enabled     : Yes
DPU Arch        : B1152F
DPU Target      : v1.4.0
DPU Freqency    : 325 MHz
DPU Features    : Avg-Pooling, LeakyReLU/ReLU6, Depthwise Conv

[DPU Extension List]
Extension Softmax
Enabled         : Yes

What I see in dmesg seems to look good:

# dmesg | grep -i dpu
[   14.850678] [DPU][2228]Found DPU signature addr = 0x80000000 in device-tree
[   14.857646] [DPU][2228]Checking DPU signature at addr = 0x80f00000, 
[   14.864048] [DPU][2228]DPU signature checking done!
[   14.869442] [DPU][2228]Init SMFC IP...
[   14.873219] [DPU][2228]Request SMFC IRQ 57 successful.
[   14.873224] [DPU][2228]Init SMFC IP done

But when I run resnet50.elf I get the wrong answer:

# ./resnet50.elf 

####################################################
Warning:                                            
The DPU in this TRD can only work 8 hours each time!
Please consult Sales for more details about this!   
####################################################

total image : 10

Load image: airplane1.png
[Top 0] prob = 0.005249  name = stinkhorn, carrion fungus,
[Top 1] prob = 0.005249  name = valley, vale,
[Top 2] prob = 0.005249  name = meat loaf, meatloaf,
[Top 3] prob = 0.005249  name = mushroom,
[Top 4] prob = 0.005249  name = French loaf,

Load image: airplane1.png
[Top 0] prob = 0.005249  name = stinkhorn, carrion fungus,
[Top 1] prob = 0.005249  name = valley, vale,
[Top 2] prob = 0.005249  name = meat loaf, meatloaf,
[Top 3] prob = 0.005249  name = mushroom,
[Top 4] prob = 0.005249  name = French loaf,

Load image: airplane1.png
[Top 0] prob = 0.005249  name = stinkhorn, carrion fungus,
[Top 1] prob = 0.005249  name = valley, vale,
[Top 2] prob = 0.005249  name = meat loaf, meatloaf,
[Top 3] prob = 0.005249  name = mushroom,
[Top 4] prob = 0.005249  name = French loaf,

Load image: airplane1.png
[Top 0] prob = 0.005249  name = stinkhorn, carrion fungus,
[Top 1] prob = 0.005249  name = valley, vale,
[Top 2] prob = 0.005249  name = meat loaf, meatloaf,
[Top 3] prob = 0.005249  name = mushroom,
[Top 4] prob = 0.005249  name = French loaf,

Load image: ship1.png
[Top 0] prob = 0.005250  name = stinkhorn, carrion fungus,
[Top 1] prob = 0.005250  name = valley, vale,
[Top 2] prob = 0.005250  name = meat loaf, meatloaf,
[Top 3] prob = 0.005250  name = mushroom,
[Top 4] prob = 0.005250  name = French loaf,

Load image: bird1.png
[Top 0] prob = 0.005132  name = stinkhorn, carrion fungus,
[Top 1] prob = 0.005132  name = valley, vale,
[Top 2] prob = 0.005132  name = meat loaf, meatloaf,
[Top 3] prob = 0.005132  name = mushroom,
[Top 4] prob = 0.005132  name = French loaf,

Load image: deer1.png
[Top 0] prob = 0.005075  name = stinkhorn, carrion fungus,
[Top 1] prob = 0.005075  name = valley, vale,
[Top 2] prob = 0.005075  name = meat loaf, meatloaf,
[Top 3] prob = 0.005075  name = mushroom,
[Top 4] prob = 0.005075  name = French loaf,

Load image: truck4.png
[Top 0] prob = 0.005112  name = stinkhorn, carrion fungus,
[Top 1] prob = 0.005112  name = valley, vale,
[Top 2] prob = 0.005112  name = meat loaf, meatloaf,
[Top 3] prob = 0.005112  name = mushroom,
[Top 4] prob = 0.005112  name = French loaf,

Load image: frog4.png
[Top 0] prob = 0.005248  name = stinkhorn, carrion fungus,
[Top 1] prob = 0.005248  name = valley, vale,
[Top 2] prob = 0.005248  name = meat loaf, meatloaf,
[Top 3] prob = 0.005248  name = mushroom,
[Top 4] prob = 0.005248  name = French loaf,

Load image: dog1.png
[Top 0] prob = 0.005096  name = stinkhorn, carrion fungus,
[Top 1] prob = 0.005096  name = valley, vale,
[Top 2] prob = 0.005096  name = meat loaf, meatloaf,
[Top 3] prob = 0.005096  name = mushroom,
[Top 4] prob = 0.005096  name = French loaf,

Load image: automobile1.png
[Top 0] prob = 0.005250  name = stinkhorn, carrion fungus,
[Top 1] prob = 0.005250  name = valley, vale,
[Top 2] prob = 0.005250  name = meat loaf, meatloaf,
[Top 3] prob = 0.005250  name = mushroom,
[Top 4] prob = 0.005250  name = French loaf,

Load image: cat2.png
[Top 0] prob = 0.005233  name = stinkhorn, carrion fungus,
[Top 1] prob = 0.005233  name = valley, vale,
[Top 2] prob = 0.005233  name = meat loaf, meatloaf,
[Top 3] prob = 0.005233  name = mushroom,
[Top 4] prob = 0.005233  name = French loaf,

Load image: horse1.png
[Top 0] prob = 0.005248  name = stinkhorn, carrion fungus,
[Top 1] prob = 0.005248  name = valley, vale,
[Top 2] prob = 0.005248  name = meat loaf, meatloaf,
[Top 3] prob = 0.005248  name = mushroom,
[Top 4] prob = 0.005248  name = French loaf,
[Time]439811us
[FPS]22.737

####################################################
Warning:                                            
The DPU in this TRD can only work 8 hours each time!
Please consult Sales for more details about this!   
####################################################

Any help is appreciated!

0 Kudos
4 Replies
jasonwu
Moderator
Moderator
530 Views
Registered: ‎03-27-2013

Hi dustin.nicholes@gmail.com ,

 

Are you using TensorFlow to train the model?

Here is an example about how to deploy resnet on ZCU102:

https://www.xilinx.com/support/answers/72804.html

You can take this as a reference.

I would suggest you to use the same version of IP/driver/DNNDK tools as used in that AR.

Since VAI 1.0 can't support pure Vivado flow.

I think you can try with 2019.1 version Vivado+PetaLinux and DNNDK 3.1.

Best Regards,
Jason
-----------------------------------------------------------------------------------------------
Please mark the Answer as "Accept as solution" if the information provided is helpful.

Give Kudos to a post which you think is helpful and reply oriented.
-----------------------------------------------------------------------------------------------
0 Kudos
483 Views
Registered: ‎01-07-2013

I haven't gotten that far. I am just trying to walk through the DPU Integration tutorial. I am using the pre-trained model from here:

https://github.com/Xilinx/Edge-AI-Platform-Tutorials/tree/83a4e9d0810daba6bcc011fe9a6c2ec911b70469/docs/DPU-Integration/reference-files/files/resnet50/B1152_1.4.0

 

0 Kudos
iordanouk
Observer
Observer
380 Views
Registered: ‎12-19-2017

Hi,

I am facing the same problem on zedboard. I am working on DNNDK 3.1

and I am using the pre-trained model as provided in the examples.

The drivers and the DPU seems ok according to the manual, but the result

from resnet is always the same in every image...

Any update on that issue?

0 Kudos
dvukadin
Participant
Participant
114 Views
Registered: ‎07-19-2018

Hi everyone,

I also have issues with resnet50 results.

Currently, I am testing models provided by Xilinx on demo zcu104_dpu prebuilt image 2020.2 with Vitis AI 1.3.

Resnet50 returns wrong and different results each time when I run classification for the same image:

 

root@xilinx-zcu104-2020_2:/usr/share/vitis_ai_library/demo/classification# ./demo_classification /usr/share/vitis_ai_library/models/res
net50/resnet50.xmodel resnet_50_0 /usr/share/vitis_ai_library/samples/classification/images/001.png                                    
batch_index 0 image_name /usr/share/vitis_ai_library/samples/classification/images/001.png                                             
score[553] = 0.975547                                                                                                                  
score[771] = 0.0108373                                                                                                                 
score[760] = 0.00188325                                                                                                                
score[478] = 0.00188325                                                                                                                
score[794] = 0.00114225                                                                                                                
bye                                                                                                                                    
root@xilinx-zcu104-2020_2:/usr/share/vitis_ai_library/demo/classification# ./demo_classification /usr/share/vitis_ai_library/models/res
net50/resnet50.xmodel resnet_50_0 /usr/share/vitis_ai_library/samples/classification/images/001.png                                    
batch_index 0 image_name /usr/share/vitis_ai_library/samples/classification/images/001.png                                             
score[553] = 0.607466                                                                                                                  
score[771] = 0.368447                                                                                                                  
score[507] = 0.0183439                                                                                                                 
score[760] = 0.00193343                                                                                                                
score[478] = 0.000913289                                                                                                               
bye  

 

How is it possible? This happens also for other classification models.

 

Regards,

dvukadin

0 Kudos