Skip to content

Add min_displacement_m camera filter to drop stationary-vehicle phantom tracks - #4

Merged
nathan-v merged 2 commits into
mainfrom
fix/min-displacement-filter
Jul 17, 2026
Merged

Add min_displacement_m camera filter to drop stationary-vehicle phantom tracks#4
nathan-v merged 2 commits into
mainfrom
fix/min-displacement-filter

Conversation

@nathan-v

Copy link
Copy Markdown
Owner

Description

Adds a min_displacement_m camera setting: a track must travel at least this many real-world meters (net, first-to-last smoothed position) to count as a vehicle. Filtered tracks increment vehicles_filtered like the existing filters. Default 0.0 (disabled) keeps existing behavior.

Related Issue

N/A

Motivation and Context

Parked vehicles with jittery bounding boxes fragment into short ByteTrack tracks whose small net displacement over a short time window computes as a plausible 3-10 mph reading. Analysis of a week of production InfluxDB data confirmed the signature: sub-10 mph points cluster at 10-40 detections while real traffic runs ~60-250. A displacement floor separates phantom fragments (net movement of a couple meters) from genuine slow vehicles (parking maneuvers, garbage trucks covering 20m+), and unlike raising min_detections it doesn't penalize fast vehicles that cross the zone in under 3 seconds.

How Has This Been Tested?

  • 169 unit tests pass; ruff check/format clean
  • New tests: stationary-jitter track filtered with the floor set and leaks without it (control), genuinely moving vehicle survives the floor, config validation bounds
  • Reproduced the failure mode against a ground-truth clip (3 vehicles, 1 moving at a verified 20 mph): the jittery parked car accumulated 14.7m of phantom path with 0.18m net displacement

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project (ruff check and ruff format pass)
  • My change requires a change to the documentation
  • I have updated the documentation accordingly
  • I have read the CONTRIBUTING document
  • I have added tests to cover my changes
  • All new and existing tests passed

nathan-v added 2 commits July 15, 2026 23:30
…back, coralapi

- Fix RoboflowInferenceDetector request format for Inference Server 1.x
  (model_id + image belong in the JSON body; the old query-param form gets
  HTTP 422, which previously surfaced as silent zero-detection results)
- Add opt-in client-side downscaling (roboflow.resize_max_px /
  coralapi.resize_max_px): the server resizes to model input anyway, so
  smaller uploads cut per-frame latency 3-4x at identical accuracy;
  predictions are rescaled to original frame coordinates
- Remote detectors now raise DetectorUnavailableError on transport failures
  instead of returning empty detections; new FallbackDetector optionally
  falls back to local CPU inference (detection_fallback: local) - immediate
  switch when the backend never succeeded this job, after 3 consecutive
  failures otherwise, sticky per job, local model loaded lazily
- ProcessingResult now records detection_backend / detection_model /
  detection_fallback (what actually ran), surfaced in API responses and as
  backend/model/fallback tags on InfluxDB metrics for per-model dashboards
  and fallback-rate alerting
- New coralapi backend (https://github.com/nathan-v/coralapi) for Coral
  Edge TPU inference: multipart /v1/vision/detect, normalized-box scaling,
  label mapping with COCO-90 index fallback for label-less models
- Docs: backend comparison/config for coralapi, detection_fallback setting;
  gitignore local benchmark artifacts
…om tracks

Parked vehicles with jittery bounding boxes fragment into short ByteTrack
tracks whose small net displacement over a short window computes as a
plausible 3-10 mph speed, polluting low-speed production data (confirmed
against a week of InfluxDB points: sub-10 mph readings cluster at 10-40
detections vs ~60-250 for real traffic).

A displacement floor separates the two cleanly: jitter fragments net a
couple of meters at most, while genuine slow vehicles (parking maneuvers,
garbage trucks) cover 20m+. Filtering on distance also avoids the false
tradeoff of raising min_detections, which would drop legitimately fast
vehicles that cross the zone in under 3 seconds.

Default 0.0 (disabled) for backward compatibility; filtered tracks count
toward vehicles_filtered as with the existing filters.
@nathan-v
nathan-v enabled auto-merge (squash) July 17, 2026 07:15
@nathan-v
nathan-v merged commit e900a3c into main Jul 17, 2026
3 checks passed
@nathan-v
nathan-v deleted the fix/min-displacement-filter branch July 17, 2026 07:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant