Git Product home page Git Product logo

lenet5_hls's Introduction

LeNet-5 in HLS

This repository is about our undergraduate graduation project, implementing LeNet-5 by using Vivado High Level Synthesis 2016.4 & Vivado SDSoC 2016.4

lenet5

Win 10 Test App

You can test the accelerator by your own handwritten digits image.

Youtube Video

Youtube Video Here

If you want to test the app, follow these instruction

  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

We 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 : 3.63x faster 

Contributors

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

lenet5_hls's People

Contributors

changwoolee avatar jeonghyunwoo0306 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

lenet5_hls's Issues

Public project file

Sorry, please forgive my unreasonable request. I am a newbie. I don't know how to integrate the files of hw and sw into a project. So I want to modify the project of ZC706 development board based on your project. then I can implement your project on the ZC706 development board. Thank you very much. I hope you have the time to help me. Thank you very much!

problem about vivado hls

Hello!
Have you encountered a problem like "ERROR: [SYNCHK 200-11] ... (possible cause(s): pointer to pointer or global pointer)",If you have seen such a problem, how did you solve it?

Hi, about the apps

The license already overdue. Can you make it latest? because I cant install PowerShell

About Doc and Readme

Hello sir, may you please provide new and detailed doc and readme about this project?
This would be a great pleasure by you.
Best wishes.

Question about HLS parallel computation

`#include "ap_int.h"
#include "test.h"

void test(ap_fixed<18,10> A[10],ap_fixed<18,10> B[10], ap_fixed<18,10> C[10]){

ap_fixed<18,10> temp1[10];
ap_fixed<18,10> temp2[10];
ap_fixed<18,10> temp3[10];

#pragma HLS ARRAY_PARTITION variable=temp1 complete dim=1
#pragma HLS ARRAY_PARTITION variable=temp2 complete dim=1
#pragma HLS ARRAY_PARTITION variable=temp3 complete dim=1

for(int i = 0;i<10;i++)
{

#pragma HLS PIPELINE II=1
temp1[i] = A[i];
temp2[i] = B[i];
}

for(int i = 0;i < 10;i++){

#pragma HLS PIPELINE II=1
#pragma HLS UNROLL
temp3[i] = temp1[i]*temp2[i];
}

for(int i = 0 ;i<10;i++)
{

#pragma HLS PIPELINE II=1
C[i] = temp3[i];
}

}`

I am a novice in HLS and I am trying to implement parallel computation of element-wise multiplication between arrays A and B using the simple code above. I added parallelism by unrolling the loop and using a temporary variable, but I found that this approach still cannot achieve parallel computation of the elements and it is still sequential. I'm not sure what the problem is.
捕获

Unable to open the win 10 test application

I am unable to open the win 10 test application. And there are too many .exe files named LeNet5 Test, so could you please tell me the specific directory of the executable file which we are supposed to run for the testing.

Wish for your help

Hi @changwoolee ,I‘m VERY interested in your project, you've got a brilliant acheivement.
I also got a zynq-7020 board. But I am a newcomer in this area.
May you tell me how to run your projcet on the board.(in steps)
I'll really appreciate it.
Thanks in advance.

why the accuracy is very low when i use my own picture

I have a question, I use your source code to build a project on vs2013 of my computer, and when I enter a handwritten digital picture into it, the recognized numbers are wrong.
is there any any requirements for image input?
I used this code to replace the original code
READ_MNIST_DATA("F:/FPGA_CNN/minst/test_images/1_00002.jpg", MNIST_IMG, -1.0f, 1.0f, 1);
is there any wrong?

Correct parameters folder

Hi, I'd like to know which is the correct folder for loading the parameters(.mdl files) and the images files for test the CNN, thanks for sharing your project, greetings.

hls

Hi, i want to know the details when using hls. i do not know the top files when i try to implement it and i can not finish the project. i am a novice, so i want to know more details about this. Thank you very much.

What is what?

Hi Chang,
I'd like to reuse this work on Zynq, but I'm struggling with what's here, I can see the HLS files (no Vivado project though) and some C/C++ files but I'm not sure which ones are Visual Studio and which ones are for the Zynq Processor... Do you have any notes about it?

How did you train weights and bias?

Hi. I'm trying to inference my own trained weights and bias through your C Model (Weights and bias trained from Tensorflow Model which has same model architecture with yours.)
But it doesn't give a good result like you (About 10% of accuracy.)

Can you let me know, how did you train your weights and bias?

Thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.