Baltic Robbo Battles 2021 – object detection and classification – next round

This time approach is different – to use ready-to use model on RaspberryPI and try to detect objects. I followed this tutorial:

and this tutorial was also helpful during installation of TensorFlow on RaspberryPI:

and here are my steps:

  1. install required components on RaspberryPI – Python 3.7.1 ,Tensorflow 2.2.0, Keras,OpenCV:
sudo apt-get update
sudo apt-get dist-upgrade
sudo apt install python3-pip
pip3 install --upgrade pip
sudo apt-get install -y libhdf5-dev libc-ares-dev libeigen3-dev gcc gfortran python-dev libgfortran5 \
                          libatlas3-base libatlas-base-dev libopenblas-dev libopenblas-base libblas-dev \
                          liblapack-dev cython libatlas-base-dev openmpi-bin libopenmpi-dev python3-dev python3-venv
sudo apt-get install libjpeg-dev libtiff5-dev libjasper-dev libpng12-dev libavcodec-dev libavformat-dev libswscale-dev libv4l-dev libxvidcore-dev libx264-dev qt4-dev-tools libatlas-base-dev
apt-get install libssl-dev
apt-get install make build-essential libssl-dev zlib1g-dev libbz2-dev libsqlite3-dev
sudo apt-get install libssl1.0
mkdir ~/libssl1.0-dev
cd ~/libssl1.0-dev
apt-get download libssl1.0-dev
ar x libssl1.0-dev* data.tar.xz
tar -xf data.tar.xz --strip-components=2

# Second, specifically get your current system's SSL headers
# and make symbolic-links

libcrypto=$(ls /usr/lib/arm-linux-gnueabihf/ | grep
libssl=$(ls /usr/lib/arm-linux-gnueabihf/ | grep

ln -s /usr/lib/arm-linux-gnueabihf/${libcrypto} ~/libssl1.0-dev/lib/x86_64-linux-gnu
ln -s /usr/lib/arm-linux-gnueabihf/${libssl} ~/libssl1.0-dev/lib/x86_64-linux-gnu

sudo pip3 install keras_applications==1.0.8 --no-deps
$ sudo pip3 install keras_preprocessing==1.1.0 --no-deps
$ sudo pip3 install h5py==2.9.0
$ sudo pip3 install pybind11
pip3 install -U --user six wheel mock

$ sudo -H pip3 install --upgrade setuptools
# install gdown to download from Google drive
$ pip3 install gdown
# copy binairy
$ sudo cp ~/.local/bin/gdown /usr/local/bin/gdown
# download the wheel
$ gdown
# install TensorFlow (± 63 min @1950 MHz)
sudo -H pip3 install tensorflow-2.2.0-cp37-cp37m-linux_armv7l.whl wrapt --upgrade --ignore-installed
apt-get install libstdc++6
sudo reboot

When I had environement installed – it took in my case 3h;(, I started playing with TensorFlow on RaspberryPI.

First of all check this:

>>> import tensorflow as tf
>>> print(tf.__version__)

Now download demo of YOLOv3 object detection using:

 git clone

Install additional dependencies (including pandas and numpy):

sudo pip3 install numpy>=1.18.2
sudo pip3 install scipy>=1.4.1
sudo pip3 install wget>=3.2
sudo pip3 install seaborn>=0.10.0
sudo pip3 install tqdm==4.43.0
sudo pip3 install pandas
sudo pip3 install awscli
sudo pip3 install urllib3
pip install opencv-python

Now I downloaded tiny weights of YOLOv3 model ( I have also RaspberryPI3):

# yolov3-tiny
wget -P model_data

I have already Pico camera installed and which was installed acc. to this tutorial:

After running first demo I have following results as shown on the pictures:

This is exemplary image. As shown – people and kites are recognized very well.

Here is image from my camera – live view:

Dodaj komentarz

Twój adres e-mail nie zostanie opublikowany.