element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Eye On Intelligence Challenge
  • Challenges & Projects
  • Design Challenges
  • Eye On Intelligence Challenge
  • More
  • Cancel
Eye On Intelligence Challenge
Blog Person Detection with yolo #7 Integrated DPU with DNNDK - finally
  • Blog
  • Forum
  • Documents
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Eye On Intelligence Challenge to participate - click to join for free!
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: fyaocn
  • Date Created: 6 Dec 2024 2:55 AM Date Created
  • Views 1106 views
  • Likes 6 likes
  • Comments 3 comments
Related
Recommended

Person Detection with yolo #7 Integrated DPU with DNNDK - finally

fyaocn
fyaocn
6 Dec 2024

#7 Integrated DPU with DNNDK - finally

Table of Contents

  • 1 Diversity software toolsets
  • 2 Getting start with Vivado
  • 3  Getting start to Vitis
  • 5 Three Pathway to Eye Intelligence in Arty Z7

1 DNNDK and DPU

Deep learning Processor Unit is developed by Deephi Tech and acquired by Xilinx in 2018. Then it integrated with Vitis AI for fast development. But New version of Vitis AI may not support Arty Z7, so I roll back to previous version of toolset to complete this  blog.  Early version of DPU need DNNDK to bridge the gap of information sharing, so DNNDK shall be installed as well.

2 Getting start with Vivado 2018.3 and create the project

Install previous Vivado 2018.3 

image

Select Zynq 7000 

image

wait for completion.

image

create one vivado project and add DPU IP as design resouces,

image

Now it added in the project

image

source tcl file to create block design with DPU,

image

here is the dpu in the block design

image

After check the design , generate bitstream for hardware and exported hardware design file

image

Then configurate the hardware design files and create petalinux project with petalinux 2018.3, which is compatible with older version of ubuntu .

The petalinux project is built and export to SD image file for DPU to work.

3  Getting start to Pynq 2.5 with DPU 

Insert the SD card and booting the Arty Z7, open putty terminal to supervise the startup process, 

image

DPU is  loaded 

image

check the ipconfig

image

By then, the ether0 is opened for putty SSH to access, first time authentication, for 192.168.1.99

image

login with xilinx account with password xilinx,

image

here is the pynq directory,

image

4 Running the DPU

open the port on browser, login with xilinx

image

running the ipython notebook with resnet50

image

the image classification with resnet50 is running well.

image

With other model like yolo, the model can be built with vitis AI Compiler into binary elf file. The VItis AI compiler can use tensorflow or pytorch, the python code is similar.

Here is the source file for ipython.

img_path = '/home/xilinx/val5000/ILSVRC2012_val_00000020.JPEG'
img = plt.imread(img_path)
plt.imshow(img)
img = cv2.imread(img_path)

KERNEL_CONV = "resnet50_0"
KERNEL_CONV_INPUT = "conv1"
KERNEL_FC_OUTPUT = "fc1000"

# Attach to DPU driver and prepare for runing
n2cube.dpuOpen()
# Create DPU Kernels for ResNet50
kernel = n2cube.dpuLoadKernel(KERNEL_CONV)
# Create DPU Tasks from DPU Kernel
task = n2cube.dpuCreateTask(kernel, 0)
# Get the output tensor channel from FC output
channel = n2cube.dpuGetOutputTensorChannel(task, KERNEL_FC_OUTPUT)

FCResult = [0 for i in range(channel)]
mean = [104,107,123]


# Load image to DPU
dputils.dpuSetInputImage(task, KERNEL_CONV_INPUT, img, mean)
# Model run on DPU
n2cube.dpuRunTask(task)
# Get the output from FC output
n2cube.dpuGetOutputTensorInHWCFP32(task, KERNEL_FC_OUTPUT, FCResult, channel)
# Get the label
label = FCResult.index(max(FCResult))

print(label, wordlist[label])

rtn = n2cube.dpuDestroyKernel(kernel)
n2cube.dpuClose()

The crane is detected 

image

5 Summary

This project show how to deploy the Eye intelligence project in Arty Z7 with DPU. Previous blog show how to detect person with opencv, which is common choice for any edge equipment, but not show the capability of FPGA.

Further work shall dig how to use vitis AI in this Arty Z7.

  • Sign in to reply
  • DAB
    DAB 8 months ago

    Nice update.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • Jan Cumps
    Jan Cumps 8 months ago in reply to bidrohini

    > I think Raspberry pi can do it in an easier way.

    Easier to achieve, but without accelerated hardware support.

    Almost everything is easier to develop on a "Pi in isolation" than on an FPGA with microprocessor SoC.
    But you can't achieve the parallel processing gains on a Pi.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • bidrohini
    bidrohini 8 months ago

    I think Raspberry pi can do it in an easier way.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube