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: 
Xilinx Employee
Xilinx Employee
436 Views
Registered: ‎03-27-2013

DNNDK flow: A simple example about how to train a custom model with TensorFlow and deploy it on ZCU102

Hello All,

 

Here is an simple example about how to train a custom model with TensorFlow and deploy it on ZCU102 with DNNDK.

https://github.com/gewuek/flower_classification_dnndk_v1

I have tested the whole flow with Ubuntu 18.04 + DNNDK 3.1 + Vivado 2019.1 + PetaLinux 2019.1

It is quite simple that you could run all the scripts in half an hour.

To make it easier I just make my model ovefit the dataset. All the training/validation/calibration data are just from the same dataset.

I just use the numpy array as data input and OpenCV functions to open images during model training so that the code for quantization and deployment would be simple. I would try to create a new repository to deliver an example using tf.data.Dataset later. That would take some time. :-)

The design has a lot of actions with third party tools so I just update it to a personal repository and would provide support personally.

I am a new guy for github release and TensorFlow. So any suggestions would be very appreciated.

Please feel free to post or contact me by private message.

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.
-----------------------------------------------------------------------------------------------
9 Replies
Xilinx Employee
Xilinx Employee
353 Views
Registered: ‎03-27-2013

Re: DNNDK flow: A simple example about how to train a custom model with TensorFlow and deploy it on ZCU102

Here comes the tf.data.Dataset version:

https://github.com/gewuek/flower_classification_dnndk_v2

:-)

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
Observer qwqw0001
Observer
279 Views
Registered: ‎07-15-2019

Re: DNNDK flow: A simple example about how to train a custom model with TensorFlow and deploy it on ZCU102

hi @jasonwu 

   It's a good share. And how do you deploy it to hardware?Can you explain the steps on vivado and petalinux?Thanks.

   ylh

Tags (1)
0 Kudos
Xilinx Employee
Xilinx Employee
272 Views
Registered: ‎03-27-2013

Re: DNNDK flow: A simple example about how to train a custom model with TensorFlow and deploy it on ZCU102

Hi @qwqw0001 ,

 

Thanks for your feedback. It can run on ZCU102 TRD image. And if you mean create your own DPU design and create PetaLinux platform.

Maybe this webpage can help: https://github.com/Xilinx/Edge-AI-Platform-Tutorials/tree/master/docs/DPU-Integration

Make sure you use all the files(IP/drvier module/packages and so on) in ZCU102 TRD design instead.

Please feel free to comment if you have any concern on that. :-)

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
Observer qwqw0001
Observer
199 Views
Registered: ‎07-15-2019

Re: DNNDK flow: A simple example about how to train a custom model with TensorFlow and deploy it on ZCU102

hi @jasonwu 

    Thanks for your reply,and I have tried it. I just want to familiarize myself with the process. So,I directly got BOOT.BIN and image.ub from zcu102-dpu-trd-2019-1-190809.zip and copy them into my card. Then I copy  flower-classification into my card. I can get into the system by zcu102,but when I make it, it tells me "-sh :make:command not found." Is there something wrong with me?

     Looking forward to your reply.

     ylh

Tags (1)
0 Kudos
Xilinx Employee
Xilinx Employee
166 Views
Registered: ‎03-27-2013

Re: DNNDK flow: A simple example about how to train a custom model with TensorFlow and deploy it on ZCU102

Hi @qwqw0001 ,

 

Not all the images enable the self-host package in PetaLinux. If you would like to use pre-build image to build application on board I would suggest you to use:

Main page: https://www.xilinx.com/products/design-tools/ai-inference/ai-developer-hub.html

SD card image:https://www.xilinx.com/member/forms/download/zcu102-image-license-xef.html?filename=petalinux-user-image-zcu102-zynqmp-sd-20190802.img.gz

As I know this image has compiling environment installed. But you may need to install DNNDK package manually according to the DNNDK user guide.

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
Observer qwqw0001
Observer
156 Views
Registered: ‎07-15-2019

Re: DNNDK flow: A simple example about how to train a custom model with TensorFlow and deploy it on ZCU102

hi @jasonwu 

    Thank you for your advice , and I've tried this image when I can't make . I also encountered some problems in this image. I download the Etcher according to the instructions , and flash the SD card. When I boot the board ,  it is an error:

[ 6.023283] CPU features: 0x0,20802004

[ 6.027015] Memory Limit: none

[ 6.030058] ---[ end Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(179,2) ]---

   I tried to find out if anyone else had the problem:

https://forums.xilinx.com/t5/Machine-Learning/Where-is-correct-img-file-for-ZCU104/m-p/946841

https://forums.xilinx.com/t5/Machine-Learning/How-to-running-DNNDK-example-ZCU102/m-p/944110?advanced=false&collapse_discussion=true&filter=location&location=forum-board:Deephi&search_type=thread

  Unable to access the system through zcu102, I changed the fstab file on the PC side to mount it.But I can't do this step  because I can't get into the system:Execute “mount” to confirm that mmcblk0p1 auto-mounted at boot. The same mistake happened again and the MD5 for image is correct. 

  Now I don't know what to do. Maybe I should build a new image by myself and Is it ok to follow him exactly? https://github.com/Xilinx/Edge-AI-Platform-Tutorials/tree/master/docs/DPU-Integration

  Looking forward to your reply.

  ylh

Tags (1)
0 Kudos
Xilinx Employee
Xilinx Employee
139 Views
Registered: ‎03-27-2013

Re: DNNDK flow: A simple example about how to train a custom model with TensorFlow and deploy it on ZCU102

Hi @qwqw0001 ,

 

To be honest I have tired to burn SD card with Etcher(On Win10) but I haven't meet this issue before.

Here is a Xilinx WIKI about how to configure SD card manually: https://xilinx-wiki.atlassian.net/wiki/spaces/A/pages/18842385/How+to+format+SD+card+for+SD+boot

Maybe you can try to add some manual operations like format the whole SD card with Fat32 and use Etcher to burn the image again and check if it can work.

And for the second question, yes. You can try to create your own IPI/PetaLinux design with that webpage, make sure you use 2019.1 TRD files instead. And I have tested my code on that image too.

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
Observer qwqw0001
Observer
128 Views
Registered: ‎07-15-2019

Re: DNNDK flow: A simple example about how to train a custom model with TensorFlow and deploy it on ZCU102

hi @jasonwu ,

   Ok, thanks for your advice. I have formated the whole SD card with Fat32 or Fat32 and ext4, but It was the same . Because,you know , whatever you formate , the Etcher or Win32DiskImager will format the SD card with Fat32 and ext4 in a very small space and leave a lot of unallocated space.  Although I'm using Windows 7, I don't think this will affect flash the image. If I have the chance, I will try a win10. Now  I will try to create myself image. Thanks again for your help.

   ylh

   

Tags (1)
0 Kudos
Xilinx Employee
Xilinx Employee
90 Views
Registered: ‎03-27-2013

Re: DNNDK flow: A simple example about how to train a custom model with TensorFlow and deploy it on ZCU102

Hi @qwqw0001 ,

 

Please go ahead to test the DPU intergration flow it is good for you to understand the HW/SW arch of a DPU based ML design. And please let me know if you meet any problem(Create a new post is recommended).

In the worst situation I can try to create a 2019.1 ZCU102 bsp for you. Good luck!

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