A few weeks ago, Xilinx released Vitis AI 1.4. This was around the same time I was working on a project with the Kria SOM for a client on industrial imaging so I thought I would look at what was needed to get started with Vitis AI 1.4.
To get started using Vitis AI and compiling models, the first thing we need is of course a Linux development machine or virtual box. We can download the docker image and install the prerequisites on the development machine or virtual box and start both training and compiling our own model using the Xilinx Model Zoo as a starting point.
We need to ensure we have the Kria set up correctly to work with Vitis AI before we get too far into the creation of our own network trained for our application though. This is what we will examine in this blog.
First we need to download the new image file from here. Once the image has downloaded, we can use etcher or win disk imager to write the WIC image to the SD Card. We can then insert the card and power on the Kria SOM. Ensure both the UART terminal and the Ethernet are added because we need to do additional set up once the system has booted.
To continue set up, download the Vitis AI run time which is available here. Once we have the image downloaded on our development machine, we can transfer it using SCP to the Kria SOM.
Once on the Kria SOM, we can extract the run time and install it using the commands
tar -xzvf vitis-ai-runtime-1.4.x.tar.gz cd /vitis-ai-runtime-1.4.0/2020.2/aarch64/centos/setup.sh bash setup.sh
With the Vitis AI run time installed, the next step is to download the model from the Xilinx Model Zoo that we wish to run. In this case we are going to try the ResNet50 model. The link to the model can be found in YAML file under the selected model.
We can download the model to our Kria SOM by using the command
wget https://www.xilinx.com/bin/public/openDownload?filename=resnet50-zcu102_zcu104_kv260-r1.4.0.tar.gz -O resnet50-zcu102_zcu104_kv260-r1.4.0.tar.gz
Extract the models and install them to the Vitis AI library on the Kria SOM
tar -xzvf resnet50-zcu102_zcu104_kv260-r1.4.0.tar.gz cp resnet50 /usr/share/vitis_ai_library/models -r
The next step is to download the images and videos needed for the example applications. These can be downloaded using the command
wget https://github.com/Xilinx/Vitis-AI/blob/master/demo/ tar -xzvf vitis_ai_runtime_r1.4.0_image_video.tar.gz -C ~/Vitis-AI/demo/
With the images we need for the example now downloaded and the model installed, we are then able to run the demo applications for the Kria SOM on the board.
To run the ResNet50 application, we can change directory into Vitis-AI/demo/VART/resnet50 and issue the command
This correctly classifies the image in the directory shown below as brain coral.
Now that we know how to get up and running with the Vitis AI 1.4 on the Kria SOM, the next step is to look at walking through installation of the Vitis AI tool chain and compilation of the same model from the GPU source from scratch.
Up Coming Book!
Do you want to know more about designing embedded systems from scratch? Check out our upcoming book on creating embedded systems. This book will walk you through all the stages of requirements, architecture, component selection, schematics, layout, and FPGA / software design.
We designed and manufactured the board at the heart of the book!
See the schematics, the layout will be made available on a new website soon!