As a large agricultural country mainly cultivating rice with a long history, China has a total 430-440 million mu rice-cultivating area, which is mainly distributed in the south of the Qinling Mountains-Huaihe River Line (such as the plains of the middle and lower Reaches of the Yangtze River, the Pearl River Delta, the southeast hills, the Yunnan-Guizhou Plateau and the Sichuan Basin, etc.). The proceeding of rice-growing from primitive farming to mechanical cultivation marks a big step forward in agriculture development. However, problems still remained: the wide and uneven distribution of paddy fields usually lead to high cost, time-consuming, lack of timely information of crop-growing, etc. Luckily, nowadays, the emergence of the Internet-of-Things (IoT)-based agriculture makes a qualitative leap in modern agricultural development.
The new IoT-based agriculture includes an intelligent repelling technology that can drive away the wild animals by sound, light, or dummy model. In this lesson, we are going to learn about how to use the object recognition of HUSKYLENS to expel the animals by sounds, and then to monitor the plant protection system remotely through SIoT.
In this project, we are going to learn the object recognition of HUSKYLENS, use the build-in learning function to distinguish the learned animals, and make the buzzer produce sound to drive them away. When the number of animals recognized at the same time reaches the preset limit, the data will be sent to the SIoT by IoT module, allowing the management to monitor the situation. Meanwhile, a LED light could be turned on to alert people for better protecting the plants. All of these functions could make a complete plant protection system.
Image recognition, a vital part of artificial intelligence, refers to the ability of a computer powered camera to identify and detect objects or features in a digital image or video. In this project we will use the image recognition of HUSKYLENS to distinguish and recognize cats and dogs.
1. What Is Image Recognition
Image recognition, a practical application of deep learning algorithm, refers to the processing, analysis, and understanding of images by computer so as to recognize targets and objects in different modes. It is divided into face recognition and product recognition currently. The former is mainly used in security checks, identification, and mobile payment, while the latter can be usually found in the process of commodity circulation, especially unmanned shop, intelligent retail counter, and other unmanned sales fields.
Four steps for traditional image recognition:
Image Capture: capture the image by the camera, and prepare for later recognition.
Image Preprocessing: analyze and process the images through a series of algorithms.
Feature Extraction: according to the information processed in the previous step, extract the key information, such as color, outline, etc.
Image Recognition: compare the information extracted with the sample base, the HUSKYLENS sensor image recognition includes a built-in sample library and it can be enriched by learning.
Similarities and differences between image recognition and other recognition:
we have already learned a lot of functions about camera recognition, such as face recognition and color recognition. What are the differences between them?
We can infer that face recognition, as one of the image recognitions, is specifically used for distinguishing human faces. Imagine this scenario: when a group of people pass the camera, the name of each person can be “called out” if the information has been input in advance, while the image recognition can only offer the result human, human, human.... because it can only recognize objects but not distinguish individuals.
We may find image recognition similar to object tracking. Both of them are function of recognition, but technically, object tracking can only learn and track one object, while image recognition can recognize multiple objects because object tracking learns an object from different angles so that accurate tracking can be achieved while image recognition only learns with only one side and recognition cannot be achieved once from another angle.
Color recognition and QR code recognition are easy to distinguish since they are both specific function-oriented.
Image recognition is widely used in modern medicine because of its explicitness,
non-invasive, safe, and convenient, especially in clinical diagnosis and pathological research. For example, during the period of COVID-19, AI is deployed to quickly review the CT of the patients.
2. Remote Sensing Image Recognition
Aerial remote sensing and satellite remote sensing images are usually processed with image recognition to extract useful information. This technology is mainly used for terrain and geological exploration, forest, water, marine, agricultural and other resource surveys, disaster prediction, environmental pollution monitoring, meteorological satellite cloud image processing, and ground military target recognition.
2. Object Recognition in HUSKYLENS
This function is able to recognize what the object is and track it. 20 objects are supported: airplane, bicycle, bird, boat, bottle, bus, car, cat, chair, cow, dining table, dog, horse, motorbike, person, potted plant, sheep, sofa, train, television. The default setting is to frame and recognize one object. In this chapter, we are going to frame and recognize multiple objects as an example.
1） Operating Settings
Dial the “function button” to the left until “face recognition” is displayed at the top of the screen. Long press the “function button” to enter the parameter setting interface of the submenu of object recognition.
Dial the “function button” to the left or right, select the “learn multiple”. Then dial to the right and turn on the“Learn Multiple”switch, that is, progress bar turns blue and the square icon on the progress bar moves to the right. After that, short press the “function button” to confirm this parameter.
Dial the “function button” to the left and select “save & return”, short press “function button”. It will display “Do you want to save the parameters?”, and “yes” is the default one. Short press the “function button”, the data will be saved, and it will automatically return to the object recognition mode.
2） Object Detection
When detecting objects, HUSKYLENS will automatically recognize it, and the object will be displayed by the white frame with its name on the screen. At present, only 20 built-in objects can be recognized, and the remaining objects cannot be recognized temporarily.
Point the “+” symbol at the object, then short press the “learning button”. When pressing, the color of the frame changes from white to blue, and the name of the object and its ID number will appear on the screen. There will be a notice:” Click again to continue! Click other button to finish”. Please short press the "learning button" before the countdown ends if you want to learn other objects. If not, short press the "function button" before the countdown ends, or just do not press any button to let the countdown ends.
The ID number is related to the order of marking objects. For example: the ID will be displayed as “ID1”, “ID2”, “ID3” in order, and different objects is matched with different colored frames.
4) Object Recognition
When encountering the learned objects, they will be selected by the blue frame, and the name and ID number will be displayed. The size of the frame changes with the size of the object, tracking these objects automatically. Similar objects have the same colored frames, names and IDs. It also supports simultaneous recognition of multiple types of objects, such as recognizing bottles and birds at the same time.
This function can be used as a simple filter to find out what you need from a bunch of objects.
Tip: This function cannot distinguish the differences between objects of the same category. For example, it can only recognize that this is a cat, but cannot recognize what kind of cat it is, which is different from face recognition that can distinguish different faces.
After learning the object recognition of HUSKYLENS, let’s work on the plant protection system project. First, we need to make sure that when recognizing animals, HUSKYLENS can distinguish learned one. Then, we need a buzzer to realize the sound-expelling function. And finally, we need to realize remote monitoring function through the IoT module.
Task1: Sound-Expelling Function
Here we are going to learn how to use HUSKYLENS to recognize an object(bird) and determine whether it is learned. The buzzer will make sound to drive it away if the animal has been learned, otherwise the buzzer will not make any sounds.
Task 2: Remote Monitoring Function
On the basis of learning how to distinguish human faces and execute the feedback function, we can add an IoT module to realize remote monitoring. LEDs can also be added to give the managers a light reminder.
HUSKYLENS: I2C Pin (T—SDA, R—SCL, +—5V, - —GND)
Buzzer: digital pin 5
LED Light: digital pin 4
IoT module: UART port (T—RX（green line), R—TX（green line), +—VCC, - —GND), unplug the RX when uploading the program and plug it in after the successful upload.
Servo: digital pin 9
Here we regard the HUSKYLENS has already learned the information of a certain animal (It may be an animal that is harmful to the growth of the plants, here we choose birds). Once the camera encounters the animal, it just needs to determine whether it is learned. When this system is running, the servo will rotate at a certain angle at regular intervals (the specific time can be set by yourself), so as to realize the function of automatic inspection. When encountering an animal that has been learned before during the inspection, the buzzer will sound to drive the animal away.
Open Mind+ (V1.6.2 and above), switch to “Offline” mode, and click “Extensions”. Choose “Arduino Uno” in “board”, “HUSKYLENS AI Camera” in “Sensor”, “Servo” under “Actuator”, and “OBLOQ IoT Module” under “Communication”.
The camera rotates between 10° and 170° following the servo. During the patrolling, when the camera encounters an animal that has been learned before, the system will drive away the animal by letting the buzzer make sound.
We can add an IoT module on the basis of the previous task. When the number of recognized animals exceeds a certain number, a message will be sent to the web, and the LED light will be turned on to remind the managers.
Let the camera learn the build-in animal in HUSKYLENS in advance, and upload the above program to the main control board. The servo will rotate between 10° and 170°. When the camera encounters an animal that has been learned before in the process of patrolling, the system will drive the animal through the buzzer. When the number of recognized animals exceeds a certain number, a message will be sent to the web, and the LED lights are turned on to remind managers. In this way, we can protect the plants well.
Through the plant protection system project, we learned the object recognition function of HUSKYLENS. We can continue to improve this project, and of course, we can also develop more interesting projects with the object recognition function. Do you have any fun ideas? Give it a try now!
1. Learn the working principle of face recognition.
2. Learn the learning process of face recognition of HUSKYLENS.
3. Learn the related instructions about face recognition of HUSKYLENS.
In this project, we use the sound made by the buzzer to drive the animals. But in real life, the sound of the buzzer is too low to expel a wild animal. Is there a better way to realize the function? We can make a dummy by multiple servos, and make some decorations to make it look like the animal’s natural enemies or humans. And then control the movements of servos by code to achieve the expelling effect.