Skip to content

Triggers

Q-engineering edited this page Aug 13, 2022 · 16 revisions

Trigger

A trigger warns you when a particular object is detected. There are three types of triggers.

  • An email trigger that sends you an email.
  • A recording trigger that starts a recording.
  • A GPIO trigger sets a GPIO output pin high (or low).

The first two are available in the email version, the latter only on the GPIO YoloCam.
Different triggers can be combined.

The trigger files are always stored in the /mnt/WRdisk folder, the only folder that is writable when the overlay is active.

output image

Recording trigger

Recoding triggers are listed in the comma separated TrigRec.csv file. The file has the following structure.

Label Probability Move Area

Label
    One of 80 different objects to detect. For example 'car' or 'horse'. Upper or lower case doesn't matter.
Probability
    The probability indicates how well the object is recognized. The lower this number, the more likely a mistake occurs, for instance, a car instead of a truck.
Move
    Indicates the movement of the object. The parameter allows you to filter out static objects, for example, parked cars. Zero (0) disables the parameter.
Area
    Represents the ratio of the area of the recognized object to the entire image. Very small objects of a few pixels can be filtered out in this way.

An example

person , 50 , 10.5 , 0.5  
car    , 50 , 20.0 , 0.8   
bicycle, 50 , 5.5 , 0.5 

A recording can start when a person, a car or a bicycle is recognized in the camera scene.
Each object needs to fulfil additional conditions before it fires a trigger. First, they all have a minimal 50% probability.
The second condition is movement. A person has to move 10.5%, a car 20.0% and a bicycle only 5.5%. These figures are found by trial and error.
The last condition is the size of the scene. A person needs to occupy 0.5% of the scene (640 x 480 x 0.005 = 1536 pixels). Smaller sizes are too unreliable.
A car needs to be 0.8% before it's been detected. And a bicycle 0.5% again.

As soon as a trigger is activated, a recording is started, if no recording was already running.
The recording stops when all triggers are inactive or when the maximum record duration is met (setting rec_max_time).
Note, the recording will prolong some extra seconds (setting prolong).

If you have more objects of the same category, each object will be tested individually against the trigger conditions. As soon as one meets, the trigger is set.

Email trigger

Email triggers are listed in the comma separated TrigMail.csv file. The file has the following structure.

Label Probability Move Area Prio

Prio
    Prioritize the events. A higher priority event can still send an email even if sending is blocked by a lower priority trigger. Remember, once an email is sent, there is a brief time before a second email can be sent, set by the setting no_sec_mail. This blocking mechanism is now governed by the priority scheme.

An example

person , 50 , 10.5 , 0.5 , 2  
person , 50 , 10.5 , 50.0 , 10 
car    , 50 , 20.0 , 0.8 , 1  
truck  , 50 , 20.0 , 0.8 , 1  
bicycle, 50 , 5.5 , 0.5 , 2 

Almost identical to the recording triggers. Only in this case we add the extra prio parameter.

An email is sent when a car or a truck enters the scene. At that time, sending a second email is temporarily blocked.
As explained above, only a trigger with a higher prio (person or bicycle) can overrule the blockage.

In this example, you see two definitions for a person. The first line refers to daily events, such as passers-by at a distance, given the area condition (0.5). The second line relates to a person filling the whole scene (area > 50). Say, someone at your door. Give this a very high prio, and you are sure an email will always send to you.

Since the trigger algorithm ignores the prio condition, you can use the email CSV list for your recordings if you prefer.

Preview of an email. In the diagram, Prio 0 means not active.
output image

GPIO trigger

The csv file for the GPIO has the following structure.

Label Probability Move Area Delay Prolong Pin Inv

COCO labels

All detectable objects:

person bicycle car motorcycle airplane bus train truck boat traffic light
fire hydrant stop sign parking meter bench bird cat dog horse sheep cow
elephant bear zebra giraffe backpack umbrella handbag tie suitcase frisbee
skis snowboard sports ball kite baseball bat baseball glove skateboard surfboard tennis racket bottle
wine glass cup fork knife spoon bowl banana apple tennis racket bottle
broccoli carrot hot dog pizza donut cake chair couch potted plant bed
dining table toilet tv laptop mouse remote keyboard cell phone microwave oven
toaster sink refrigerator book clock vase scissors teddy bear hair drier toothbrush
Clone this wiki locally