Real-time AI Pest Elimination on Edge Devices: Getting Started





5.00/5 (2 votes)
In this article, we compared two DNN types we can use to detect pests: detectors and classifiers.
Introduction
Unruly wildlife can be a pain for businesses and homeowners alike. Animals like deer, moose, and even cats can cause damage to gardens, crops, and property.
In this article series, we’ll demonstrate how to detect pests (such as a moose) in real time (or near-real time) on a Raspberry Pi and then take action to get rid of the pest. Since we don’t want to cause any harm, we’ll focus on scaring the pest away by playing a loud noise.
This series will guide you through several steps. First, we’ll show you how to apply a pre-trained deep neural network (DNN) detector to find pests on video. We’ll then describe the possible solutions for detecting unusual pests that cannot be detected with most of the existing DNN detectors. Next, we’ll focus on the implementation of the selected approach. We’ll explain how to gather a dataset for DNN training and provide data augmentation methods for extending the dataset. We’ll train a DNN for detecting a rare pest, then we’ll develop the computer code for a simple motion detector and explain how to use it together with the trained DNN. Finally, we’ll adapt the code for Raspberry Pi and show you how to play a scary sound to chase the detected pests away.
The project code will be written in Python 3.7 to run on a PC and then on a Raspberry Pi device. The OpenCV library will provide us with computer vision algorithms, and the Caffe DL framework will be used for DNN training. These software pieces are easy to download and install on your PC.
You are welcome to download the source code of the project. We are assuming that you are familiar with Python and have a basic understanding of how neural networks work.
Selectors vs. Detectors
Our first task is to detect a pest in the video stream from a camera using an edge device like Raspberry Pi. We’ll use AI to solve this problem. The most powerful modern AI approach to image recognition and video processing is to use deep neural networks (DNNs). Various types of DNNs have been successfully applied to the most difficult problems in computer vision, including the detection of various objects: humans, animals, and so on.
Overall, a detector network will be a more viable option in our case, so a detector it is!
What About Real-Time?
Detector DNNs can definitely help us solve the first part of our problem — detect a pest in an image. If we can do that, we’ll also be able to detect pests in a video stream. The only question is whether we can do it in real time on an edge device, such as a Raspberry Pi. These devices aren’t very powerful, so we should be very careful when selecting a neural network. We need one that can run in real-time on our edge device. See this article for a deep-dive into choosing object detector neural networks suitable for edge devices.
Next Step
In the next article, we’ll use a pre-trained DNN to detect pests on video.
History
- 15th December, 2020: Initial version