使用Vivado和PetaLinux 2019.2的Ultra96 v1 ResNet-50例程

2024-05-24 07:32

本文主要是介绍使用Vivado和PetaLinux 2019.2的Ultra96 v1 ResNet-50例程,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

使用Vivado和PetaLinux 2019.2的Ultra96 v1 ResNet-50例程

Vivado步骤

Reference Design Matrix
在这里插入图片描述

The Hardware design is simplified by a Tcl script which generates the Block Diagram, the wrapper, and the constraints file. Finally, it generates the bitfile.

  1. Download the file Resnet50_Ultra96.zip. This contains the generating Tcl script and the DPU IP.
  2. Extract the archive
  3. Open Vivado 2019.2 and change the directory to project_path/Resnet50_Ultra96v1_2019_2/pl. This will be the new working directory.
  4. In the Vivado TCL console run the following:
    cd project_path/Resnet50_Ultra96v1_2019_2/pl
    source ./scripts/Resnet50_ultra96.tcl
    注意这里是指在Vivado TCL console输入,不是在DOS或Ubuntu输入,否则就会出现下面的错误:
    bash: ./scripts/Resnet50_ultra96.tcl: line 141: syntax error near unexpected token }' 'ash: ./scripts/Resnet50_ultra96.tcl: line 141:} else {
    在这里插入图片描述

原理图

在这里插入图片描述

地址页

在这里插入图片描述

编译运行
在这里插入图片描述

DPU配置

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

john@john-virtual-machine:~/ultra96/Resnet50_Ultra96v1_2019_2$ export TRD_HOME= ( p w d ) j o h n @ j o h n − v i r t u a l − m a c h i n e : / u l t r a 96 / R e s n e t 5 0 U l t r a 96 v 1 2 01 9 2 (pwd) john@john-virtual-machine:~/ultra96/Resnet50_Ultra96v1_2019_2 (pwd)john@johnvirtualmachine: /ultra96/Resnet50Ultra96v120192 export PET_PROJ=“ultra96v1”
john@john-virtual-machine:~/ultra96/Resnet50_Ultra96v1_2019_2$ cd T R D H O M E / a p u / r e s n e t 5 0 u l t r a 96 v 1 b s p / TRD_HOME/apu/resnet50_ultra96v1_bsp/ TRDHOME/apu/resnet50ultra96v1bsp/PET_PROJ/

Petalinux步骤

Building the PetaLinux project requires the following sequence of operations:

  1. PetaLinux project creation
  2. Configuring the PetaLinux project with HW design
  3. Modification of the device tree to include the DPU
  4. Modification of the list of packages
  5. Adding the DNNDK library
  6. Configuring the PetaLinux rootfs and enabling the necessary packages, apps, modules
  7. Setting the auto loading DPU driver
  8. Building the PetaLinux project
  9. Creating the BOOT.BIN for the SD card.

The Petalinux project is simplified by the presence of the resnet50_ultra96.bsp file that has the steps from 2 to 8 already completed.

Petalinux命令

Start this process by loading the PetaLinux 2019.2 environment.
Set two useful variables
cd <path_to_working_directory>
export TRD_HOME=$(pwd)
export PET_PROJ=“ultra96v1”
Create the PetaLinux project
cd $TRD_HOME/apu/resnet50_ultra96v1_bsp/
petalinux-create -t project -s resnet50_ultra96.bsp -n $PET_PROJ --force
Configure the PetaLinux project with HW design
cd T R D H O M E / a p u / r e s n e t 5 0 u l t r a 96 v 1 b s p / TRD_HOME/apu/resnet50_ultra96v1_bsp/ TRDHOME/apu/resnet50ultra96v1bsp/PET_PROJ/
petalinux-config --get-hw-description=$TRD_HOME/pl/prj/ultra96/ --silentconfig
在这里插入图片描述

Build the PetaLinux project
petalinux-build
在这里插入图片描述

Create BOOT.BIN and image.ub for the SD card
cd T R D H O M E / a p u / r e s n e t 5 0 u l t r a 96 v 1 b s p / TRD_HOME/apu/resnet50_ultra96v1_bsp/ TRDHOME/apu/resnet50ultra96v1bsp/PET_PROJ/images/linux
petalinux-package --boot --fsbl zynqmp_fsbl.elf --u-boot u-boot.elf --pmufw pmufw.elf --fpga system.bit --force
cp BOOT.BIN image.ub $TRD_HOME/SDcard
在这里插入图片描述

ResNet-50应用

Generate a new SDK
cd T R D H O M E / a p u / r e s n e t 5 0 u l t r a 96 v 1 b s p / TRD_HOME/apu/resnet50_ultra96v1_bsp/ TRDHOME/apu/resnet50ultra96v1bsp/PET_PROJ/
petalinux-build -s
john@john-virtual-machine:~/ultra96/Resnet50_Ultra96v1_2019_2/apu/resnet50_ultra96v1_bsp/ultra96v1$ cp T R D H O M E / a p u / r e s n e t 5 0 u l t r a 96 v 1 b s p / TRD_HOME/apu/resnet50_ultra96v1_bsp/ TRDHOME/apu/resnet50ultra96v1bsp/PET_PROJ/images/linux/sdk.sh $TRD_HOME/apu/apps/
Extract the SDK
cd $TRD_HOME/apu/apps
在这里插入图片描述

chmod 777 sdk.sh
john@john-virtual-machine:~/ultra96/Resnet50_Ultra96v1_2019_2/apu/apps$ ./sdk.sh -d ./sdk -y
在这里插入图片描述
在这里插入图片描述

Build the ResNet-50 example
The original main.cc and Makefile come from xilinx_dnndk_v3.1
However the main.cc in xilinx_dnndk_v3.1/Ultra96 does not use the DPU SoftMax.
A fixed version of main.cc and Makefile have been included in this LFAR and can be found in $TRD_HOME/apu/apps/resnet50
ResNet-50 can be compiled in a terminal configured for Vivado 2019.2.
unset LD_LIBRARY_PATH
. $TRD_HOME/apu/apps/sdk/environment-setup-aarch64-xilinx-linux
.是个真真正正的命令。它是source命令的代名词,所以你可以用它在当前 shell 中执行一个文件,而不是以某种其它的方式去运行一个脚本文件(这通常指的是 Bash 会产生一个新的 shell 去运行它)

cd $TRD_HOME/apu/apps/resnet50
make
Update the SD card content
cp -f $TRD_HOME/apu/apps/resnet50/build/resnet50 $TRD_HOME/SDcard/resnet50/
Installing the DNNDK Host Tools
After downloading and unpacking the DNNDK package, execute the sudo ./install.sh command under the host_x86 folder to install the DECENT,DNNC, DDump and DLet tools on the host.
在这里要先安装dnndk_v3.1
在这里插入图片描述

cp –r xilinx_dnndk_v3.1/common $TRD_HOME/SDcard/

SD FAT32文件

在这里插入图片描述
在这里插入图片描述

SD根文件安装

john@john-virtual-machine:/media/john/root/sbin$ sudo tar -zxvf rootfs.tar.gz -C /media/john/root
SD卡的init.sysvinit大小多次变为零,原因不详,强行将其属性改为555
sudo chmod 555 /media/john/root/sbin/init.sysvinit
在这里插入图片描述

Test the ResNet-50 application

Insert the DS card in the Ultra96 and switch it on. After boot, login with ID root and password root. Change directory to the application folder.
cd /run/media/mmcblk0p1/resnet50
Run the ResNet application
./resnet50

在这里插入图片描述

本文参考官方指南:
XILINX INTERNAL Xilinx Answer 73118 – ResNet-50 implemented on an Ultra96 v1 board using Vivado and PetaLinux 2019.2 6
《Long Form Answer Record 73118: ResNet-50 implemented on an Ultra96 v1 board using Vivado and PetaLinux 2019.2》

这篇关于使用Vivado和PetaLinux 2019.2的Ultra96 v1 ResNet-50例程的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/997761

相关文章

使用 sql-research-assistant进行 SQL 数据库研究的实战指南(代码实现演示)

《使用sql-research-assistant进行SQL数据库研究的实战指南(代码实现演示)》本文介绍了sql-research-assistant工具,该工具基于LangChain框架,集... 目录技术背景介绍核心原理解析代码实现演示安装和配置项目集成LangSmith 配置(可选)启动服务应用场景

使用Python快速实现链接转word文档

《使用Python快速实现链接转word文档》这篇文章主要为大家详细介绍了如何使用Python快速实现链接转word文档功能,文中的示例代码讲解详细,感兴趣的小伙伴可以跟随小编一起学习一下... 演示代码展示from newspaper import Articlefrom docx import

oracle DBMS_SQL.PARSE的使用方法和示例

《oracleDBMS_SQL.PARSE的使用方法和示例》DBMS_SQL是Oracle数据库中的一个强大包,用于动态构建和执行SQL语句,DBMS_SQL.PARSE过程解析SQL语句或PL/S... 目录语法示例注意事项DBMS_SQL 是 oracle 数据库中的一个强大包,它允许动态地构建和执行

SpringBoot中使用 ThreadLocal 进行多线程上下文管理及注意事项小结

《SpringBoot中使用ThreadLocal进行多线程上下文管理及注意事项小结》本文详细介绍了ThreadLocal的原理、使用场景和示例代码,并在SpringBoot中使用ThreadLo... 目录前言技术积累1.什么是 ThreadLocal2. ThreadLocal 的原理2.1 线程隔离2

Python itertools中accumulate函数用法及使用运用详细讲解

《Pythonitertools中accumulate函数用法及使用运用详细讲解》:本文主要介绍Python的itertools库中的accumulate函数,该函数可以计算累积和或通过指定函数... 目录1.1前言:1.2定义:1.3衍生用法:1.3Leetcode的实际运用:总结 1.1前言:本文将详

浅析如何使用Swagger生成带权限控制的API文档

《浅析如何使用Swagger生成带权限控制的API文档》当涉及到权限控制时,如何生成既安全又详细的API文档就成了一个关键问题,所以这篇文章小编就来和大家好好聊聊如何用Swagger来生成带有... 目录准备工作配置 Swagger权限控制给 API 加上权限注解查看文档注意事项在咱们的开发工作里,API

Java数字转换工具类NumberUtil的使用

《Java数字转换工具类NumberUtil的使用》NumberUtil是一个功能强大的Java工具类,用于处理数字的各种操作,包括数值运算、格式化、随机数生成和数值判断,下面就来介绍一下Number... 目录一、NumberUtil类概述二、主要功能介绍1. 数值运算2. 格式化3. 数值判断4. 随机

Spring排序机制之接口与注解的使用方法

《Spring排序机制之接口与注解的使用方法》本文介绍了Spring中多种排序机制,包括Ordered接口、PriorityOrdered接口、@Order注解和@Priority注解,提供了详细示例... 目录一、Spring 排序的需求场景二、Spring 中的排序机制1、Ordered 接口2、Pri

Springboot 中使用Sentinel的详细步骤

《Springboot中使用Sentinel的详细步骤》文章介绍了如何在SpringBoot中使用Sentinel进行限流和熔断降级,首先添加依赖,配置Sentinel控制台地址,定义受保护的资源,... 目录步骤 1: 添加 Sentinel 依赖步骤 2: 配置 Sentinel步骤 3: 定义受保护的

Python中Markdown库的使用示例详解

《Python中Markdown库的使用示例详解》Markdown库是一个用于处理Markdown文本的Python工具,这篇文章主要为大家详细介绍了Markdown库的具体使用,感兴趣的... 目录一、背景二、什么是 Markdown 库三、如何安装这个库四、库函数使用方法1. markdown.mark