1
hls4ml Demo @ DEFCON30
FastML 2022
Ben Hawks et al. for the hls4ml team
@quantized_bits, and @hls4ml on Twitter!
Using the Pynq Software stack
(Python API to interact with & program FPGA, hosts Jupyter directly on Pynq-Z2 Board)��Have a live webcam running inferences via HLS4ML accelerator, outputting to an HDMI display
Demo #1 - Live Pokémon Inference
Class: PIkachu
Confidence 78.23%
“Pokémon” © 1995–2022 Nintendo/Creatures Inc./GAME FREAK inc
DEFCON 30
DEFCON 30 Demo Labs - hls4ml Live Demonstration
Using the Pynq Software stack
(Python API to interact with & program FPGA, hosts Jupyter directly on Pynq-Z2 Board)��Have a live webcam running inferences via HLS4ML accelerator, outputting to an HDMI display
Class: PIkachu
DEFCON 30 Demo Labs - hls4ml Live Demonstration
6
“RN07” (v0.7):
58,115 parameters
83.5% acc. on CIFAR-10*
(note: removed activations)
Example Model - Image Classification
“Pokémon” © 1995–2022 Nintendo/Creatures Inc./GAME FREAK inc
7
Dataset - Pokémon
Example images of each (test) class
“Pokémon” © 1995–2022 Nintendo/Creatures Inc./GAME FREAK inc
hls4ml tutorial
Aug 13, 2022
8
TUL Pynq-Z2 w/ Xilinx Zynq XC7Z020
ARM Cores (PS)�
* Run OS (Ubuntu), Network, USB, etc.
�* Host Jupyter Server w/ Python Code
�* Image Capture & processing
FPGA (PL)�
* Perform NN Inference
�* Output HDMI
* Image Preprocessing**
AXI DMA
** Capable of accelerating some OpenCV operations, but we ran out of time :)
Demo Hardware - Pynq Z2
Zynq XC7Z020 Block Diagram
Neural Network
HDMI Out
Add Text�(Prediction)
Crop
Resize to�32x32px�(Bilinear)
Image is natively 640x480,
24 bit (3x8b) RGB
Image to Display
Pred. Class
Demo #1 - Image Processing Flow
FPGA
CPU
Class: PIkachu
“Pokémon” © 1995–2022 Nintendo/Creatures Inc./GAME FREAK inc
Using the Pynq Software stack
(Python api to interact with & program FPGA, hosts Jupyter directly on Pynq)��Run a sample model on the accelerator & MCU with live representation on screen to demo speed of accelerator vs a regular MCU
DDR3 RAM
Power
ACCELERATOR�Inferences/Second: XX�Progress: 45/100 Images
MICROCONTROLLER�Inferences/Second: XX�Progress: 32/100 Images
Demo #2 - Inference Race
Demo #2 - Inference Race
12
Dataset - CIFAR 10
Example images of each class
Dataset, images, and text from: �https://www.cs.toronto.edu/~kriz/cifar.html
hls4ml tutorial
Aug 13, 2022