Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

FPGA neural network training

Status
Not open for further replies.

adwnis123

Full Member level 4
Joined
Jun 19, 2014
Messages
214
Helped
0
Reputation
0
Reaction score
1
Trophy points
18
Activity points
1,737
Hello,

I want to build a Neural Network on a FPGA, and I will train it. What FPGA is capable for this work? I have a Xilinx Spartan 3E. Can I use this for this work? Can I build Neural Network on this and train it? Is it better to use PYNQ solution, will it be more flexible? And a basic question I need help: If I manage to build a neural network on FPGA, and, for example, give it pictures with caucasian faces to output if it sees woman or man, will it work if I use images with Chinese (for example) faces to output if it sees woman or man? I mean can I use the same Core to train it with different images?

Thanks a lot...
 

Im wondering if you really understand how an FPGA works?
An FPGA is like a blank logical canvas. You can pretty much put any algorithm onto it that you wish. You could even write your own CPU if you wanted to.
So the answer to all of your questions will be Yes. The difficult part will be writing the HDL to do it.
Remember, this is hardware design, NOT software programming.
 
I understand how FPGA works, but I do not know if the FPGA Spartan 3E that I have can handle so much information or I do need something more advanced in memory, LUT, slices etc??

Also if I cannot use PYNQ, if I connect the Spartan 3E to a Raspberry Pi 3B+ can I achieve the same results as far as the DSP acceleration on the images is concerned (like the PYNQ module) ? I mean: when I need to process the images I get from Raspberry's camera to send them through a fast communication protocol to the FPGA for accelarated processing?

Sorry for asking so many...

Thank you!
 

Please consider the following:
* You want to transfer image pixels to FPGA - how many pixels per image and what is a size of an image? Can you transfer only a bunch of pixels at a time that can be processed by first step processing (I suppose some filtering), without a need to store a whole image?
* Do you want your system to work in real time? If no then even slow/old FPGA with very limited resources can handle that task, but a memory buffer is needed to store images: Camera => RAM => FPGA => RAM => Display).
* If you are interested in a real time processing you should estimate how many resources are needed inside FPGA to do a job.

PYNQ is Zynq based, that means you can elaborate the synergy between CPU and FPGA - do you think about HLS or SDSoC in an acceleration context?
 
You need to be more specific. A small hopfield network can be built with a handful of gates and fits into any FPGA.
 
I would start with a desktop PC (and maybe cloud servers) and make a version of the problem that can work on saved images. This should answer if the model works for Chinese faces when not specifically trained to recognize them.

I think training the model should be done without the FPGA at first. Unless you are marketing a NN trainer using FPGAs, there isn't anything to gain here. And you want the model to be flexible during the train-evaluate-revise process.

Basically, I think you should inject the FPGA into the design as an improvement. Trying to do everything in an FPGA makes me think this is a "solution looking for a problem" task.
 
Please consider the following:
* You want to transfer image pixels to FPGA - how many pixels per image and what is a size of an image? Can you transfer only a bunch of pixels at a time that can be processed by first step processing (I suppose some filtering), without a need to store a whole image?
* Do you want your system to work in real time? If no then even slow/old FPGA with very limited resources can handle that task, but a memory buffer is needed to store images: Camera => RAM => FPGA => RAM => Display).
* If you are interested in a real time processing you should estimate how many resources are needed inside FPGA to do a job.

PYNQ is Zynq based, that means you can elaborate the synergy between CPU and FPGA - do you think about HLS or SDSoC in an acceleration context?

A camera that could get images, in a quality such that the FPGA could decide if the person is woman or man. I do not know the lowest number of pixels it needs. Also, how do I connect a camera in a Spartan 3E, what interface should I use? Yes, I need it in real-time. If I could get a decision below 10 second would be perfect. I have build it in Raspberry Pi 3 B+ and it takes 30 sec to decide if it is a man or woman. It is too much time and very energy harvesting...it uses all 4 cores of Raspberry and demands huge amount of current for an embedded device. I want to build the Neural Network on a FPGA and reduce the decision time as much as possible.

Thank you...
 

You first need to separate the problem in parts, or rather, programming layers; the algorithm of pattern recognition, you certainly do not intend to do the experiments by programming directly in the FPGA, but rather put on the chip the result of the calculation for the selected neural network with its parametrizations for the neuron weights. In MATLAB there are powerful toolboxes for NN, as well as the ability to convert the result into HDL, so that instead of going straight to programming in raw code, consider using higher-level options for the develoment stage.
 
FPGAs tend to use a lot of power compared to ARM chips - so while it may be faster (when you finally finish) it's likely to use more power.
As for the camera interface - you need to decide how it interfaces. Find out what interfaces your board has, and see if its got an appropriate one for a camera. You'll likely need a board with HDMI, DVI or VGA connection. Or maybe you could get a processor to transfer camera data from a USB camera (because USB in FPGA is not free and a lot of logic).

The interfaces you require should be one of the first parts of the design specification.
 
You did a Raspberry Pi 3 B+ project with some camera module. I suggest to use the same camera and describe the camera controller inside FPGA. Maybe FPGA project already exist in the Internet for your camera module?
Very long time ago I used a DevKit with Spartan 3E, which was Nexys 2. I bought a cheap camera module ov7670 (640 x 480 pixels) and I found this FPGA project description: **broken link removed** - it worked out at first attempt, but it needed slightly different register settings for better colors and then I found this: **broken link removed**.
I think it could be a good starting point for you today.
 
Last edited:

The pynq board has easier interfaces. You can plug a camera into the HDMI.
 
Hi

I think you should start with building the network from known framework such as
Keras /Tensorflow etc.. check if you get what you wish for.
Then do the math & calculation for inferncing on FPGA.
Read this artical for beter assessment:
https://hal.archives-ouvertes.fr/hal-01695375/file/hal-accelerating-cnn.pdf

Gil

Hello,

It says inside the paper:
"CNNs require up to 38 GOP/s to classify a single frame..."
Can a Xilinx Spartan 3e xc3s500e achieve this number of GOP/s?

Thank you
 

I finally bought this: XILINX VIRTEX-5 XC5VLX155T. Can I use any better High Definition camera, instead of the 640 x 480 I have described previously? Can this FPGA handle Serial interface core + image processing core + Neural network core at the same chip written in VHDL? Thank you.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top