1 Idea of Smart DoorBell
There are door bell for visitors to press.
But no need for smart door bell, if visitor approaches , the camera knows someone is coming and trigger door bell or SMS to mobile if you are not at home.
Simple idea but not one easy-to-go task.
2 Hardware and software
Thanks for Element14 for the Raspberry Pi HQ camera Kits. With everything needed.
The raspberry Pi 4B, one HQ camera and HQ lens.
I would like to build the codes on RaspberryPi with VIM only.
That is good enough with latest Raspbian OS buster.
3 First Demo
Connect the Camera and Enable the camera in raspi-config,
SSH and VNC is enable as well for me to build with SSH without the keyboard and screen. In the end, there would be not screen for the door bell.
4 Lens Sets
Here is the lens I have prepared for this project. I need adapter to fit for C-socket. It takes some time to find right adapter, I think it work from Aliexpress.
I shall try Paddlelite from Baidu, enclosed all AI function with API open to dummy like me.
But it takes more time in build the lib
5 Play with AI engine
There are full instruction in github for https://github.com/paddlepaddle/paddle
/*** I would like to go on with lens sets test and AI human detection in next blog. ***/
5.1 Install PaddlePaddle may be new to most of us, but it worth trying. Since it has made many API for dummies like me, especially Paddlehub , change face with AI in a couple of lines in python. Refer to github for more information,
https://github.com/paddlepaddle/paddle ,
Use Lite version of paddlelite in Rasperberrypi as follows,
sudo apt install patchelf
sudo apt-get update
sudo apt-get install -y
gcc g++ make wget python unzip patchelf python-dev
Then,
git clone https://gitee.com/paddlepaddle/paddle-lite.git
cd paddle-lite
git checkout release/v2.8
sudo ./lite/tools/build_linux.sh --arch=armv7hf --with_python=ON --python_version=3.7 --with_cv=ON
It there are erros, mke build thread into 1 take longer time, but it works
export LITE_BUILD_THREADS=1
Then install with pip
pip install paddlelite-28605ee8c-cp27-cp27mu-linux_armv7l.whl
pip install paddlelite-28605ee8c-cp27-cp27mu-linux_armv7l.whl
5.2 Run paddlelite-demo
git clone https://github.com/PaddlePaddle/Paddle-Lite-Demo
cd Paddle-Lite-Demo/PaddleLite-armlinux-demo
./download_models_and_libs.sh
cd Paddle-Lite-Demo/PaddleLite-armlinux-demo/image_classification_demo
Use armv7hr instead of TARGET_ARCH_ABI=armv8, since the Raspbian OS is not for armv8 now. then test the demo.
sudo ./run.sh
5.3 Install OpenCV
Install needed libs
sudo apt-get install libjpeg-dev sudo apt-get install libatlas-base-dev sudo apt-get install libjpeg-dev sudo apt-get install libtiff5-dev sudo apt-get install libpng12-dev sudo apt-get install libqtgui4 libqt4-test sudo apt-get install libjasper-dev
Install openCV
sudo pip install opencv-python or pip install --upgrade opencv-python
5.4 Test camera
Try still image with
raspistill -o test.jpg
Try video with
raspivid -o test.h264 -t 25000 -timed 2500,5000
or with video stream on port 8090, use VLC to open http://ip:8090 for video stream
raspivid -t 0 -w 1280 -h 720 -fps 20 -o - | nc -k -l 8090
That is OK with the camera, but only blur picture, need to adjust the focus and aperture. That is really interesting.