Skip to content

Trigger: Video analytics

This trigger watches live cameras with Netsocs Vision, the Netsocs video analytics. Its detection models run on your own servers, with no cloud and no external service. The automation starts when a rule matches on a camera: a person shows up, a vehicle crosses a line, someone stays too long in an area, a backpack is left behind, the camera is covered, and so on.

Every camera has its own zones and rules, and one trigger can watch several cameras at once.

When to use it?

  • When the camera has no built-in analytics, or what it has is not enough (for example to count people, measure time spent in an area or detect abandoned objects).
  • When you want the same logic on cameras of different brands: Netsocs does the detection, not the camera.
  • When you need richer rules than "motion detected": by object type, zone, direction, time spent or schedule.

If the camera or the VMS already raises the event you need (for example a Hanwha or Hikvision intrusion), using Trigger: Event with that event is cheaper.


Requirements

  • The automation-vision-worker service deployed next to the automation backend. It is part of the official compose.yaml.
  • At least one Netsocs Vision model installed. You install it from the node itself (see Step 1).
  • Enough CPU and RAM for the number of cameras and the chosen model. Before enabling many cameras, check Video analytics: resource usage.

How to configure it

Step 0) Add the node

On the canvas, open the node selector, search for Video analytics (or "detection", "line crossing", "time spent"...) and drag the trigger in. Double-click it to open its settings.

Step 1) Choose the model

Select an installed model. If there is none, open Netsocs Vision models:

  • Catalog: models ready to download in one click, checksum-verified. All of them recognise 80 common classes: person, bicycle, car, motorcycle, bus, truck, backpack, handbag, suitcase, dog, cat, etc. The download shows its progress.
  • Upload: upload your own object detection model in ONNX format, alone or inside a .zip. Use it for models trained on your own classes (helmet, vest, plates...). The zip may also contain:
    • classes.txt, one class per line;
    • the training data.yaml;
    • a manifest.json.
  • Installed: rename or delete models. A model used by an active trigger cannot be deleted.
Model For
Netsocs Vision Nano Many cameras on a modest server; objects close by
Netsocs Vision Lite Recommended on CPU, general use
Netsocs Vision Crowd Crowds: fewer duplicate boxes when people overlap
Netsocs Vision Standard Small or distant objects
Netsocs Vision Crowd Pro Crowds and small objects, best with a GPU
Netsocs Vision Precision / Pro Maximum accuracy, with a GPU

What each one uses is on the resource usage page. The licenses of third-party components are available from the Third-party licenses link of the same window.

Security: only ONNX models are accepted. PyTorch files (.pt, .pth, .pkl) are refused because opening them can run code.

Licenses of your own models: if the model you upload has a license with obligations (for example AGPL-3.0), you are asked to accept it before it is installed. Complying with that license is up to you.

Step 2) General settings

Field Default What it does
FPS 5 Pictures analysed per second (0.2 to 15). It is what weighs most on CPU usage
Confidence 0.35 Minimum detection confidence (0 to 1) for rules that do not set their own
Cooldown 10 s Minimum time between two firings of the same rule, to avoid alert floods
Include snapshot Yes Attaches a picture of the moment to every event
Draw object boxes Yes Marks the detected objects on the picture (box, type and confidence)
Draw zones and lines Yes Marks the zones and lines on the picture, highlighting the event's one
Timezone — Timezone of the rule schedules

With both drawing options off, the picture is the clean frame plus a strip with the rule name and the time.

Step 3) Select the cameras

Pick one or more cameras from the object tree. Each camera shows its live status: whether it is receiving video, the actual FPS, the analysis time and the last error.

Each camera has a tab with:

  • Enabled: turns the camera off without losing its configuration.
  • Stream: sub (recommended, lighter) or main (higher resolution, for distant objects).
  • Copy rules and zones to other cameras: copies the configuration to the other cameras.

Step 4) Draw zones and lines

Over the camera picture you can draw:

  • Zones (polygons): click each corner. They need at least 3 points.
  • Lines (2 points): used for crossings and counting. The arrow shows the drawing direction:
    • Side A is on the right of the arrow, looking from the first point to the second.
    • Side B is on the left.
    • If you drew the line backwards, the swap button flips its ends.
  • Exclusion zones: anything inside is ignored (trees moving in the wind, screens, a street you do not care about).

Points can be dragged, and double-clicking one removes it. Zones are tested against the object's feet (the bottom centre of its box): a person is "in the zone" when standing on the area drawn on the floor.

Step 5) Create the rules

Add one or more rules per camera. Picking the type shows only the fields that type uses.

Rule Fires when... Needs
Detected The chosen object type shows up (optionally inside a zone and with a minimum count) —
Line cross An object crosses the line, A→B, B→A or both ways Line
Zone enter An object enters the zone (or appears inside it) Zone
Zone exit An object leaves the zone (or is lost from view inside it) Zone
Zone visit (time spent) An object, or a group, ends its visit to the zone. Reports how long it lasted, the entry and exit pictures and crops of the object Zone
Zone dwell (loitering) An object has been in the zone longer than X seconds (fires while it is still inside) Zone
Zone count (occupancy) N or more (or N or fewer) objects are in the zone for X seconds Zone
Zone empty Nobody is in the zone for X seconds (for example an empty guard post) Zone
Line counter Counts in (A→B) and out (B→A); reports every N crossings or periodically Line
Abandoned object An object (backpack, handbag or suitcase by default) stays still for X seconds with no person nearby —
Object removed An object that was fixed in the scene disappears (a TV, a laptop) —
Wrong way An object moves against the allowed direction —
Tailgating Two or more people cross the line within a few seconds Line
Proximity An object is close to one of another type (a person next to a vehicle) —
Speed An object goes faster than a threshold (in m/s if you set how many metres the picture width covers) —
Camera offline The camera sends no picture for X seconds (and optionally notifies when it is back) —
Camera tampered The picture turns black, glared, frozen or blurred (lens covered, sprayed or turned away) —

Zone visit: modes

  • Each object: one event per object when it leaves the zone, with its duration.
  • Group: one event when the zone becomes empty. It covers everyone who was in it, from the first one in to the last one out. It is steadier when people hide each other.

You also set the minimum duration (shorter visits are not reported) and the maximum number of crops per event.

Options common to every rule

  • Classes: which objects count (person, car, truck...). Empty means any.
  • Min confidence, minimum and maximum size: filter doubtful or distant detections.
  • Confirm frames: how many pictures in a row the condition must hold. Avoids false alarms from detector flicker.
  • Cooldown and cooldown scope: one alert per rule every X seconds, or one per object. For example, on a line crossing every person who crosses gets an event.
  • Schedule: time windows per day. For example 20:00–06:00 for nights only: an end before the start crosses midnight.

Step 6) Save and activate

Save and activate the automation. If something is not valid, the activation fails and the reason is shown in the trigger status. For example:

  • the model is not installed;
  • a zone rule has no zone;
  • a rule uses an object type the model does not recognise.

What does it return?

Every time a rule matches, one execution starts. These fields are available to the next nodes as {{<trigger_key>.<field>}}:

Field Description
event_type Rule type that fired (line_cross, zone_visit, camera_offline, camera_online...)
rule_id, rule_name The rule that matched
camera_id, camera_name The camera
class, confidence Type and confidence of the main object
track_id Id of the object while it is being followed
bbox Object box [x1, y1, x2, y2] as fractions of the picture (0 to 1)
objects Every object involved
region_id, region_name Zone or line involved
direction a_to_b or b_to_a for crossings
dwell_seconds Seconds in the zone (Zone visit: how long the visit lasted), offline or abandoned
count, count_in, count_out Counts (occupancy, line counter, objects of a group visit)
speed, speed_unit Measured speed (Speed rule)
reason Extra detail: appeared, lost, group, report, dark, frozen, blurred, overexposed
message Human-readable summary, ready for a message
snapshot_url Event picture. For Zone visit, the exit frame. Can be sent as is by Telegram, WhatsApp or email
entry_snapshot_url Zone visit: picture of the entry frame
entered_at, exited_at Zone visit: when the visit started and ended
crops Zone visit: crops of the object. Each one has url, kind (entry, best or exit), class, confidence and timestamp
timestamp Date and time of the event

When one trigger has several rules, use a Switch on {{<trigger_key>.rule_id}} so each one follows its own path.


Examples

  • Night intrusion: Zone enter on the yard, class person, schedule 20:00–06:00 → Telegram with snapshot_url → raise an alarm.
  • Service time at a counter: Zone visit, mode Each object, minimum 10 s → store dwell_seconds, entered_at and exited_at in Google Sheets, with the first crop (crops) as evidence.
  • Room occupancy: Zone visit, mode Group → log every occupied period and how many people went through (count).
  • Store occupancy: Line counter on the door, report every 15 minutes, daily reset → store count_in and count_out.
  • Checkout queue: Zone count of 5 or more people for 60 s, repeating every 5 minutes → notify the supervisor.
  • Illegal parking: Zone dwell with classes car and truck, 300 s, on the no-parking zone.
  • Abandoned backpack: Abandoned object with 60 s in the lobby.
  • Tampering: Camera tampered + Camera offline (with back-online notice) on every critical camera.
  • Personal protective equipment: upload your own model with the classes helmet and no_helmet and use Detected with the class no_helmet in the work area.

Good practices

  • Start with FPS 5 for crossings and entries, and FPS 1–2 for time spent, occupancy and abandoned objects. That halves the usage or better.
  • Draw zones on the floor and lines across the path of the feet.
  • Use exclusion zones for things that move and do not matter, rather than raising the confidence.
  • If alerts repeat, raise the cooldown or switch its scope to "per rule".
  • Try one camera first and watch its live status (actual FPS and analysis time) before adding more.

Troubleshooting

Symptom What to check
model ... is not installed on activation Install it from Netsocs Vision models
The editor says the vision service is unreachable The automation-vision-worker service is not running
Camera without picture (offline) That the camera plays in the dashboard: the same WebRTC video as the player is used
Source snapshot instead of video WebRTC did not connect and fallback pictures (~1 per second) are being used; check the network between the vision service and DriverHub
Small or distant objects are missed Use Netsocs Vision Standard or Crowd Pro, or the main stream
False alarms Exclusion zones, minimum size, confirm frames 3–5
Crossings do not fire FPS 5 or more, and the line must cross the path of the feet
A visit is split in two (reason: lost) The person was hidden for a few seconds; use the Group mode
Analysis is slow (actual FPS below the configured value) The server cannot keep up; see resource usage