Although contemporary society is much safer than hundred years ago, nowadays we still worry about whether there is any suspicious people staying outside our home, especially when we are alone at night.Therefore, I thought that I could use visual AI and machine learning to identify whether there is a suspicious person staying outside the door for a long time and generate a warning in advance. At the same time, I can also see the real-time image of the suspicious person through the camera on my computer.As a newcomer to the open-source hardware universe, I chose Seeed Studio's cost-effective SenseCAP K1100 kit to complete this project: select the adequate data set on the Roboflow platform and train the model to deploy to the Grove Vision AI module (I also tried human body detection module that comes with the module), write the conditional code that triggers the buzzer on Wio Terminal, when a suspicious person appears, the buzzer will make a sound, and then see the real-time image of the suspicious person through the camera module connected on the computer.
Preparation:- How the others have done security systems on Raspberry Pi, Arduino..
- Confirm what hardware to use and get the kit
- Learn the basics of the Grove Vision AI Module and Wio Terminal
- Learn how to run Wio Terminal on Arduino
- Get the knowledge of train and deploy model on Grove Vision AI Module
- Learn the built-in hardware of Wio Terminal and its coding
1. Train the model
Here I tried two different methods, first was to get a new model on Robotflow (an image annotating platform) and train on Google Colab, and another is to use the default people detection model in the sensor. The difference is that the first model can help identify the gender (for example, if you are a female living alone, you might be more careful about suspicious males outside your room [not mean any sexism here], while the latter one can help detect whether there is a person and how many of them.
Way 1: Get the new data set on Roboflow and train the new model
By searching 'human detection', or 'face detection', or 'gender detection' on Roboflow and select the one that fits my needs. I always check the number of images trained in the model and its precision level, no doubt that a model with more images with more angles and a higher level of precision is ideal.
Here is the data set I tried, it comes with 2k+ images annotating male and female, and its precision is said to be higher than 95%.
After downloading the dataset set as Yolo V5 Pytorch format, leaving the code in the background and trained on Google Colab to get the trained model file.
The training environment on Google Colab is pre-set by Seeed Studio, hence it is quite easy to follow the steps. The only thing to keep an eye on is to change the code in step 4 by using code that is generated on Roboflow.
Way 2: Use the default people detection model trained in the Grove Vision AI sensor
Be aware that if you load the customized model first, the default setting will be deleted and hence the new model has to be reloaded (remember to change the original code to Model_EXT_INDEX_1, as I tried the Pre_trained model code but it turned out a failure)
2. Deploy the model to the Grove Vision AI sensor
Connect the Grove Vision AI sensor to the computer, and double click the button on it to enter the mass storage mode, put the model trained with Google Colab in the previous stage to it.
3. Set up Wio Terminal with Arduino software
Here I tried two versions of Arduino IDE (the latest one is version 2.0.2 did not work when I tried to upload the program, then I changed to version 1.8.19 and it worked!)
Seeed Studio already provides detailed instruction on how to get started with Wio Terminal, simply follow the steps listed in the preparation guidance and everything will go on smoothly.
4. Connect Grove Vision AI Sensor to the Wio Terminal
Get Wio Terminal powered on and the sensor connected, I also changed the code to MODEL_EXT_INDEX_[value] (here I use MODEL_EXT_INDEX_1) to instruct the device to use the external trained model.
Sometimes either the board or the sensor is not detected, try to plug and unplug it for several times, or leave the Grove Vision AI sensor idle for a few minutes would solve that problem. A small hint here: no need to plug in several times to get which port represents Wio Terminal, it will automatically inform you when the program uploaded to Wio Terminal failed.
After loading the program and opening the website that Seeed Studio has prepared for the Grove Vision AI sensor, the real-time image captured by the sensor will be displayed, together with the inference result.
The result suggests that a person is detected (me) with the confidence level at 87, and the number of person is 1 (me) with a confidence level at 85.
5. Run the passive buzzer code on Wio Terminal
Since I not only need the inference result that there is a person outside my room, but also need an alert triggered by the event, a buzzer will help.
Wio Terminal has an embedded buzzer as shown below, therefore, I found the code to trigger it and tested in the Wio Terminal. It turned out successfully.
6. Set contional code to trigger the buzzer while there is a person detected for more than 20s
Work in progress..
Comments
Please log in or sign up to comment.