Published © MIT

NXP Hovergames Viral Airborne Detection System

Airborne AI system roams over large gatherings detecting Covid19 infections and alerting emergency personnel to contain spread.

AdvancedFull instructions providedOver 3 days860
NXP Hovergames Viral Airborne Detection System

Things used in this project

Hardware components

KIT-HGDRONEK66
NXP KIT-HGDRONEK66
×1
RDDRONE-FMUK66
NXP RDDRONE-FMUK66
×1
NXP i.MX8M Mini Navq
×1
Intel RealSense Camera
Intel RealSense Camera
×1
Silex SX-NEWAH 802.11ah module
×1
Hamamatsu C13560 Raman SERS Spectrscopy Module
×1
Google Coral High-Def Camera
×1

Software apps and online services

Snappy Ubuntu Core
Snappy Ubuntu Core
QGroundControl
PX4 QGroundControl
PX4
PX4

Hand tools and fabrication machines

3D Printer (generic)
3D Printer (generic)

Story

Read more

Custom parts and enclosures

Hovergames2 Navq Mount for Ian's Enclosure

Mount for Ian's 3D printed case for the drones rails

Mount for Hovergames2 Coral Camera

Adjustable mount for the Coral High-Def camera on the drone's rails

Code

eIQ Navq Build Script

SH
This script builds the NXP eIQ framework on for the Navq under the Ubuntu 20.04 OS created for this project
#!/bin/bash

mv /etc/resolv.conf /etc/resolv.conf.orig
echo "nameserver 8.8.8.8" > /etc/resolv.conf

#install pre-requisites
echo -n "updating packages..."
apt-get update
apt-get install -y --fix-missing libprotobuf-dev protobuf-compiler flatbuffers-compiler
apt-get install -y libleveldb-dev libsnappy-dev libopencv-dev libhdf5-serial-dev
apt-get install -y --no-install-recommends libboost-all-dev
apt-get install -y libgflags-dev libgoogle-glog-dev liblmdb-dev
apt-get install -y libopenblas-dev
apt-get install -y libatlas-base-dev libblas-dev
apt-get install -y the python3-dev python3-skimage python3-numpy python3-wheel zlib1g-dev zip unzip swig autoconf automake libtool
apt-get install -y ocl-icd-dev
apt-get install -y wget
apt-get install -y default-jdk
#apt-get install -y armnn libarmnn-dev
pip3 install pydot scons bazel zipper wheel keras_preprocessing --no-deps
echo "done"

# download and compile NXP's variant of the ARM compute library
echo -n "compiling and installing arm-computelibrary..."
cd /usr/src
if [ ! -d arm-computelibrary-imx ]; then
    git clone git://source.codeaurora.org/external/imx/arm-computelibrary-imx.git -b rel_imx_5.4.47_2.2.0
fi
cd ./arm-computelibrary-imx
#pkg-config --libs --cflags OpenCL
scons extra_cxx_flags="-fPIC" internal_only=0 build=native os=linux neon=1 opencl=1 embed_kernels=1 gles_compute=0 arch=arm64-v8a Werror=0 examples=0 benchmark_tests=0 validation_tests=1 -j1
cp -Prf --preserve=mode,timestamps --no-preserve=ownership ./build/libarm_compute*.so /usr/local/lib/
cp -Prf --preserve=mode,timestamps --no-preserve=ownership ./build/libarm_compute*.a /usr/local/lib/
cp -Prf --preserve=mode,timestamps --no-preserve=ownership arm_compute /usr/local/include
cp -Prf --preserve=mode,timestamps --no-preserve=ownership support /usr/local/include
cp -Prf --preserve=mode,timestamps --no-preserve=ownership include/half /usr/local/include
#cp ./build/tests/arm_compute_benchmark /usr/local/bin
#cp ./build/tests/arm_compute_validation /usr/local/bin
#cp ./build/tests/libarm_compute_validation_framework.a /usr/local/lib
ldconfig
echo "done"

# caffe
echo -n "installing caffe..."
apt build-dep -y caffe
apt install -y caffe libcaffe-dev
echo "done"

# onnxruntime
echo -n "installing onnx runtime..."
ln -s /usr/bin/python3 /usr/bin/python
python3 -m pip install onnx
echo "done"

# opencv
echo -n "compiling and installing opencv..."
cd /usr/src
if [ ! -d opencv-imx ]; then
    git clone git://source.codeaurora.org/external/imx/opencv-imx.git -b 4.2.0_imx
fi
cd opencv-imx
mkdir build
cd build 
cmake ../ \
-DWITH_QT=ON \
-DWITH_OPENVX=ON
make install -j$(($(nproc) - 1))
echo "done"

# nn-imx
#echo -n "compiling and installing nn-imx..."
# cd /usr/src
# if [ ! -d nn-imx ]; then
#     git clone git://source.codeaurora.org/external/imx/nn-imx.git -b imx_1.1.9
# fi
# cd nn-imx
# export AQROOT=`pwd`
# make install -j$(($(nproc) - 1))
#echo "done"

# bazel
echo -n "compiling and installing bazel..."
cd /usr/src
if [ ! -d bazel ]; then
    mkdir bazel
    cd bazel
    wget https://github.com/bazelbuild/bazel/releases/download/2.0.0/bazel-2.0.0-dist.zip
    unzip ./bazel-2.0.0-dist.zip
fi
export CPATH=/usr/lib/jvm/java-1.11.0-openjdk-arm64
export C_INCLUDE_PATH=/usr/lib/jvm/java-1.11.0-openjdk-arm64
export CPLUS_INCLUDE_PATH=/usr/lib/jvm/java-1.11.0-openjdk-arm64
export JAVA_HOME=/usr/lib/jvm/java-1.11.0-openjdk-arm64
env EXTRA_BAZEL_ARGS="--local_ram_resources=HOST_RAM*.5 --local_cpu_resources=HOST_CPUS-1 --host_javabase=@local_jdk//:jdk" bash ./compile.sh
cp /opt/builds/bazel-2.0.0/output/bazel /usr/local/bin/bazel
echo "done"

# tensorflow-imx
echo -n "compiling and installing tensorflow..."
cd /usr/src
if [ ! -d tensorflow-imx ]; then
    git clone git://source.codeaurora.org/external/imx/tensorflow-imx.git -b imx_5.4.47_2.2.0
fi
cd tensorflow-imx
pushd ./tensorflow/lite/tools/make/downloads/flatbuffers
mkdir build
cd build 
cmake ..
make -j$(($(nproc) - 1))
make install
ldconfig
popd
pushd ./tensorflow/lite/tools/make/downloads/absl
mkdir build
cd build 
cmake ..
make -j$(($(nproc) - 1))
make install
ldconfig
popd
export TENSORFLOW_TARGET=aarch64
make -f tensorflow/lite/micro/tools/make/Makefile clean_downloads
make -f tensorflow/lite/micro/tools/make/Makefile clean
make -f tensorflow/lite/micro/tools/make/Makefile test_hello_world_test
bash ./tensorflow/lite/tools/make/download_dependencies.sh
bash ./tensorflow/lite/tools/pip_package/build_pip_package.sh
bash ./tensorflow/lite/tools/make/build_aarch64_lib.sh
bazel build --config=elinux_aarch64 -c opt //tensorflow/lite:libtensorflowlite.so
make -f ./tensorflow/lite/tools/make/Makefile -j$(($(nproc) - 1))
for lib in ./tensorflow/lite/tools/make/gen/linux_${TENSORFLOW_TARGET}/lib/*
do
        cp $lib /usr/local/lib
done
echo "done"

# armnn
echo -n "compiling and installing armnn..."
cd /usr/src
if [ ! -d armnn ]; then
    git clone https://github.com/ARM-software/armnn.git
fi
cd armnn
mkdir build
cd build
cmake .. \
-DARMCOMPUTE_ROOT=/usr/src/arm-computelibrary-imx/ \
-DARMCOMPUTE_BUILD_DIR=/usr/src/arm-computelibrary-imx/build/ \
-DARMCOMPUTE_LIBRARY_RELEASE=/usr/local/lib/libarm_compute.so \
-DARMCOMPUTENEON=1 \
-DARMNNREF=1 \
-DBUILD_CAFFE_PARSER=1 \
-DBUILD_ONNX_PARSER=1 \
-DARMCOMPUTECL=1 \
-DBUILD_TF_PARSER=1 \
-DBUILD_TF_LITE_PARSER=1 \
-DBUILD_UNIT_TESTS=1 \
-DVSI_NPU=1 
make -j$(($(nproc) - 1))
echo "done"

#pytorch

#eiq sample apps
echo -n "installing eiq sample apps..."
cd /usr/src
git clone https://source.codeaurora.org/external/imxsupport/eiq_sample_apps/
echo "done"

rm /etc/resolv.conf
mv /etc/resolv.conf.orig /etc/resolv.conf

Credits

Comments