← All guides AI Release
RU Subscribe to @ai_releaseorg

How to Configure AI Video Surveillance Without False Alarms: Zones, Confidence Thresholds and Alert Testing

Updated: 20.11.2026 · AI Release · @ai_releaseorg
How to Configure AI Video Surveillance Without False Alarms: Zones, Confidence Thresholds and Alert Testing

TL;DR

Requirements and setup

Illustration: Requirements and setup
Illustration: Requirements and setup
sudo apt install -y ffmpeg mosquitto-clients jq python3
ffprobe -version | head -n 1

Step 1. Verify the stream, time sync, and scene baseline

What to do: confirm the camera delivers a decodable stream over TCP before any detection config exists.

ffprobe -v error -rtsp_transport tcp -select_streams v:0 \
  -show_entries stream=codec_name,width,height,avg_frame_rate \
  -of default=noprint_wrappers=1 \
  "rtsp://viewer:<camera-password>@192.168.1.50:554/stream1"

Example output (success):

codec_name=h264
width=1920
height=1080
avg_frame_rate=25/1

If codec_name is hevc, check whether your detector build decodes H.265 — many setups use the H.264 substream for detection instead.

Why: every later step (zones, scores, alerts) depends on a stable, TCP-transported stream. UDP packet loss produces dropped frames, and dropped frames look exactly like "detection missed the person".

Then lock the time base — a wrong clock makes correlating alert logs with reality impossible:

timedatectl

Expected: System clock synchronized: yes and NTP service: active.

Next, capture a baseline and inspect it. Save one daytime frame and one night frame from the exact camera position:

ffmpeg -rtsp_transport tcp -i "rtsp://viewer:<camera-password>@192.168.1.50:554/stream1" \
  -frames:v 1 day_baseline.jpg -y

Why: you need to see what the model sees. Trees, moving shadows, a swaying flag, a reflective wall under IR — these are the physical sources of most false alerts, and they must be excluded by mask or by zone, not by raising the score until real visitors disappear.

How to check: open day_baseline.jpg and repeat the capture after dark (night_baseline.jpg). If the night frame is dominated by an IR hotspot, plan a motion mask over that region now:

# config.yml — ignore the timestamp overlay and the IR hotspot
motion:
  mask:
    - 0.000,0.000,1.000,0.000,1.000,0.120,0.000,0.120
    - 0.780,0.150,1.000,0.150,1.000,0.330,0.780,0.330

Coordinates are normalized: 0,0 is the top-left corner, 1,1 the bottom-right, values are separated by commas in x,y pairs. This works because masking happens before motion scoring, so a flickering IR reflection never starts a track.

Step 2. Draw zones and set confidence thresholds

Illustration: Step 2. Draw zones and set confidence thresholds
Illustration: Step 2. Draw zones and set confidence thresholds

What to do: convert the pixel polygon you drew on the snapshot into normalized coordinates, then attach it to the camera config together with score and area filters.

# pixel points -> normalized polygon for a 1280x720 detect stream
W, H = 1280, 720
pixels = [(410, 250), (880, 250), (980, 700), (300, 700)]
print(",".join(f"{x/W:.3f},{y/H:.3f}" for x, y in pixels))

Example output:

0.320,0.347,0.688,0.347,0.766,0.972,0.234,0.972

Why: the detector evaluates every frame at its own detection resolution, not at the camera's native one — normalized coordinates stay valid when you later change detect.width/detect.height.

Now the config. Use a substream for detection, keep tracking to the two labels you actually care about, and give the score two roles: min_score starts a track, threshold confirms it as a real event.

mqtt:
  host: 192.168.1.10
  port: 1883
  user: mqttuser
  password: "<mqtt-password>"

detect:
  width: 1280
  height: 720
  fps: 5

objects:
  track: [person, car]
  filters:
    person:
      min_area: 4000
      max_area: 120000
      min_score: 0.55
      threshold: 0.70

cameras:
  front_door:
    ffmpeg:
      inputs:
        - path: "rtsp://viewer:<camera-password>@192.168.1.50:554/stream1"
          roles: [detect, record]
    zones:
      driveway:
        coordinates: 0.320,0.347,0.688,0.347,0.766,0.972,0.234,0.972
        objects: [person, car]
      street:
        coordinates: 0.000,0.000,1.000,0.000,1.000,0.300,0.000,0.300
        objects: []
    review:
      alerts:
        required_zones: [driveway]

Rules of thumb for the numbers: raise min_score when you get hits on shadows and empty pavement; raise threshold when alerts appear but the box flickers off within a second; set min_area to roughly the pixel area of a person at the far edge of the zone, so a cat or a distant pedestrian on the sidewalk stops qualifying. Assigning objects: [] to the street zone tells the detector "this area exists but must never raise an alert", which is how you silence public road traffic without masking it (masking would also hide the context needed to confirm a real approach).

Example: a person walking up the driveway enters driveway → one new event with score above 0.70; a car passing on the road enters only street → event created but suppressed by required_zones.

How to check: restart the detector and read the log at startup. You should see the camera initialise without a config warning:

docker logs --tail 50 frigate 2>&1 | grep -iE "zone|error|warn"

Expected: no Error parsing config line, and a line confirming front_door started capture. Then walk through the driveway once and once along the street edge; the first pass must appear in the UI's events list, the second must not.

Step 3. Verify notifications end to end and measure the false-alarm rate

Illustration: Step 3. Verify notifications end to end and measure the false-alarm rate
Illustration: Step 3. Verify notifications end to end and measure the false-alarm rate

What to do: subscribe to the event topic and record raw alerts to a file for 24 hours.

mosquitto_sub -h 192.168.1.10 -p 1883 -u mqttuser -P '<mqtt-password>' \
  -t 'frigate/events' \
  | jq -r 'select(.type=="new") | [.after.start_time, .after.camera, .after.label, .after.score, (.after.entered_zones|join("|"))] | @csv' \
  >> alerts.csv

Field names live in the detector's MQTT schema and differ between releases — check the documentation if jq returns nothing. The select(.type=="new") guard matters: the same topic carries update and end messages, and counting those triples your numbers.

Why: "no false alarms" is a measurement, not a feeling. A CSV with timestamps lets you separate night IR hits from daytime motion, and separates camera A from camera B.

Summarise after 24 hours:

import csv, collections
rows = list(csv.reader(open("alerts.csv")))
print(collections.Counter(f"{r[1]}/{r[2]}" for r in rows).most_common())
print("total:", len(rows))

Example output:

[('front_door/person', 6), ('front_door/car', 2)]
total: 8

Then compare against reality: for each row, keep the clip or mark it false. Anything triggered at the same minute of the night, with score close to your threshold, or with an empty entered_zones value, is a false positive — fix the mask or the zone rather than the threshold.

For the delivery leg, publish to a chat channel instead of polling a database: How to Set Up VPS Monitoring via a Telegram Bot with Mini App — the same bot pattern is used to push an alert message and confirm it arrived on a phone.

How to check: you have success when all three are true — (1) alerts.csv grows only when a person or car actually enters driveway; (2) the message arrives on the phone within a few seconds of the walk-through; (3) a deliberate walk along the street produces zero new rows.

Troubleshooting

Problem. The detector starts but the camera shows a red "no frames" tile.

Problem. Events are created locally but nothing reaches your subscriber.

mosquitto_pub -h 192.168.1.10 -p 1883 -u mqttuser -P '<mqtt-password>' -t test -m ok

If that fails, fix the broker user first (mosquitto_passwd -c /etc/mosquitto/passwd mqttuser, then allow_anonymous false in mosquitto.conf). If it succeeds, the fault is in the detector's mqtt: block, not the broker.

Problem. Alerts fire every night around the same time with no one in frame.

Summary and next steps

You now have a stream verified over TCP, a masked scene, a polygon zone with two-stage confidence filters, and a 24-hour CSV that tells you the real false-alarm count instead of a guess. To scale review of a growing clip backlog across a team, hand the triage to a shared agent as described in Claude Code for Teams: Setting Up Subagents and a Shared AI Superagent.

FAQ

What is the difference between min_score and threshold?

min_score is the confidence needed for the model to start tracking an object; threshold is the confidence needed to confirm that track as a real event. Raise min_score to kill random hits, raise threshold to kill flickering events — they solve different symptoms.

How many zones should one camera have?

Two is usually enough: the area where alerts are allowed (e.g. driveway) and the area that must never alert but still needs tracking for context (e.g. street). More zones mostly add config to maintain.

Why do I get alerts for a person outside the zone?

The object's bounding box probably overlaps the polygon, or the event was created before required_zones was applied. Check the entered_zones field in the CSV — an empty value means the alert did not pass through the zone filter.

Does a higher detection FPS reduce false alarms?

Not by itself, and it costs CPU. A 5 FPS detection stream is enough for a walking person; the real gains come from masks, min_area tuned to the far edge of the zone, and a confirmed two-stage score.

🤖 AI summary

AI Release Knowledge Layer
Machine-readable description · Version 1.0

Status: practical guide. Some statements come from vendors; verify in your environment.

1. Summary

Time to complete: ~90 minutes of configuration plus one 24-hour observation window Difficulty: Intermediate

Inside: direct answers, key facts, entities, context, reliability, unknowns and sources.

Machine data: Citation Map JSON · JSON-LD · Semantic Embeddings — separate stage.

Full Knowledge Layer: sections 2–8

2. Direct answers

What is required?
Camera: RTSP URL of the main stream, a separate lower-resolution substream for detection, a static IP or DHCP reservation.; Detector/NVR: software that runs the object model and exposes zones plus confidence filters. The examples below follow the config layout of the open-source NVR Frigate; field names change between… → details (AR-GUIDE-KAKNASTROI-003)
How to do it?
Step 1. Verify the stream, time sync, and scene baseline → Step 2. Draw zones and set confidence thresholds → Step 3. Verify notifications end to end and measure the false-alarm rate → details (AR-GUIDE-KAKNASTROI-004)
Which topics does it cover?
ложные срабатывания ИИ видеонаблюдения, настройка ИИ камеры, распознавание оружия ИИ, порог уверенности детекции, как настроить детекцию объектов на камере → details (AR-GUIDE-KAKNASTROI-002)
What are the key points?
Time to complete: ~90 minutes of configuration plus one 24-hour observation window Difficulty: Intermediate → details (AR-GUIDE-KAKNASTROI-007)

3. Key facts

  1. Time to complete: ~90 minutes of configuration plus one 24-hour observation window — evidence; status: заявление источника.
  2. Difficulty: Intermediate — evidence; status: заявление источника.
  3. You will need: an IP camera with RTSP and ONVIF support on a fixed IP, an NVR/detector that supports polygon zones and per-object score filters, an MQTT broker (Mosquitto), ffmpeg/ffprobe, mosquitto-clients, jq, python3, a PoE switch or 12 V PSU, and free disk space for at least 24 hours of event clips. — evidence; status: заявление источника.
  4. Camera: RTSP URL of the main stream, a separate lower-resolution substream for detection, a static IP or DHCP reservation. — evidence; status: заявление источника.
  5. Detector/NVR: software that runs the object model and exposes zones plus confidence filters. The examples below follow the config layout of the open-source NVR Frigate; field names change between releases — check the documentation for the exact version you install. — evidence; status: заявление источника.
  6. Broker: Mosquitto reachable on port 1883 from the detector host, with a dedicated user (not anonymous access). — evidence; status: заявление источника.

4. Entities

EntityTypeRole
ложные срабатывания ИИ видеонаблюдениятема/инструментупоминается в заголовке, TL;DR или разделах гайда
настройка ИИ камерытема/инструментупоминается в заголовке, TL;DR или разделах гайда
распознавание оружия ИИтема/инструментупоминается в заголовке, TL;DR или разделах гайда
порог уверенности детекциитема/инструментупоминается в заголовке, TL;DR или разделах гайда
как настроить детекцию объектов на камеретема/инструментупоминается в заголовке, TL;DR или разделах гайда
Pythonплатформа/технологияупоминается в заголовке, TL;DR или разделах гайда

5. Context

  • Guide — describes → How to Configure AI Video Surveillance Without False Alarms: Zones, Confidence Thresholds and Alert Testing (AR-GUIDE-KAKNASTROI-001).
  • Guide — includes step → Step 1. Verify the stream, time sync, and scene baseline (AR-GUIDE-KAKNASTROI-001).

6. Reliability

Confirmed

No independent confirmation is provided; source claims and editorial conclusions are separated below.

Source claims

  • Product features, versions, prices and limits come from vendors and the guide.
  • Commands and steps are recommendations, not guaranteed results.

AI Release analysis

  • Structure, comparison and selection criteria are editorial.
  • The guide does not replace an independent audit or legal advice.

7. Unknowns

  • Current versions, prices and limits.
  • Independent benchmarks and quality checks.
  • Terms of use and data policy.

8. Sources

SourceTypeRole
No external links——

Cite as: AI Release. Как настроить ИИ-видеонаблюдение без ложных тревог: зоны, пороги уверенности и проверка уведомлений. ai-release.org.