Skip to content

Setup: Bird Classification

JoMiCos edited this page Apr 19, 2021 · 2 revisions

This Wiki page will cover the background on the object classification implemented which is used to identify who has visited the bird feeder from an image captured. The object classification used in this project uses Tensorflow lite alongside OpenCV on a Raspberry Pi with 32 bit OS.

The purposes of using an object classifier to check the image captured of a visitor are the following:

  1. To identify if the visitor is a bird.
  2. If the visitor is a bird to start the process with will post the picture of the bird on Twitter.
  3. If the visitor is a bird to start the process that updates the daily counter of birds that have visited the bird feeder.

Any website urls provided in this Wiki page were tested working as of 09/04/21.

To utilise the object classification code provided in this repository a number of steps must be followed prior to its use as the code created requires additional libraries and APIs to be generated. The tutorials on installing the additional packages required as well as the original object classifier code were created by Q-Engineering. Permission was obtained to use their code in this repository.

Note: The Raspberry Pi used in this project had a 32 bit OS. If using a 64 bit OS, an additional link will be provided but ensure only 1 type of the package is installed and that this repo has not been tested with a 64 bit OS.

The following are steps that must be followed for the object classification code to work: The tutorials for steps 1 and 2 must also be followed as libraries and directories will be set up in specific file paths which are needed for classification to work correctly and for the executable to built correctly.

  1. TensorFlow lite must be installed on the Raspberry Pi. This will also require c++ API libraries to be built.
  1. OpenCV4 must also be installed.
  1. Download the Bird-Cafe repo
  • The object classification functions are written into the USsensor.cpp file alongside the Ussensor.h file found in the drivers directory.
  • Should any modifications be needed to the picture used for classification it can be edited within the Ussensor.cpp file.
  1. The following files from the repository are required to run the object classification:
  • CMakeLists.txt
  • COCO_labels.txt
  • detect.tflite
  • Please note additional files may be required to run additional parts of the Bird-Cafe repo and will be outlined in their respective Wiki pages.

The original code provided in a Code::Blocks implementation is provided by Q-Engineering at: https://www.github.com/Qengineering/TensorFlow_Lite_SSD_RPi_32-bits

The original code is not required to run the classification but serves as the original source for the TFlite_Classifier.cpp file which is responsible for object detection of an imported image. The repository created by Q-Engineering was used to make a CMakeLists.txt and the TFlite_Classifier code adapted to suit the objectives of this project.

Clone this wiki locally