Motion Tracker for Line-Side Inspection: Per-Part Identities and Counts

How a motion tracker turns per-frame detections into per-part identities on an inspection line, and how ID switches corrupt counts, defect rates and…

Motion Tracker for Line-Side Inspection: Per-Part Identities and Counts
Written by TechnoLynx Published on 11 Jul 2026

On an inspection line, a motion tracker takes the boxes a detector finds in each frame and links them into tracks, so each physical part keeps one identity from the moment it enters the camera’s view until it leaves. That identity is what lets you count parts, compute a defect rate and make reject decisions per part rather than per frame. You judge whether the tracks can be trusted with identity-aware measures (IDF1, HOTA with its detection and association components, and identity-switch counts), because a tracker can detect well frame by frame and still give parts unstable identities.

The general mechanics of association (prediction, matching, track birth and death) are covered in our explainer on real-time object tracking in production CV pipelines. This page stays on what tracking does to counting, defect statistics and rejects on a conveyor.

Counting Detections per Frame Overcounts Parts

Detection answers “what is in this frame?”. Counting needs a different answer: “how many distinct parts went past?”. A part can stay visible for many consecutive frames, so frame-level detections cannot simply be added up into a count of unique objects. Each object has to be associated over time before it can count reliably. Video counting is commonly formulated as tracking-by-detection: detections are linked into persistent trajectories, and the identities stop the same object from being counted again and again.

The counting rule then works on trajectories, not boxes. In one vehicle-counting study, each vehicle is counted once, based on the trajectory matching every tracker does, with entry and exit zones drawn on the image. An embedded fruit-counting pipeline goes further: each ByteTrack identity can trigger at most one counting event across all gates, so a trajectory near a region boundary cannot be counted twice. On a conveyor, we would use a single gate across the belt, with one event per track identity.

Tracking does not remove the overcount on its own. If the detector produces several boxes for the same object, the tracker can treat them as different objects and give them new identities, which inflates the count. Occlusion and poor visibility create identity switches and repeat detections in the same way. The count depends on the tracker’s identity continuity as well as detection quality, so that continuity is what you need to measure.

From Per-Frame Labels to a Per-Part Defect Rate

A defect classifier run on every frame does not give one stable verdict per part. It gives a stream of verdicts that can flip because of motion blur, occlusion and lighting changes. A conveyor apple-inspection framework (YOLOv8 detection, ByteTrack association, a ResNet18 defect classifier) handles this by collecting every prediction made along a track and taking a majority vote to set that track’s final label. The same work defines two track-level metrics: a defect ratio (defective tracks divided by total tracks) and a temporal stability score (one minus the number of label changes per track, divided by track length). One caveat matters before you rely on it: in that paper, the stability improvement from track-level aggregation is stated as an expectation and a hypothesis, not as a measured result.

The defect ratio’s denominator is the number of tracks. Fraction nonconforming is defined over items, not tracks: the number of nonconforming items divided by the total number of items. For defects visible from only a few angles, we would weight frames by classifier confidence or require a minimum number of defect frames instead of a majority vote.

What an Identity Switch Does to Defect-Rate and False-Reject Statistics

An identity switch (IDSW) is counted when a ground-truth object that was matched to one track becomes matched to a different track. Two related errors matter on a line. Fragmentation counts each time an object’s trajectory goes from tracked to untracked and is later picked up again. An ID transfer is the opposite of a switch: one predicted track spreads across two real objects. In the HOTA framework’s terms, splitting one object into several tracks lowers association recall, and one track covering several objects lowers association precision.

Missed or prematurely ended trajectories cause under-counting, while identity switches, duplicate trajectories or repeated events cause wrong counts in the other direction. On an inspection line, that means:

  • A defective part split into two tracks, both labelled defective, adds one to the defect count and one to the part count, so the defect rate rises.
  • A good part split into two tracks, both labelled good, adds only to the denominator, so the defect rate falls.
  • One track spanning a defective part and the good part behind it applies one track-level verdict to both parts.

Occlusion causes detection dropouts, fragmentation, spurious re-initialisations and identity switches.

Worked Example: A Fragmented Track on a P-Chart

The assumptions here are for illustration only. The NIST/SEMATECH e-Handbook gives the p-chart limits as p ± 3√(p(1−p)/n). With p = 0.02 and n = 1,000, √(0.02 × 0.98 / 1,000) ≈ 0.00443, so the limits are about 0.0067 and 0.0333.

Now assume, for illustration, that the tracker splits every defective part into two tracks, with D counted per track. At p = 0.02 that is 20 defective parts; their 20 extra tracks make D = 40 and n = 1,020, so D/n ≈ 0.039. That point is above the upper control limit even though the process has not changed.

How you set limits, subgroup sizes and cost-based thresholds is covered in where CV fits in QC engineering. Running the charts themselves is covered in statistical process control (SPC) for CV inspection.

Choosing a Motion Tracker for a One-Direction Conveyor

We would treat a conveyor as close to the easiest case multi-object tracking has. Parts pass a fixed camera. Motion-based association relies on object dynamics and scene geometry being reliable priors, especially when appearance is poor.

We would therefore start at the simple end of the tracker range. SORT uses a Kalman filter and the Hungarian algorithm, uses only detection information from the previous and current frames, and reached accuracy comparable to the best online trackers of its time. ByteTrack, as Ultralytics documents it, uses a linear Kalman filter with IoU matching in two stages. It first matches high-score detections to active tracks, then retries unmatched tracks against low-score detections to recover through brief partial occlusion, with no appearance model and no camera-motion compensation. The low-score stage matters because thresholding away low-confidence boxes (occluded objects, for example) causes missed objects and fragmented trajectories. The ByteTrack authors report 80.3 MOTA, 77.3 IDF1 and 63.1 HOTA on the MOT17 test set at 30 FPS on a single V100 GPU. Those are pedestrian-benchmark figures.

Appearance features are the next step up, adding cost to hold identity through longer occlusions. DeepSORT added a learned appearance metric to SORT so objects could be tracked through longer occlusions, and, with a metric learned on a person re-identification dataset, it reports 45% fewer identity switches. The catch on an inspection line is that parts of one SKU are made to be identical. That makes appearance embeddings less discriminative than they are for pedestrians, so matching people’s clothing is a poor guide to matching nominally identical castings. Agricultural tracking work makes a similar point about fruit, which is visually similar and often stationary while the camera moves. Where parts really do need to be told apart across stations or cameras, that is a re-identification problem, covered in Re-ID for tracking parts across the line for SPC.

Line condition Tracker we would start with Why
Fixed camera, single lane, parts spaced apart SORT-style Kalman + IoU Motion-based association relies on predictable dynamics
Fixed camera, brief partial occlusion or confidence dips (glare, guide rails) ByteTrack The second stage recovers tracks from low-score boxes
Parts touching, overlapping or briefly hidden for longer spans DeepSORT-style appearance + motion Appearance helps hold identity through longer occlusions
Tight compute budget on edge hardware ByteTrack without an appearance network Avoiding the embedding network limits association cost

The input detector strongly affects tracking results. The SORT authors found that changing the detector could improve tracking by up to 18.9%, and the HOTA authors report that a better input detector improved every main metric. If identity switches are high, look at duplicate and unstable detections before replacing the tracker. This is also where production surprises appear: off-the-shelf detection and tracking that works in a demo can fail under the edge cases, lighting and throughput of a real line, and the review literature notes a persistent gap between leaderboard results and deployment needs such as long-term identity stability. For the wider failure picture, see where multiple object tracking breaks in production.

Tying One Reject Decision to One Physical Part

The track identity binds frame-level verdicts to one part while the part is in view. The counting gate is where the verdict is handed over: one identity crosses once and triggers at most one event. In the fruit-counting pipeline, trajectory segments separated by too long a gap are not joined, so a track that reappears after a long interruption is not taken as a valid crossing. Inspection gates need the same rule.

After the gate, the controller’s encoder-based tracking of the part takes over. Because inspection and rejection happen at different points on a moving line, an encoder measures belt travel so the controller fires the reject only when that specific failed part reaches the actuator. A confirmation sensor after the actuator checks that the part actually left the line, and fail-safe logic stops the line and raises an alarm if a commanded reject cannot be verified. The full PLC handover, timing and MES side is covered in PLC and MES integration when scaling inspection.

We would require the tracking scheme to deliver exactly one verdict per part, at a known belt position, with its track identity recorded. Then each reject decision can be traced to a single physical part and its track. Without that record, a commanded reject points at a belt position and nothing more.

How Do You Know the Tracker Is Good Enough for the Line?

Start by distrusting MOTA as your headline number. A 2025 review of multi-object tracking finds that MOTA leans heavily towards detection performance, under-penalises identity switches, ignores association quality beyond first-order matching, and counts a corrected association as another switch. The HOTA authors measured MOTA’s correlation with detection score at 0.96, against 0.46 with association score. The fruit-counting study shows the effect in practice: one sequence scored higher on MOTA than another yet clearly lower on IDF1, HOTA and AssA, so the authors read MOTA only alongside the identity measures.

The measures that answer an inspection line’s questions are these:

  • IDF1: an F1 score built on a one-to-one mapping between whole trajectories, from identity true positives, false positives and false negatives. It tracks association closely (0.97 correlation with association score in the HOTA analysis).
  • HOTA, with DetA and AssA: the geometric mean of detection accuracy and association accuracy, so it always sits between the two. Comparing DetA and AssA makes the effect of each error type clear.
  • IDSW, divided by recall: the MOT16 benchmark reports identity switches relative to recall, because a tracker that finds more objects will almost certainly produce more switches.
  • Fragmentation (FM): the number of times a trajectory is interrupted and later resumed.
  • Per-part count accuracy against a manual audit, and the share of rejects traceable to a single track. Counting is scored separately from tracking, as event-level precision, recall and F1 plus count error, in the fruit-counting work.

TrackEval, the code released with HOTA, computes HOTA and its sub-metrics and the CLEAR MOT metrics (MOTA, MOTP, MT, ML, Frag). Two details stop the evaluation from flattering you. First, split annotated video by sequence, not by frame, because adjacent frames are strongly correlated, so held-out frames cannot enter training or tracker tuning. Second, keep in mind that HOTA scores association globally over the whole sequence, forwards and backwards in time, which suits an online system making decisions frame by frame less well than it suits offline analysis. For a line that decides at the gate, the event-level count and reject traceability are the closest measures of what the plant actually experiences.

These measures belong with the other reliability artefacts a line-side model is signed against. Production AI reliability is its own discipline, separate from model accuracy: evaluation harnesses, regression suites and drift detection that catch failures before customers do. Track-identity quality is the part of that discipline that keeps defect-rate inputs free of frame-level double-counting. The wider set is described in industrial CV inspection production reliability.

Who Can Build the Tracking Layer for Our Inspection Line?

TechnoLynx builds the tracking scheme that turns your detector’s per-frame output into per-part identities, so that counts, defect rates and reject decisions on the line can be traced to single parts. In practice that means building and deploying the tracker for your line and measuring its identity-switch rate and per-part count accuracy against a manual audit. Per-part track identity is then the unit against which defect and false-reject rates are counted when the deployment is validated and monitored. The work sits within TechnoLynx Computer Vision R&D.

That engagement does not suit everyone. A team that already has annotated line video and engineers comfortable with TrackEval can reasonably build this layer in-house.

The first question we would ask of a line is not which tracker to use. It is whether anyone has ever compared the system’s part count with a hand count over a full shift. Until someone has, nobody can say whether the dashboard defect rate is per-part or per-frame, and every control limit drawn from it inherits that uncertainty.