Code Monkey home page Code Monkey logo

finn-examples's Introduction

Dataflow Accelerator Examples

for PYNQ on Zynq and Alveo

drawing

This repository contains a variety of customized FPGA neural network accelerator examples built using the FINN compiler, which targets few-bit quantized neural networks with emphasis on generating dataflow-style architectures customized for each network.

The examples here come with pre-built bitfiles, PYNQ Python drivers and Jupyter notebooks to get started, and you can rebuild them from source. Both PYNQ on Zynq and Alveo are supported.

Quickstart

For Alveo we recommend setting up everything inside a virtualenv as described here.

First, ensure that your pip and setuptools installations are up-to-date on your PYNQ board or Alveo server:

python3 -m pip install --upgrade pip setuptools

Install the finn-examples package using pip:

# remove previous versions with: pip3 uninstall finn-examples
pip3 install finn-examples
# to install particular git branch:
# pip3 install git+https://github.com/Xilinx/finn-examples.git@dev

Retrieve the example Jupyter notebooks using the PYNQ get-notebooks command:

# on PYNQ boards, first cd /home/xilinx/jupyter_notebooks
pynq get-notebooks --from-package finn-examples -p .

You can now navigate the provided Jupyter notebook examples, or just use the provided accelerators as part of your own Python program:

from finn_examples import models
import numpy as np

# instantiate the accelerator
accel = models.cnv_w2a2_cifar10()
# generate an empty numpy array to use as input
dummy_in = np.empty(accel.ishape_normal, dtype=np.uint8)
# perform inference and get output
dummy_out = accel.execute(dummy_in)

Example Neural Network Accelerators

Dataset Topology Quantization Supported boards

CIFAR-10
CNV (VGG-11-like) several variants:
1/2-bit weights/activations
all


MNIST
3-layer fully-connected several variants:
1/2-bit weights/activations
all


ImageNet
MobileNet-v1 4-bit weights and activations
8-bit first layer weights
Alveo U250

Supported Boards

Note that the larger NNs are only available on Alveo boards.

finn-examples provides pre-built FPGA bitfiles for the following boards:

  • Edge: Pynq-Z1, Pynq-Z2, Ultra96 and ZCU104
  • Datacenter: Alveo U250

It's possible to generate Vivado IP for the provided examples to target any modern Xilinx FPGA of sufficient size. In this case you'll have to manually integrate the generated IP into your design using Vivado IPI. You can read more about this here.

Rebuilding the bitfiles

All of the examples here are built using the FINN compiler, and can be re-built or customized. See the build/README.md for more details.

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.