A box around a bicycle doesn't tell you whether it's the same bicycle in the next frame. Reliable street counts depend on how you connect those observations—and where you accept uncertainty.

Editorial illustration of object tracking around a bus, car, cargo bicycle and pedestrians at a city crossing

Say you're reviewing video from a Berlin junction. A cargo bike approaches a crossing, disappears behind a bus and emerges beside another cyclist. Your detector draws convincing boxes. Your dashboard reports two arrivals. Was there one bike or two? Object tracking connects detections across frames so you can answer questions about movement rather than accumulate snapshots. For street analysis, the difficult part is deciding when two observations belong to the same participant—and when the evidence isn't good enough.

That distinction shaped work at move lab, a Berlin urban-mobility lab that built prototypes, open-source tools and data visualisations. We developed node-moving-things-tracker for OpenDataCam and Beat the Traffic X because frame-by-frame detections didn't provide persistent identifiers. The OpenDataCam project turned computer vision into a local, open-source setup for detecting and counting traffic participants. Its approach gives this guide a useful starting point: a tracker earns its place when it makes a street measurement more defensible.

Detection finds a box; tracking connects observations

A car waiting at a red light can appear in hundreds of frames. Counting every detected car would count the same stationary vehicle repeatedly. Even a perfect detector can't resolve that problem through its per-frame output alone.

Detection estimates an object's location and class in one image. A bounding box is the rectangle around it; a confidence score expresses the detector's confidence in that prediction. Tracking associates boxes over time and assigns a track ID. A trajectory is the resulting sequence of positions.

In a tracking-by-detection pipeline, the camera supplies frames, the detector supplies boxes, and the tracker connects them. Your counting logic then interprets those tracks. These stages fail differently. A missing box is a detection problem; a box attached to the wrong ID is an association problem.

Our node.js and YOLO post describes the open-source wrapper we built to expose detection results and support video analysis. That work made boxes easier to use. Persistent identities needed a separate step. You don't need to replace the whole pipeline whenever the count looks wrong; you need to locate the stage producing the error.

What should object tracking measure on your street?

A vehicle can reverse out of a driveway, stop beside a counting line, then continue. A pedestrian can linger outside a bakery. If your team hasn't defined the event, several technically valid tracks can produce incompatible statistics.

For a flow count, a useful definition is a confirmed track crossing a specified line in a specified direction. That differs from occupancy: how many participants are inside a zone at a given moment. Dwell time measures how long a participant stays there. Each question needs different treatment of lost tracks.

A counting rule can use a consistent reference point, such as the bottom centre of a vehicle's box. It's a practical approximation of its contact with the street, not an exact position. A small band around the line can reduce repeated counts caused by boxes wobbling across it. Direction and a recorded crossing state help distinguish a real return journey from jitter.

The OpenDataCam V2 project let users specify counting areas and export tallies and traces. Those outputs support different questions. A tally can't explain every questionable journey; a trace offers evidence for checking it. Your measurement definition belongs beside the camera settings, so a colleague can reproduce the count.

When an IOU baseline is enough

A delivery van shifts slightly between consecutive frames, while its detected box changes size as it approaches. Matching box centres by distance alone ignores how much of the van's previous position the new box still covers.

Intersection over union, or IOU, measures the area shared by two boxes divided by the area covered by either box. It ranges from zero for no overlap to one for identical boxes. In a basic overlap tracker, a current detection continues an existing track when the overlap is sufficiently high.

Bochinski, Eiselein and Sikora's IOU tracker paper (2017) assumes frequent detections with few gaps and clearly overlapping boxes between consecutive frames. Its method extends each track with the highest-overlap unassigned detection above a threshold. Unmatched detections start tracks; unmatched tracks end. It also filters tracks using length and detection confidence.

That makes an IOU baseline attractive for a fixed camera with clear views and modest movement between processed frames. It's cheap to compute, and you can inspect why a match happened. But a fast cyclist can move beyond the previous box between frames. Lowering the overlap threshold may restore a connection while also making a nearby cyclist an eligible match.

The lab's Tracking Things in Object Detection Videos explains node-moving-things-tracker, including early experiments with centre distance and retaining unmatched objects for a few frames. It offers implementation context; this broader guide concerns the measurement decisions around a tracker. An overlap threshold isn't a universal street setting. It depends on camera geometry and the actual interval between processed frames.

What SORT adds—and what it still can't know

Two cyclists can ride close together while their boxes jitter from frame to frame. Greedy matching may give the first track the most convenient detection and leave the second with a poor match. A prediction about motion can help, but it can't supply certainty.

SORT stands for Simple Online and Realtime Tracking. It combines a Kalman filter with the Hungarian assignment algorithm. The filter estimates each track's box state and predicts its next position using a constant-velocity model. The assignment algorithm finds a one-to-one matching that optimises the total matching cost for that frame, using overlap between predicted boxes and detections. A minimum overlap still rejects implausible matches.

Bewley and colleagues (2016) identify detector quality as a major constraint:

“detection quality is identified as a key factor influencing tracking performance”

In their validation comparison, changing SORT's detector from ACF to the VGG16-based Faster R-CNN raised MOTA from 15.1 to 34.0: a difference of 18.9 percentage points. Those are pedestrian-benchmark results, not an expected gain for your junction. They explain why a tracker comparison means little if the detector changes too.

SORT is a useful next baseline when motion prediction helps your footage. It doesn't recognise a particular rider's appearance. The original paper focused on frame-to-frame association and used a one-frame lost-track threshold in its experiments; re-identification was outside its scope. Implementations expose different lifecycle settings, so the name alone doesn't tell you how long an unseen track survives.

A van making a sharp turn also violates constant velocity. The prediction can drift during a gap. Longer memory gives the correct detection another chance to reconnect, but it gives incorrect candidates more chances too.

Occlusion is a visibility problem before it's a software problem

Say a bus hides a cargo bike just before your counting line. The bike reappears beyond it. No threshold can recover an observation that the camera never captured, and a predicted crossing isn't the same as a visible crossing.

Occlusion means one object blocks another from view. Partial occlusion may leave a usable box; full occlusion can remove the detection. A temporary lost-track state can bridge short gaps, but the system needs to separate observed positions from predicted ones. Otherwise a plausible line on a screen can pass for evidence.

A cargo cyclist appears before and after a bus, with a dashed path representing the hidden part of the journey

The same cyclist is shown at two moments. The path behind the bus represents a hypothesis, not a camera observation. Source: AI-generated editorial illustration.

Camera placement often deserves attention before another tracking model. A higher, more oblique view may separate participants, while a lower view can make a bus occupy much of the image. Moving the counting line into a clearer part of the scene reduces the need to infer hidden crossings. The trade-off is that a higher view can make small or distant participants harder to detect.

Appearance-based association is another option. Wojke, Bewley and Paulus (2017) added learned appearance features in Deep SORT and reported 45% fewer identity switches in their evaluation. Their model used person re-identification data; that figure doesn't promise equivalent improvement for bicycles or vans.

Appearance matching costs computation and can fail when participants look similar. For a short local count, a clearer view may offer more value than reconnecting every long-hidden track. If a crossing remains uncertain, an uncertainty flag is more honest than an invented continuous journey.

ID switches can spoil a count without spoiling the picture

A video overlay can look convincing while an ID silently changes from one rider to another. Every visible participant still has a box. The totals may even look reasonable. The error lives in the history, where a visual spot-check can miss it.

An ID switch is an identity-assignment change under the evaluation's matching rules. A tracker may swap identities between nearby objects or give a returning object a new ID after losing it. Fragmentation is related but different: a trajectory is interrupted. The exact counting of these errors depends on the evaluation protocol.

For a line counter, the timing matters. An identity change far from the line may leave the flow total untouched. A new ID beside the line may inherit no crossing history and trigger a duplicate. A swap can attach one participant's history to another.

Your debugging view therefore benefits from track age and lost-state indicators alongside IDs. A short replay around each suspicious crossing usually explains more than watching an entire hour at normal speed. An event record can retain its direction, timestamp and track ID, with a flag for gaps near the line.

Class changes deserve separate attention. If a detector alternates between bicycle and motorcycle, hard class-based matching can split an otherwise continuous track. Maintaining a class history can reduce flicker, but it can also preserve an initial mistake. The choice needs checks on the modes your decision depends on.

MOTA checks errors, not your traffic total

Two settings can receive the same headline score while producing different journey histories. A planner comparing turning movements needs to know whether fewer missed boxes were bought at the cost of more identity changes.

MOTA means Multiple Object Tracking Accuracy. Bernardin and Stiefelhagen's CLEAR MOT paper (2008) combines misses, false positives and identity mismatches. In common box-tracking notation:

MOTA = 1 − (FN + FP + IDSW) / GT

FN counts missed ground-truth detections, FP counts unmatched predictions, and IDSW counts identity switches under the chosen protocol. GT is the total number of annotated object instances across evaluated frames. It isn't the number of unique people or vehicles. Counts are summed across frames before the ratio is calculated; an unweighted average of per-frame scores would change the result.

Say a labelled clip contains 1,000 object instances across its frames. Setting A produces 80 misses, 20 false positives and 10 identity switches. Its score is:

1 − (80 + 20 + 10) / 1,000 = 0.89, or 89%.

Setting B produces 70 misses, 20 false positives and 20 identity switches. It also scores 89%. It has fewer misses but twice as many identity changes. These are illustrative settings, not measured tracker results.

Stacked bars show two illustrative settings with 89 percent MOTA but different missed detection and identity switch counts

Both settings have 110 total errors over 1,000 ground-truth object instances. Their identical MOTA hides different identity behaviour. Source: move lab illustrative example using the MOTA equation from Bernardin and Stiefelhagen (2008); not measured results.

MOTA isn't a percentage of correct trips. It can even be negative when counted errors exceed GT. For mobility decisions, the component counts belong beside the score, along with manual crossing-count error by mode and direction. A direct check of your street events reveals errors that a frame-level score can hide.

A small pilot should expose the failure you care about

A quiet lunchtime clip can flatter almost any tracker. Your busiest interval may contain buses, tightly spaced riders and glare on windscreens. A pilot that excludes those moments tests a different street from the one you're trying to understand.

A useful pilot contains ordinary footage and selected difficult episodes. Annotation assigns boxes and persistent reference IDs, with an explicit rule for occluded and partly visible participants. A separate manual tally records the crossing events. The first checks tracking quality; the second checks whether your measurement works.

Comparisons become interpretable when the detector, input resolution and processed frames stay fixed. An IOU baseline and SORT can then run on the same detections. A later appearance-based method earns extra complexity if it fixes failures that materially affect your counts. It doesn't earn it just by producing prettier traces.

Four settings deserve a place in your experiment record:

  • Detection confidence: a higher threshold may remove false boxes but discard partly hidden participants.
  • Matching threshold: stricter overlap reduces dubious links but can split fast-moving tracks.
  • Lost-track lifetime: longer retention bridges gaps while allowing stale tracks to reconnect incorrectly.
  • Confirmation rule: requiring repeated detections suppresses brief false tracks but can miss participants visible only briefly.

A dropped frame changes the distance an object travels between observations. The actual timestamps matter, especially if processing cannot keep pace with capture. Configuration values expressed in frames don't represent the same duration at different processing rates.

Your pilot report can show count differences by mode and direction, the worst reviewed episodes, and the uncertainty rule used at hidden crossings. Aggregate accuracy alone may hide a systematic bicycle undercount behind accurate car counts. For a cycle-lane decision, that imbalance matters more than an attractive overall score.

Trust a checked crossing, not a persuasive trail

An unbroken coloured path can make uncertain footage look settled. The temptation is strongest when a delivery deadline demands one clean number, but a hidden crossing still needs an explanation.

For tracking participants in street video, the strongest starting point is a clearly defined event in a visible part of the scene. An IOU baseline establishes what overlap can explain; SORT adds motion prediction and joint assignment. More elaborate association makes sense when reviewed failures justify it.

The deliverable that matters is a count whose errors you can describe. A documented uncertain crossing gives a planner something to judge. A confident duplicate gives them a false premise.

Frequently asked questions

Does YOLO track objects by itself?

The detector produces boxes and class predictions for individual frames. Persistent IDs come from a tracking stage that associates those detections over time, even if a software package exposes both through one interface.

Is IOU or SORT better for a fixed street camera?

An IOU baseline can be enough when detections are frequent and consecutive boxes overlap clearly. SORT adds motion prediction and one-to-one assignment, so it's useful when box positions vary, but neither approach guarantees identity recovery after a long obstruction.

Does a high MOTA score mean my traffic count is accurate?

No. MOTA combines missed detections, false positives and identity changes across evaluated frames; it doesn't directly measure crossing counts. A separate manual comparison at your counting line reveals duplicate and missed events that a single score can hide.