Giter Site home page Giter Site logo

pigeon's Introduction

DIY Pigeon Repellent with Artificial Intelligence

Real-Time Pigeon Detection with Raspberry Pi 4 and Coral Edge TPU Acceleration

The purpose of this project is to build a low-cost, low-power consumption pigeon repellent. The algorithm can run in real-time on a Raspberry Pi 4, performing inference on TPU edge devices.

Source video of processed frame.

Processing hardware setup; RPi4 with two Coral Edge USB TPU and external battery power supply

Detection and Classification Models

The algorithm first performs object detection to detect birds with an SSDLite MobileDet network, pretrained on the COCO dataset. Pretrained EdgeTPU detection model and labels.

For each detected bird, the algorithm performs a bird classification second step using a MobilenetV2 network, pretrained on the iNaturalist 2017 (birds) dataset. Pretrained EdgeTPU classification model and labels.

Performance

The current implementation on the above-mentioned test video achieved a frame rate between ~12 and ~20 FPS. The fluctuation of the performance is due to the varying number of classifications performed on the detected birds. If needed, the frame rate could be either optimized by setting a maximum number of birds to be classified, or by adding more TPU for classification.

For better performance, two TPU devices are used where one performs detection, while the other performs classification. Executing two different larger networks on one TPU requires swapping the model on the hardware, which results in performance loss.

The current processing pipeline is sequential, where each processing step has to wait for the previous one to finish. In case of higher performance needs, enabling multi-threading would increase the utilization of the TPUs. The API of the Coral TPU is expected to release the GIL, therefore multi-threading should be sufficient. For more info, see link

Requirements

  • Linux OS (optionally: Raspberry Pi 4)
  • Coral Edge TPU Device (optionally: two devices)

Installation

Devcontainer using VSCode

Linux Base System

  • Clone this repository

    git clone https://github.com/adamp87/pigeon-detection.git;

  • Go into the repository

    cd pigeon-detection;

  • Install dependencies (optionally, set up virtual environment)

    • conda create -n pigeon python=3.7 (optional),
    • conda activate pigeon (optional),
    • pip install -r requirements.txt,
    • Note: tested with PyCoral2,OpenCV4
  • Set up Coral AI USB Accelerator according to Coral AI instructions

    • If conda virtual environment was used, make sure to install PyCoral in the environment
  • Download pretrained model linked in "Detection and Classification Models" section and put in pigeon/models folder

    • Or go to the model folder and execute the download.sh script

Licensing

Source code is licensed under MIT license.

Pretrained models are downloaded from Coral AI, license information can be found on their website.

pigeon's People

Contributors

adamp87 avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.