For Edge
Use the following steps to set up the host for edge device development.
- Download the sdk.sh from https://github.com/Xilinx/Vitis-AI.
- Install the cross-compilation system environment.
$./sdk.sh
- Follow the prompts to install. Note:
The ~/petalinux_sdk path is recommended for the installation. Regardless of the path you choose for the installation, make sure the path has read-write permissions. Here we install it under ~/petalinux_sdk.
- When the installation is complete, follow the prompts and execute the
following
command.
If you close the current terminal, you need to re-execute the above instructions in the new terminal interface.$. ~/petalinux_sdk/environment-setup-aarch64-xilinx-linux
- Download the vitis_ai_2019.2-r1.1.0.tar.gz from https://github.com/Xilinx/Vitis-AI and install it to the petalinux system.
$tar -xzvf vitis_ai_2019.2-r1.1.0.tar.gz -C ~/petalinux_sdk/sysroots/aarch64-xilinx-linux
- Update the glog to v0.4.0.
- Download the glog package and untar it.
$cd ~ $curl -Lo glog-v0.4.0.tar.gz https://github.com/google/glog/archive/v0.4.0.tar.gz $tar -zxvf glog-v0.4.0.tar.gz $cd glog-0.4.0
- Build it and install it to the PetaLinux
system.
$mkdir build_for_petalinux $cd build_for_petalinux $unset LD_LIBRARY_PATH; source ~/petalinux_sdk/environment-setup-aarch64-xilinx-linux $cmake -DCPACK_GENERATOR=TGZ -DBUILD_SHARED_LIBS=on -DCMAKE_INSTALL_PREFIX=$OECORE_TARGET_SYSROOT/usr .. $make && make install $make package
- Download the glog package and untar it.
- Clone the Vitis AI
repository:
$cd ~ $git clone https://github.com/xilinx/vitis-ai
- Cross compile the demo in the AI
Library, using yolov3 as
example.
$cd ~/Vitis-AI/Vitis-AI-Library/overview/demo/yolov3 $bash -x build.sh
If you do not want to print information during compilation, execute the following command.
$bash build.sh
If the compilation process does not report any error and the executable file demo_yolov3 is generated, the host environment is installed correctly.
- To compile the library sample in the AI Library, take
classification
for example, execute the following command.$cd ~/Vitis-AI/Vitis-AI-Library/overview/samples/classification $bash -x build.sh
The executable program is now produced.
- To modify the library source code, view and modify them under ~/Vitis-AI/Vitis-AI-Library.
Before compiling the AI libraries, please confirm the compiled output path. The default output path is : $HOME/build.
If you want to change the default output path, please modify the build_dir_default in cmake.sh. Such as, 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, it’s suggested to modify $HOME only.
Execute the following command to build the libraries all at once.
$cd ~/Vitis-AI/Vitis-AI-Library $./cmake.sh --clean --cmake-options='-DCMAKE_NO_SYSTEM_FROM_IMPORTED=on'
After compiling, you can find the generated AI libraries under build_dir_default. If you want to change the compilation rules, check and change the
cmake.sh
in the library’s directory.Note: All the source code, samples, demos, and head files can be found in~/Vitis-AI/Vitis-AI-Library
.
For Cloud
The host side development environment for the cloud is setting up by docker image.- Download the vitis-ai-cpu image from https://github.com/Xilinx/Vitis-AI.
- Set up the docker runtime system according to the docker installation
document.
$./docker_run.sh -X xilinx/vitis-ai-cpu:<x.y.z>
Note: A workspace folder will be created by the docker runtime system. And it will be mounted in /workspace of the docker runtime system. - Place the program, data and other files to be developed in the
workspace folder. After the docker
system starts, you will find them in the /workspace of the docker system.
Do not put the files in any other path of the docker system. They will be lost after you exit the docker system.
- Download the libvitis_ai_library-1.1.0-Linux-build46.deb from https://github.com/Xilinx/Vitis-AI and install it to the docker
system.
$sudo dpkg -i libvitis_ai_library-1.1.0-Linux-build46.deb
- Download the U50 model package from https://github.com/Xilinx/Vitis-AI
and Install it.
$sudo dpkg -i xilinx_model_zoo-1.1.0-Linux.deb
- Download the xclbin files from https://github.com/Xilinx/Vitis-AI
and Install them.
$sudo cp dpu.xclbin hbm_address_assignment.txt /usr/lib
- Using Git, clone the corresponding AI Library from https://github.com/Xilinx/Vitis-AI.
$cd /workspace $git clone https://github.com/Xilinx/Vitis-AI.git
- Export the library
path.
$export INTERNAL_BUILD=1 $export LD_LIBRARY_PATH=/opt/xilinx/xrt/lib:/usr/lib:/usr/lib/x86_64-linux-gnu:/opt/vitis_ai/conda/envs/vitis-ai-tensorflow/lib/
- Compile the demo in the AI
Library, using yolov3 as
example.
$cd /workspace/Vitis-AI/Vitis-AI-Library/overview/demo/yolov3 $bash -x build.sh
If you do not want to print information during compilation, execute the following command.
$bash build.sh
If the compilation process does not report any error and the executable file demo_yolov3 is generated, the host environment is installed correctly.
- To compile the library sample in the AI Library, take
classification
for example, execute the following command.$cd /workspace/Vitis-AI/Vitis-AI-Library/overview/samples/classification $bash -x build.sh
The executable program is now produced.
- To modify the library source code, view and modify them under /workspace/Vitis-AI/Vitis-AI-Library.
Before compiling the AI libraries, please confirm the compiled output path. The default output path is : $HOME/build.
If you want to change the default output path, please modify the build_dir_default in cmake.sh. Such as, 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, it is suggested to modify $HOME only.Execute the following command to build the libraries all at once.
$cd /workspace/Vitis-AI/Vitis-AI-Library $./cmake.sh --clean --cmake-options='-DCMAKE_NO_SYSTEM_FROM_IMPORTED=on'
After compiling, you can find the generated AI libraries under build_dir_default. If you want to change the compilation rules, check and change the
cmake.sh
in the library’s directory.