Set up the host by running the Docker
image.
- Clone the Vitis AI
repository.
$ git clone https://github.com/Xilinx/Vitis-AI $ cd Vitis-AI - Run the Docker container according to the instructions in the Docker installation
guide.
$ ./docker_run.sh -X xilinx/vitis-ai-<pytorch|tensorflow2|tensorflow>-cpu:latestNote: A workspace folder is created by the Docker runtime system and is mounted in the /workspace folder of the Docker runtime system. - Place the program, data, and other files to be developed in the workspace folder. After the Docker system starts,
locate them in the /workspace folder of the
Docker system.Warning: Do not put the files in any other path of the Docker system. They will be erased after you exit the Docker system.
- Select the model for your platform. You can find the download links for the
latest models in the yaml files of the model in the
Vitis-AI/model_zoo/model-listlocation.- If the /usr/share/vitis_ai_library/model folder does not exist,
create it
first.
$ sudo mkdir -p /usr/share/vitis_ai_library/models - For the Versal V70 Prod card, take
resnet_v1_50_tfas an example.$ wget https://www.xilinx.com/bin/public/openDownload?filename=resnet_v1_50_tf-v70-DPUCV2DX8G-r3.5.0.tar.gz -O resnet_v1_50_tf-v70-DPUCV2DX8G-r3.5.0.tar.gz $ tar -xzvf resnet_v1_50_tf-v70-DPUCV2DX8G-r3.5.0.tar.gz $ sudo cp resnet_v1_50_tf /usr/share/vitis_ai_library/models -r
- If the /usr/share/vitis_ai_library/model folder does not exist,
create it
first.
- Download the xclbin package from here. Untar it, select the Versal card DPU IP and install
it.
$ sudo tar -xzvf DPUCV2DX8G_xclbins_3_5_0.tar.gz -C / $ export XLNX_VART_FIRMWARE=/opt/xilinx/overlaybins/DPUCV2DX8G/V70/dpu_DPUCV2DX8G_250M_xilinx_v70_gen5x8_qdma_base_2.xclbin - If there is more than one card installed on the server and you want to
which cards will be used for inference, you can set XLNX_ENABLE_DEVICES to achieve this function. The following is
the usage of XLNX_ENABLE_DEVICES:
-
export XLNX_ENABLE_DEVICES=0: Only use device 0 for DPU. -
export XLNX_ENABLE_DEVICES=0,1,2: Use device 0, device 1, and device 2 for DPU. - If you do not set this environment variable, all devices are used for DPU (default).
-
- To compile the library sample in the
Vitis AI Library, takeclassificationfor example, execute the following command:$ cd /workspace/examples/vai_library/samples/classification $ bash -x build.shThe executable program is now produced.
- To modify and compile the library source under /workspace/src/vai_library.
Before compiling the
Vitis AI Library, confirm the compiled output path. The default output path is $HOME/build.If you want to change the default output path, modify the build_dir_default in cmake.sh. For example, change from build_dir_default=$HOME/build/build.${target_info}/${project_name} to build_dir_default=/workspace/build/build.${target_info}/${project_name}.
Note: If you want to modify the build_dir_default, modify $HOME only. - Execute the following command to build the libraries all at
once:
$ cd /workspace/src/vai_library $ conda activate base $ ./cmake.sh --cleanAfter compiling, you can find the generated
Vitis AI Libraryunder build_dir_default. If you want to change the compilation rules, check and change the cmake.sh in the library’s directory.