【E164】使 Vivado HLS的CNN FPGA加速器

2021-08-16 10:00:44      索炜达电子      712     

项目编号:E164

文件大小:20M

源码说明:带中文注释

开发环境:C编译器

简要概述:

关于我们的本科毕业项目,使用 Vivado High Level Synthesis 2016.4 和 Vivado SDSoC 2016.4 实现 LeNet-5

【E164】使 Vivado HLS的CNN FPGA加速器

Win 10 测试应用

您可以通过自己的手写数字图像测试加速器

【E164】使 Vivado HLS的CNN FPGA加速器

如果您想测试该应用程序,请按照以下说明操作

  1. Configure the IP address of Zedboard.

	username@Zedboard:~# ifconfig
  1. Start .elf file with port name argument (in here, 5555 is port name)

	username@Zedboard:~# lenet5_test.elf 5555
  1. Start the win 10 test application and input the IP address & port name.

  2. Press connect

  3. Open image file

I did not put a zoom in/out function to the app, so please suit the image size.

Model description

Used model is LeNet5-Like Deep CNN
Input : -1.0 to 1.0
Conv1 : 1x32x32 -> 6x28x28, ksize = 1x6x5x5, stride = 1
Pool1 : 6x28x28 -> 6x14x14, average pooling, window size = 2x2, stride = 2
Conv2 : 6x14x14 -> 16x10x10, ksize = 6x16x25, stride = 1
Pool2 : 16x10x10 -> 16x5x5, average pooling, window size = 2x2, stride = 2
Conv3 : 16x5x5 -> 120x1x1, ksize = 16x120x25, stride = 1
FC1 : 120x84
FC2 : 84x10

Environments

I used Zedboard(Zynq 7z020) for testing.

HW Functions : CONVOLUTION_ LAYER_ 1, CONVOLUTION_ LAYER_ 2, and CONVOLUTION_ LAYER_ 3, Clk freq set as 100MHz.

Accuracy

SW accuracy : 98.63% (single precision fp)    
HW accuracy : 98.63% (single precision fp)

Runtime

# of images : 10,000, batch size : 1  

SW runtime  : 59.4456 seconds  
HW runtime  : 16.3954 seconds  

speedup : x3.63 faster

Contributors

  • Changwoo Lee (Hanyang University, Seoul, South Korea)

  • Jeonghyun Woo (Hanyang University, Seoul, South Korea)

文件列表:

目录│文件列表:

 └ lenet5_hls

    └ lenet5_hls

       │ LOG.h

       │ main.cpp

       │ sdx_test.h

       ├ filter

       │  │ bconv1.mdl

       │  │ bconv3.mdl

       │  │ bconv5.mdl

       │  │ bfc1.mdl

       │  │ bfc2.mdl

       │  │ bpool1.mdl

       │  │ bpool2.mdl

       │  │ Wconv1.mdl

       │  │ Wconv3.mdl

       │  │ Wconv3_modify.mdl

       │  │ Wconv5.mdl

       │  │ Wfc1.mdl

       │  │ Wfc2.mdl

       │  │ Wpool1.mdl

       │  │ Wpool2.mdl

       │  └ new

       │     │ bconv1.mdl

       │     │ bconv3.mdl

       │     │ bconv5.mdl

       │     │ bfc1.mdl

       │     │ bfc2.mdl

       │     │ bpool1.mdl

       │     │ bpool2.mdl

       │     │ LeNet-weights_Conv_1.txt

       │     │ LeNet-weights_Conv_1_Bias.txt

       │     │ LeNet-weights_Conv_2.txt

       │     │ LeNet-weights_Conv_2_Bias.txt

       │     │ LeNet-weights_Conv_2_Dummy.txt

       │     │ LeNet-weights_Conv_2_Dummy.txt.bak

       │     │ LeNet-weights_Conv_3.txt

       │     │ LeNet-weights_Conv_3_Bias.txt

       │     │ LeNet-weights_Fc_1.txt

       │     │ LeNet-weights_Fc_1_Bias.txt

       │     │ LeNet-weights_Fc_2.txt

       │     │ LeNet-weights_Fc_2.txt.bak

       │     │ LeNet-weights_Fc_2_Bias.txt

       │     │ LeNet-weights_Fc_2_Bias.txt.bak

       │     │ LeNet-weights_Pool_1.txt

       │     │ LeNet-weights_Pool_1_Bias.txt

       │     │ LeNet-weights_Pool_2.txt

       │     │ LeNet-weights_Pool_2_Bias.txt

       │     │ Wconv1.mdl

       │     │ Wconv3.mdl

       │     │ Wconv5.mdl

       │     │ Wfc1.mdl

       │     │ Wfc2.mdl

       │     │ Wpool1.mdl

       │     └ Wpool2.mdl

       ├ lenet5

       │  │ classify_lib.h

       │  │ common.h

       │  │ lenet5.h

       │  ├ hw_layers

       │  │  │ activation.cpp

       │  │  │ activation.h

       │  │  │ image_convolution.cpp

       │  │  │ image_convolution.h

       │  │  │ image_fullyconnected.h

       │  │  │ image_pool.cpp

       │  │  └ image_pool.h

       │  └ sw_layers

       │     │ image_convolution_sw.h

       │     │ image_fullyconnected_sw.h

       │     └ image_pool_sw.h

       ├ MNIST_DATA

       │  │ MNIST_DATA.h

       │  │ t10k-images.idx3-ubyte

       │  └ t10k-labels.idx1-ubyte

       ├ Win10 Test App

       │  └ LeNet5 Test

       │     │ LeNet5 Test.sln

       │     ├ .vs

       │     │  └ LeNet5 Test

       │     │     └ v15

       │     │        │ .suo

       │     │        ├ Server

       │     │        │  └ sqlite3

       │     │        │     │ db.lock

       │     │        │     └ storage.ide

       │     │        └ sqlite3

       │     │           │ db.lock

       │     │           └ storage.ide

       │     └ LeNet5 Test

       │        │ App.xaml

       │        │ App.xaml.cs

       │        │ LeNet5 Test.csproj

       │        │ LeNet5 Test.csproj.user

       │        │ LeNet5 Test_TemporaryKey.pfx

       │        │ MainPage.xaml

       │        │ MainPage.xaml.cs

       │        │ Package.appxmanifest

       │        ├ Assets

       │        │  │ a-2729794_960_720.png

       │        │  │ LockScreenLogo.scale-200.png

       │        │  │ picture-frame-with-mountain-image_318-40293.jpg

       │        │  │ SplashScreen.scale-200.png

       │        │  │ Square150x150Logo.scale-200.png

       │        │  │ Square44x44Logo.scale-200.png

       │        │  │ Square44x44Logo.targetsize-24_altform-unplated.png

       │        │  │ star.png

       │        │  │ StoreLogo.png

       │        │  └ Wide310x150Logo.scale-200.png

       │        ├ BundleArtifacts

       │        │  │ arm.txt

       │        │  │ x64.txt

       │        │  └ x86.txt

       │        ├ obj

       │        │  │ LeNet5 Test.csproj.nuget.cache

       │        │  │ LeNet5 Test.csproj.nuget.g.props

       │        │  │ LeNet5 Test.csproj.nuget.g.targets

       │        │  └ project.assets.json

       │        └ Properties

       │           │ AssemblyInfo.cs

       │           └ Default.rd.xml

       └ Win10 Test App Release

          │ LeNet5 Test_1.0.0.0_Test.zip

          └ README.md

TAGCNN
  • 8 次
  • 1 分