-
Notifications
You must be signed in to change notification settings - Fork 1
Triggers
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 found at /mnt/WRdisk/
.
The /mnt/WRdisk/
location is only folder which can be writen even with the overlay function active. All the other folders will not hold their data after a reboot. See the overlay item for more information.
👉 Because the triggers are loaded during booting, changes will not take effect until you restart the YoloCam.
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.
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).
There may be more identical objects detected, five cars for instance. In that case, each object is tested individually against the trigger conditions. As soon as one meets, the trigger fires.
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 next email can be sent, set by the setting no_sec_mail. This blocking mechanism is now governed by the priority scheme.
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 rule refers to daily events, such as passers-by at a distance, given the area condition of 0.5. The second rule describes a person filling the entire image (area > 50). Say, someone at your door. Give this rule 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.
GPIO triggers are listed in the comma separated TrigGPIO.csv
file. The file has the following structure.
Label | Probability | Move | Area | Delay | Prolong | Pin | Inv |
---|
Delay
The delay value indicates how many seconds an object must be detected before a pin becomes active. You do not want a one-time glitch to set a trigger.
Prolong
Prolong indicates the time in seconds how long a pin remains active if the object is no longer detected.
Pin
The pin associated with the defined trigger. Pin numbers according to WiringPi.
Inv
Inv=0 pin is active high | Inv=1 pin is active low.
person, 50 , 0 , 0.5 , 1 , 5 , 7 , 0
car , 50 , 2.5 , 0.5 , 0 , 5 , 8 , 1
Two rules. The first set pin 7 Pin=7
high Inv=0
when a person is detected. The person must be in the picture for at least 1 second Delay=1
. The pin remains high for 5 seconds when no person (or persons) are recognized Prolong=5
. The person may stand still Move=0
.
The second rule set pin 8 Pin=8
low Inv=1
when a driving car is detected.
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 |