• This repository has been archived on 04/Jan/2022
  • Stars
    star
    652
  • Rank 67,531 (Top 2 %)
  • Language
    Jupyter Notebook
  • License
    BSD 3-Clause "New...
  • Created over 7 years ago
  • Updated over 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Quantized Neural Networks (QNNs) on PYNQ

BNN-PYNQ PIP INSTALL Package

This repo contains the pip install package for Quantized Neural Network (QNN) on PYNQ. Two different network topologies are here included, namely CNV and LFC as described in the FINN Paper . Now, there are multiple implementations available supporting different precision for weights and activation:

  • 1 bit weights and 1 bit activation (W1A1) for CNV and LFC
  • 1 bit weights and 2 bit activation (W1A2) for CNV and LFC
  • 2 bit weights and 2 bit activation (W2A2) for CNV

We support 3 boards for hardware acceleration which are Pynq-Z1, Pynq-Z2 and Ultra96 (with PYNQ image).

Note, this repository has now been archived and is no longer being actively maintained. If you are relying on this repository, we strongly recommend you switch to the FINN compiler.

Citation

If you find BNN-PYNQ useful, please cite the FINN paper:

@inproceedings{finn,
author = {Umuroglu, Yaman and Fraser, Nicholas J. and Gambardella, Giulio and Blott, Michaela and Leong, Philip and Jahre, Magnus and Vissers, Kees},
title = {FINN: A Framework for Fast, Scalable Binarized Neural Network Inference},
booktitle = {Proceedings of the 2017 ACM/SIGDA International Symposium on Field-Programmable Gate Arrays},
series = {FPGA '17},
year = {2017},
pages = {65--74},
publisher = {ACM}
}

Quick Start

Please refer to PYNQ Getting Started guide to set-up your PYNQ Board.

In order to install it to your PYNQ, connect to the board, open a terminal and type:

sudo pip3 install git+https://github.com/Xilinx/BNN-PYNQ.git (on PYNQ v2.3 and later versions, tested up to v2.5)
sudo pip3.6 install git+https://github.com/Xilinx/BNN-PYNQ.git (on PYNQ v2.2 and earlier)

This will install the BNN package to your board, and create a bnn directory in the Jupyter home area. You will find the Jupyter notebooks to test the networks in this directory.

Repo organization

The repo is organized as follows:

  • bnn: contains the LfcClassifier and CnvClassifier python class description
    • src: contains the sources of the different precision networks, the libraries to rebuild them, and scripts to train and pack the weights:
      • library: FINN library for HLS QNN descriptions, host code, script to rebuilt and drivers for the PYNQ and Ultra96 (please refer to README for more details)
      • network: HLS top functions for QNN topologies (CNV and LFC) with different implementations for weight and activation precision, host code and make script for HW and SW build (please refer to README for more details)
      • training: scripts to train on the Cifar10, GTSRB and MNIST datasets and scripts to pack the weights in a binary format which can be read by the overlay
    • bitstreams: contains the bitstreams for the 5 overlays
      • pynqZ1-Z2: bitstreams for Pynq devices
      • ultra96: bitstreams for Ultra96 devices
    • libraries: pre-compiled shared objects for low-level driver of the 5 overlays each for hardware and software runtime
      • pynqZ1-Z2: shared objects used by Pynq devices
      • ultra96: shared objects used by ultra96
    • params: set of trained parameters for the 5 overlays:
      • MNIST and NIST dataset for LFC network. Note that NIST dataset is only applicable to LFC-W1A1 by default.
      • Cifar10 , SVHN and German Road Signs dataset for CNV network. Note that SVHN and German Road Signs databases are only applicable to CNV-W1A1 by default.
  • notebooks: lists a set of python notebooks examples, that during installation will be moved in /home/xilinx/jupyter_notebooks/bnn/ folder
  • tests: contains test script and test images

Hardware design rebuilt

In order to rebuild the hardware designs, the repo should be cloned in a machine with installation of the Vivado Design Suite (tested with 2018.2). Following the step-by-step instructions:

  1. Clone the repository on your linux machine: git clone https://github.com/Xilinx/BNN-PYNQ.git --recursive;
  2. Move to <clone_path>/BNN_PYNQ/bnn/src/network/
  3. Set the XILINX_BNN_ROOT environment variable to <clone_path>/BNN_PYNQ/bnn/src/
  4. Launch the shell script make-hw.sh with passing parameters for target network, target platform and mode, with the command ./make-hw.sh {network} {platform} {mode} where:
    • network can be cnvW1A1, cnvW1A2, cnvW2A2 or lfcW1A1, lfcW1A2;
    • platform can be pynqZ1-Z2 or ultra96;
    • mode can be h to launch Vivado HLS synthesis, b to launch the Vivado project (needs HLS synthesis results), a to launch both;
  5. The results will be visible in clone_path/BNN_PYNQ/bnn/src/network/output/ that is organized as follows:
    • bitstream: contains the generated bitstream(s);
    • hls-syn: contains the Vivado HLS generated RTL and IP (in the subfolder named as the target network and target platform);
    • report: contains the Vivado and Vivado HLS reports;
    • vivado: contains the Vivado project;
  6. Copy the generated bitstream, hwh and tcl script on the PYNQ board pip_installation_path/bnn/bitstreams/

More Repositories

1

PYNQ

Python Productivity for ZYNQ
Jupyter Notebook
1,894
star
2

Vitis-AI

Vitis AI is Xilinx’s development stack for AI inference on Xilinx hardware platforms, including both edge devices and Alveo cards.
Python
1,400
star
3

linux-xlnx

The official Linux kernel from Xilinx
C
1,205
star
4

brevitas

Brevitas: neural network quantization in PyTorch
Python
1,107
star
5

Vitis-Tutorials

Vitis In-Depth Tutorials
C
891
star
6

Vitis_Libraries

Vitis Libraries
C++
818
star
7

embeddedsw

Xilinx Embedded Software (embeddedsw) Development
HTML
766
star
8

finn

Dataflow compiler for QNN inference on FPGAs
Python
679
star
9

u-boot-xlnx

The official Xilinx u-boot repository
C
531
star
10

XRT

Run Time for AIE and FPGA based platforms
C++
529
star
11

Vitis_Accel_Examples

Vitis_Accel_Examples
Makefile
467
star
12

Vitis-HLS-Introductory-Examples

C++
420
star
13

dma_ip_drivers

Xilinx QDMA IP Drivers
C
400
star
14

HLS

Vitis HLS LLVM source code and examples
375
star
15

Vitis-AI-Tutorials

354
star
16

PYNQ_Workshop

Jupyter Notebook
354
star
17

SDAccel_Examples

SDAccel Examples
C++
350
star
18

ml-suite

Getting Started with Xilinx ML Suite
Jupyter Notebook
334
star
19

CHaiDNN

HLS based Deep Neural Network Accelerator Library for Xilinx Ultrascale+ MPSoCs
C++
315
star
20

xfopencv

C++
313
star
21

XilinxTclStore

Xilinx Tcl Store
Tcl
310
star
22

mlir-aie

An MLIR-based toolchain for AMD AI Engine-enabled devices.
MLIR
257
star
23

RapidWright

Build Customized FPGA Implementations for Vivado
Java
248
star
24

QNN-MO-PYNQ

Jupyter Notebook
234
star
25

XilinxBoardStore

Python
224
star
26

libsystemctlm-soc

SystemC/TLM-2.0 Co-simulation framework
Verilog
200
star
27

qemu

Xilinx's fork of Quick EMUlator (QEMU) with improved support and modelling for the Xilinx platforms.
C
200
star
28

DPU-PYNQ

DPU on PYNQ
Tcl
189
star
29

device-tree-xlnx

Linux device tree generator for the Xilinx SDK (Vivado > 2014.1)
Tcl
181
star
30

PYNQ-ComputerVision

Computer Vision Overlays on Pynq
Jupyter Notebook
173
star
31

XilinxVirtualCable

Xilinx Virtual Cable (XVC) is a TCP/IP-based protocol that acts like a JTAG cable and provides a means to access and debug your FPGA or SoC design without using a physical cable.
C
172
star
32

finn-hlslib

Vitis HLS Library for FINN
C++
168
star
33

graffitist

Graph Transforms to Quantize and Retrain Deep Neural Nets in TensorFlow
Python
168
star
34

open-nic

AMD OpenNIC Project Overview
Shell
166
star
35

finn-examples

Dataflow QNN inference accelerator examples on FPGAs
Jupyter Notebook
163
star
36

SDSoC-Tutorials

SDSoCβ„’ (Software-Defined System-On-Chip) Environment Tutorials
C++
142
star
37

xilinx-tiny-cnn

C++
140
star
38

FPGA_as_a_Service

Go
136
star
39

xup_vitis_network_example

VNx: Vitis Network Examples
Jupyter Notebook
124
star
40

meta-xilinx

Collection of Yocto Project layers to enable AMD Xilinx products
C
123
star
41

Vitis-In-Depth-Tutorial

C++
113
star
42

systemctlm-cosim-demo

QEMU libsystemctlm-soc co-simulation demos.
C++
106
star
43

Vitis_Embedded_Platform_Source

Tcl
105
star
44

SDAccel-Tutorials

SDAccel Development Environment Tutorials
C++
101
star
45

nanotube

LLVM
101
star
46

RFNoC-HLS-NeuralNet

CMake
92
star
47

Embedded-Design-Tutorials

91
star
48

PYNQ-DL

Xilinx Deep Learning IP
VHDL
91
star
49

PYNQ-HelloWorld

This repository contains a "Hello World" introduction application to the Xilinx PYNQ framework.
Jupyter Notebook
90
star
50

LSTM-PYNQ

C++
86
star
51

Vivado-Design-Tutorials

Tcl
83
star
52

SDSoC_Examples

C++
82
star
53

Kria-PYNQ

PYNQ support and examples for Kria SOMs
Jupyter Notebook
82
star
54

meta-petalinux

meta-petalinux distro layer supporting Xilinx Tools
BitBake
82
star
55

kria-vitis-platforms

Kria KV260 Vitis platforms and overlays
SystemVerilog
81
star
56

IIoT-EDDP

The repository contains the design database and documentation for Electric Drives Demonstration Platform
VHDL
79
star
57

logicnets

Python
78
star
58

AI-Model-Zoo

75
star
59

RecoNIC

RecoNIC is a software/hardware shell used to enable network-attached processing within an RDMA-featured SmartNIC for scale-out computing.
SystemVerilog
75
star
60

ACCL

Alveo Collective Communication Library: MPI-like communication operations for Xilinx Alveo accelerators
C++
75
star
61

open-nic-shell

AMD OpenNIC Shell includes the HDL source files
SystemVerilog
70
star
62

mlir-air

C++
70
star
63

Applications

C
67
star
64

llvm-aie

Fork of LLVM to support AMD AIEngine processors
LLVM
66
star
65

XilinxUnisimLibrary

Xilinx Unisim Library in Verilog
Verilog
64
star
66

PYNQ_Composable_Pipeline

PYNQ Composabe Overlays
Tcl
61
star
67

gemx

Matrix Operation Library for FPGA https://xilinx.github.io/gemx/
C++
56
star
68

PYNQ_RFSOC_Workshop

Open-sourcing the PYNQ & RFSoC workshop materials
Jupyter Notebook
55
star
69

merlin-compiler

C++
52
star
70

meta-xilinx-tools

Yocto Project layer enables AMD Xilinx tools related metadata for MicroBlaze, Zynq, ZynqMP and Versal devices.
BitBake
50
star
71

RFSoC-PYNQ

Python productivity for RFSoC platforms
Jupyter Notebook
49
star
72

ResNet50-PYNQ

Quantized ResNet50 Dataflow Acceleration on Alveo, with PYNQ
C++
48
star
73

Alveo-PYNQ

Introductory examples for using PYNQ with Alveo
Jupyter Notebook
47
star
74

xup_compute_acceleration

Hands-on experience using the Vitis unified software platform with Xilinx FPGA hardware
C++
46
star
75

xup_high_level_synthesis_design_flow

AMD Xilinx University Program HLS tutorial
C
46
star
76

Vitis_Model_Composer

Vitis Model Composer Examples and Tutorials
C++
46
star
77

Vitis-AWS-F1-Developer-Labs

C++
44
star
78

PYNQ_Bootcamp

PYNQ Bootcamp 2019-2022 teaching materials.
Jupyter Notebook
44
star
79

PYNQ-Networking

Networking Overlay on PYNQ
Tcl
44
star
80

KRS

The Kria Robotics Stack (KRS) is a ROS 2 superset for industry, an integrated set of robot libraries and utilities to accelerate the development, maintenance and commercialization of industrial-grade robotic solutions while using adaptive computing.
HTML
43
star
81

Get_Moving_With_Alveo

For publishing the source for UG1352 "Get Moving with Alveo"
C++
42
star
82

blockchainacceleration

Tcl
42
star
83

HLS_packet_processing

C++
41
star
84

HLS_arbitrary_Precision_Types

C++
40
star
85

DSRL

40
star
86

inference-server

C++
40
star
87

Xilinx_Kria_KV260_Workshop

39
star
88

chipscopy

ChipScoPy (ChipScope Python API) is an open source Python API to the various ChipScope services provided by the TCF-based (Target Communication Framework) ChipScope Server (cs_server).
Jupyter Notebook
38
star
89

VVAS

Vitis Video Analytics SDK
C
37
star
90

vcu-ctrl-sw

C
36
star
91

XilinxCEDStore

This store contains Configurable Example Designs.
Tcl
36
star
92

pyxir

Python
36
star
93

pytorch-ocr

Python
35
star
94

DSP-PYNQ

A PYNQ overlay demonstrating Pythonic DSP running on Zynq UltraScale+
Tcl
35
star
95

xup_aie_training

Hands-on experience programming AI Engines using Vitis Unified Software Platform
Jupyter Notebook
34
star
96

open-nic-driver

AMD OpenNIC driver includes the Linux kernel driver
C
33
star
97

pcie-model

PCI Express controller model
C
32
star
98

qemu-devicetrees

Device trees used by QEMU to describe the hardware
Makefile
32
star
99

bootgen

bootgen source code
C++
31
star
100

hdmi-modules

Xilinx Soft-IP HDMI Rx/Tx core Linux drivers
C
30
star