my aiming is make a image security device, because of lack of security in chinese university's dormitory.
first, I flash the pynq2.5 img in to the SD card, and update pynq to 2.5.1.
then, using vitis-ai tool to deploy yolov3 model.
even if I wear a mask, also can detected my head. it seems like yolov3 is robusted!
- get pynq img
- flash sd card
using balena Etcher 1.5.105-x64
- boot the board link USB to PC, and open Chrome, open 192.168.3.1 IP.
- open jupyter notebook and link WIFI AP to access internet.
- if you are in China, I recommand to use my repo to update pynq. I changed original repo of DPU-PYNQ, following is command line:
pip3 install --upgrade -i https://pypi.tuna.tsinghua.edu.cn/simple cython==0.29.21
pip3 uninstall pynq
pip3 install --default-timeout=3000 -i https://pypi.tuna.tsinghua.edu.cn/simple pynq==2.5.1
git clone --recursive --shallow-submodules https://gitee.com/lebment/DPU-PYNQ.git (faster than original repo if you are in china)
cd DPU-PYNQ/upgrad
make (might an hour to finish)
pip3 install --default-timeout=3000 -i https://pypi.tuna.tsinghua.edu.cn/simple pynq-dpu
cd $PYNQ_JUPYTER_NOTEBOOKS
pynq get-notebooks pynq-dpu -p.
- compile yolov3 model
vitis 2020.2 and XRT 2020.1 needed
On PC,cd DPU-PYNQ/board dir, change check_env.sh to this:
#!/bin/bash
set -e
if [[ -z $(vitis -version | fgrep 2020.2) ]]; then
echo "Error: Please source Vitis 2020.2 settings."
exit 1
fi
if [[ -z ${XILINX_XRT} ]]; then
echo "Error: Please source XRT 2020.1 settings."
exit 1
fi
cd DPU-PYNQ/vitis-ai-git/DPU_TRD/dpu_ip/dpu_eu_v3_2_0, change componetn.xml, 2019.2 to 2020.2.
cd DPU-PYNQ/boards
change get_platform.sh file to:
#!/bin/bash
BOARD=$1
VITIS_PLATFORM=$2
DOWNLOAD=$3
PFM_NAME=$(echo $2 | rev | cut -d'/' -f1 | rev | cut -d'.' -f1)
CURDIR=$(pwd)
URL="https://www.xilinx.com/bin/public/openDownload?filename=${PFM_NAME}_2019.2.zip"
# platform can be either downloaded or built from scratch
if [[ $DOWNLOAD -eq 1 ]]; then
cd ${BOARD}
wget $URL -O ${PFM_NAME}.zip
unzip ${PFM_NAME}.zip
rm ${PFM_NAME}.zip
else
if [ ! -d PYNQ-derivative-overlays ]; then
git clone https://gitee.com/lebment/PYNQ-derivative-overlays.git
cd PYNQ-derivative-overlays
git checkout -b temp tags/v2019.2
fi
cd ${CURDIR}/PYNQ-derivative-overlays/dpu
make clean && make BOARD=${BOARD}
cd ${CURDIR}/PYNQ-derivative-overlays/vitis_platform
make XSA_PATH=../dpu/dpu.xsa BOARD=${BOARD}
cp -rf ${CURDIR}/PYNQ-derivative-overlays/vitis_platform/${BOARD}/platforms/${PFM_NAME} \
${CURDIR}/${BOARD}
fi
cd ${CURDIR}
then
. your vitis path/vitis/2020.2/setting64.sh
. /opt/xilinx/xrt/setup.sh
make BOARD=Ultra96
wait to gen dpu.tcl file, in PYNQ-derivative-overlays,change "2019.2" to "2020.2",and continue make
make BOARD=Ultra96
- install docker on PC( if you are in china)
sudo apt-get remove docker docker-engine docker.io
sudo apt-get install apt-transport-https ca-certificates curl gnupg2 software-properties-common
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add -
echo "deb [arch=armhf] https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/debian \
$(lsb_release -cs) stable" | \
sudo tee /etc/apt/sources.list.d/docker.list
sudo apt-get update
sudo apt-get install docker-ce
- create docker group
sudo groupadd docker
newgrp docker
- cd to vitis-AI (git clone it)
docker pull xilinx/vitisi-ai
- run docker and test transform a yolov3 file,copy DPU-PYNQ/boards/Ultra96/dpu.hwh and compile.sh to Vitis-AI/docker/
cd Vitis-AI
./docker_run.sh xilinx/vitis-ai:latest
./compile.sh Ultra96 tf_yolov3_voc_416_416_65.63G_1.1 (might take ten minutes)
- finally, run my jupyter code of yolov3.
more function can be add to this board in the futrue.,such as face mask detection( image bellow, running at PC, can be transplant to the board by using Vitis-AI quantization tool and transform tool).
Comments