Skip to content

Latest commit

 

History

History
166 lines (129 loc) · 11.3 KB

README.md

File metadata and controls

166 lines (129 loc) · 11.3 KB

YoloCam

output image

AI camera with live feed, email notification, Gdrive storage and event-triggered GPIO/URL.

License

Introduction.

YoloCam is a software package running on a Raspberry Pi 4, 3 or Zero 2 W.
It transforms the Rpi into a stand-alone AI-powered camera.
With a deep learning model, it detects objects in the camera scene.

You can define what actions YoloCam performs when it recognizes an object.
For instance, send you an email. Or make a movie and store it at Gdrive. Or activate one of its GPIO pins.
At the same time, you can view your footage in any browser.

Installation is simple. Just download the software and flash it to an SD card.
Once inserted into your Raspberry Pi, everything works right away.
The software comes with the latest Raspberry Pi Bullseye operating system.
You don't need to be able to program. However, the used C++ source code is available on the image.

Given the many hours of work, we ask you for a small one-time fee for the license (€ 10,00).
See our shop where we explain how the license works.

output image

A red box is a recognized moving object. Blue boxes are recognized stationary objects.


You might also be interested in YoloIP. YoloIP works with everyday surveillance cameras connected to a network. It can handle up to 8 cameras simultaneously. And, just like YoloCam, events trigger the GPIO and send emails.


Hardware.

To get the YoloCam working, you need the following hardware:

  • A Raspberry Pi 4, 3B+ or Zero 2W.
  • A cheap RPi V1 camera ($ 6,62), as the deep learning model only works with small image sizes.
  • An SD card (min 16 GB) holding all the software.

Camera.

YoloCam is suitable for RaspiCam models V1 and V2. YoloCam does not support Camera Module 3.
Because the AI model works with small-sized images, large images are automatically resized to a lower resolution. That's why there is no real need for an expensive, high-resolution camera. A cheap model V1 will do just fine.

WebCam

With a small adaption in a script, YoloCam also works with most common webcams. Please read the information on this Wiki page.

The YoloCam email version has a Nginx web server on board. It feeds an HLS live stream. You can watch it in any browser.
output image

More FPS?

Reduce the resolution of the HLS live stream. Default set at 1296x972 @ 15 FPS. See the Wiki page.

No 10 Sec time lag?

The 10-second time lag is inherent to HLS streaming. There is no workaround.
The only alternative is the GPIO version. This version monitors real-time, with no latency.


Software.

There are two versions of the YoloCam software. You have to choose which one you want to use.

The GPIO version. This version activates the GPIO output pins when a recognized object triggers an event.
There is a live feed to your browser.
The GPIO outputs act in real time. There is no 10-second latency.
Finally, the GPIO version can trigger URLs.

The email version. This version sends emails and records movies when a recognized object triggers an event.
There is a live feed to your browser. It has a latency of 10 seconds due to the HLS streaming because it takes some time to collect all the information from the stream, get the individual packets and 'glue' them into one video stream. Thanks to this latency, you will receive your emails 5 seconds before the actual movement is visible in your browser so you can log in.
The email version lacks the digital zoom function.

Tip.

Start with the email version if this is your first time using YoloCam. You get a lot of inside information on everything, with a detailed email to help you tune your events. And for the price, you can't beat it. output image


Downloading.

Select the desired version from the matrix below.

Model email GPIO
Raspberry Pi 4 image image
Raspberry Pi 3B+ image image
Raspberry Pi Zero 2W image image

username: pi
password: 3.14


Flashing.

Once the file has been downloaded, flash it to an SD card. Use a good quality SD with a minimum size of 16 GByte for this.
On the Raspberry Pi website, you can follow the instructions on how to flash an image.

Obviously, don't select a standard OS, but the file you just downloaded. For instance' YoloCam_Rpi4_email.xz.

output image

Instead of the Raspberry Pi Imager, some people prefer balenaEtcher. It doesn't matter, they all do a perfect job.


First boot.

Insert your fresh SD card into the slot and power your Raspberry Pi.
Because you don't have a license yet, the YoloCam comes with a unique ID to buy the key.

output image

Follow the instructions and visit the check out site.

output image

After a successful payment, you receive an email with the 8-digit key.
The instructions on how to unlock the app are shown on the congratulations page.
It is all very simple and self-explanatory.


Preparations.

Now that you have your license key, a few settings are required for YoloCam to work properly.
First of all, you need an internet connection. This page explains how to set up the WiFi connection on your Raspberry Pi.

Only if you have the email version you have to follow the next steps. The GPIO version needs no other settings at this point.

  • You need a Google account to redirect emails and save recorded clips. Since your login details are stored in the Raspberry Pi, we recommend a separate Google account for this application. Just for safety reasons.
  • Register your app with Google to get your email password. Follow the instructions on the Wiki page Email notification on how to set email traffic from your Raspberry Pi.
  • To get the authorization key from Google for gdrive, follow the guide on the Wiki page Gdrive. You don't have to install gdrive. It's already on board. You only need the key.
  • Alter the settings to your personal Google account. See for extra information on the Wiki page Settings.
    • cam_name Give a name to your YoloCam. Especially useful if you have more than one YoloCam working.
    • email The email address that receives the notifications. Note, none will block the mail traffic, but not the recording
    • gmail The gmail address associated with the Google account above.

Triggers.

The real beauty of YoloCam lies in its ability to generate triggers when objects are detected.

Each recognized object is tested to see if it should trigger an event.
The event can set or reset an output pin in the case of the GPIO version.
Either, send you an email or start a recording if you have the email version.

Now it's easy to make a video of your dog chewing your slipper when you're not home.
Or a burglar in your backyard, without your cat always setting off the alarm.

The Wiki page Triggers gives you all the instructions you need to set the most sophisticated trigger events.

output image

YoloCam on a Raspberry Pi 4


Overlay.

A less-known fact about SD cards is that they only support a limited number of write cycles. Intense writing wears them out, for example, recording video clips. That's why we enabled recordings on an external USB stick. Or on your Google Drive. Everything to limit writing to the SD card.

The best way to protect your SD card from wear and tear is to use the Raspberry Pi overlay feature.
With the overlay active, no writing to the SD takes place, only to RAM.
Another advantage of the overlay is the protection of the SD card against sudden power cuts.
If a power cut happens during a write cycle, it can corrupt the SD card. Worst case scenario, your Raspberry Pi stops functioning.

All the more reasons to install an overlay. Please follow the instructions on the Wiki page.
You might also read the Wiki page on recordings.


Specs.

Rpi 4 and 3B+ OS: Linux raspberrypi 5.15.84-v8+ #1613 Debian GNU/Linux 11 (bullseye) aarch64 GNU/Linux
Rpi Zero 2W   OS: Linux raspberrypi 5.15.56-v7+ #1575 Debian GNU/Linux 11 (bullseye) armv7l GNU/Linux

AP (Average Precision): 25.8 %

Keep in mind that no deep learning model is perfect. Given the limited computing power of the Raspberry PI, we had to make a compromise.
Our network works amazingly well in everyday use. Even small objects in the background are recognized correctly. Likewise, half-cut objects are on the edge of the image. Yet it sometimes makes mistakes. For example, misinterpreting a truck for a car or bus. An understandable error.

Model email GPIO Load (Amp)
Raspberry Pi 4 3.7 FPS 6.0 FPS 1.1
Raspberry Pi 3B+ 2.5 FPS 3.15 FPS 1.2
Raspberry Pi Zero 2W 2.25 FPS 0.91 FPS 0.6

Gdrive video clips: 640x480 @ 15 FPS.


Tip.

We used the cheap RPi camera V1 for € 6,66. However, the tiny plug from the embedded sensor to the PCB can be loose. The software still reports the camera but didn't receive any video. It took quite a while before we discovered the cause: the connector. Once glued, it now functions perfectly.

output image