Back in May Xilinx released DPU-PYNQ which is an upgrade that incorporates DPU overlays and Vitis-AI into PYNQv2.5.
Currently the Ultra96(v1 and v2), ZCU104, and ZCU111 boards are supported and with a little work you should be able to upgrade other boards that are running PYNQv2.5.
I had hoped to demonstrate DPU-PYNQ using the UltraZed-EV but I ran into a problem with the upgrade process. I had built the PYNQ image for the UltraZed-EV using the 2019.1 board agnostic image and it appears that the Xilinx runtime (XRT) is not included in that image. PYNQ runs with an Ubuntu OS, so I'll need to find the correct process to install XRT.
In the meantime I decided to try the DPU-PYNQ upgrade on the Ultra96v2.
Here are links to the github repo and a Hackster project:
- https://github.com/Xilinx/DPU-PYNQ
- https://www.hackster.io/wadulisi/easy-ai-with-python-and-pynq-dd4822
PYNQ Framework
PYNQ is useful for prototyping because you can switch out hardware designs on the fly using overlays and now with the Vitis-AI interface you can control the DPU and switch inference models quickly. And the Jupyter notebook interface allows programming in Python or C/C++.
Upgrade process
The process to upgrade PYNQv2.5 to install Vitis-AI is relatively straightforward. If you use one of the supported boards the DPU overlay file (dpu.bit) has already been built. For the UltraZed-EV I needed to build the overlay in Vivado - I'll decribe that when I get the UltraZed-EV working with DPU-PYNQ.
Here is the process I used for the Ultra96v2:
- Create new 16GB SD card using the Avnet Ultra96v2 PYNQv2.5 image http://bit.ly/2MMrXcS
- Boot and log into pynq web console (I use a USB3 to Ethernet dongle so I just use the URL: pynq:9090)
- Open a new terminal (from the web interface this will open as root)
- Clone the DPU-PYNQ github repo to the /home/xilinx directory: git clone --recursive --shallow-submodules https://github.com/Xilinx/DPU-PYNQ.git
- Upgrade PYNQ with Vitis-AI: cd DPU-PYNQ/upgrade; make (this step takes about an hour to complete)
- Install pynq-dpu: pip3 install pynq-dpu
- Copy the pynq-dpu notebooks into your home folder: cd $PYNQ_JUPYTER_NOTEBOOKS; pynq get-notebooks pynq-dpu -p .
Here are the new files in the jupyter_notebooks directory:
A pynq-dpu directory for the new notebooks
There are 5 inference models included (notebooks and model files)
Inference Model | Jupyter notebook | Model file |
---|---|---|
Inception V1 | dpu_inception_v1.ipynb | dpu_inception_v1_0.elf |
MNIST Classifier | dpu_mnist_classifier.ipynb | dpu_mnist_classifier_0.elf |
Resnet50 | dpu_resnet50.ipynb | dpu_resnet50_0.elf |
VART (Inception V1) | dpu_vart_example.ipynb | dpu_tf_inceptionv1_0.elf |
YOLO V3 | dpu_yolo_v3.ipynb | dpu_tf_yolov3.elf |
YOLO V3
I decided that I would give the YOLO V3 example a try. Since I'm partial to Beagles I used a Beagle image as my sample picture.
Run the application - classifies a dog with 100% confidence.
And of course this exercise wouldn't be complete without a frame capture from the webcam.
At least it knows I am a person !
I'll post again when I've tried running other models and trying some video. Hopefully, I'll also get this running on the UltraZed-EV.