Multi-object tracking in the /videos/vehicles/ change in DVSA-API:
What the tracker has to solve
Tracking on the ground, not in the image
Predicting where each vehicle will be
Matching detections to tracks in four stages
The life of a track
What the tracker feeds
Limits seen on real footage
Results
What the tracker has to solve
The detector looks at one frame at a time. It returns a list of boxes, each with a confidence score and a class such as car or truck. It does not know that the car at the top of frame 40 is the same car near the top of frame 41. The tracker supplies that link. It turns per-frame detections into tracks, where each track is one vehicle with a stable ID and a history of positions. Everything downstream depends on those tracks: the moving or stationary label, the trails in the video, and the counts in the report.
The tracker is in core/vehicles/tracker.py. It follows the ByteTrack approach, with three changes for drone footage. It works in camera-compensated coordinates. It measures every time limit in seconds rather than frames. It can re-find a lost vehicle by distance as well as by box overlap.
Tracking on the ground, not in the image
A drone camera is always moving. If the tracker worked in raw image pixels, a parked car would appear to slide across the frame whenever the drone panned. The motion model would then have to absorb the drone's movement as well as the vehicle's.
So before tracking, each frame is aligned to the first processed frame. The motion estimator finds a few hundred background corner points and follows them from the previous frame with optical flow. It then fits one global transform with RANSAC, which ignores points that don't agree with the majority. Corners on or near detected vehicles are masked out first, because vehicles move on their own and would distort the camera estimate. Chaining these frame-to-frame transforms maps every frame onto the first one. That shared plane is called the reference or ground plane.
Every detection box is projected into the ground plane before the tracker sees it. A parked car keeps roughly the same ground position for its whole track, and a moving car moves only by its real motion.
If one alignment step fails, for example on a blurred frame, the estimator reuses the last good camera motion. It does not assume the drone stopped, because that would shift every track at once. The failed step is still recorded, and vehicle states in that time window become unknown. A real scene cut is handled differently: tracks from the old scene end, and new ones start in the new scene.
Predicting where each vehicle will be
Each track has a Kalman filter. Its state is the box centre, width and height, plus a velocity for each of those four values. Velocities are in pixels per second, not per frame. Detection runs on frames chosen by timestamp, and drone video often has an irregular frame rate. Using seconds means a gap between frames simply becomes a longer prediction step.
Before matching, every track is moved forward to the current time. The filter's uncertainty grows with the time step and with the box's size, so a large truck tolerates more pixel error than a small car. After a match, the filter blends its prediction with the new detection. That smooths out jitter in the detector's boxes.
Matching detections to tracks in four stages
Each processed frame, detections are split by confidence. High-confidence detections score 0.25 or more. Low-confidence detections score from 0.10 up to 0.25. Matching then runs in four stages, and each stage only sees what earlier stages left unmatched.
1. Confident detections to established tracks. These include confirmed tracks and tracks lost recently. The cost is one minus the box overlap between the predicted box and the detection. An optimal assignment solver picks the pairing with the lowest total cost, and pairs with less than 20 % overlap are rejected.
2. Low-confidence detections to confirmed tracks only. This is ByteTrack's main idea. Small vehicles seen from above often get weak scores in some frames, and throwing those detections away would break tracks. A weak detection can continue a vehicle we are already following, but it can never start a new track. That keeps noise from creating vehicles.
3. Confident detections to tentative tracks. Tentative tracks are new candidates that haven't been confirmed yet.
4. Re-finding lost tracks by distance. Small boxes overlap poorly. A 20 px car that is 6 px off its predicted spot can have almost no overlap. So any track still unmatched is compared with the remaining confident detections by centre distance. The distance is measured in the track's own body lengths. The allowed distance starts at one body length and grows by 1.5 per second the track has been lost, up to four. A car that disappeared behind a tree for half a second can then be picked up again where it has driven to.
The life of a track
State How it gets there What happens next?
Tentative A confident detection with score 0.30 or more matches nothing It needs three matches to be confirmed; one miss deletes it
Confirmed Three matches It gets the next public ID and appears in the video and the report
Lost A confirmed track misses a frame It is predicted forward and can still be matched or re-found
Removed Lost for more than 2s It is archived with an end reason
Public IDs are only given out on confirmation. A one-frame false positive, such as a shadow that looks like a car, never gets an ID and never inflates the count.
While a track is lost, its predicted velocity fades with a five-second time constant. A vehicle that vanishes is assumed to keep moving for a while, but the prediction doesn't drift off forever. When a track is removed, the tracker records whether its predicted position had left the camera view or was still inside it. The report uses that to tell "drove out of frame" apart from "lost in view".
Each track also keeps a class vote. Every matched detection adds one vote for its class. The track's class is the most common vote, with summed confidence breaking ties. A car that is called a truck in one frame stays a car.
What the tracker feeds
For every confirmed track matched in a frame, the pipeline takes its ground positions from the last second. It fits a straight-line velocity to them and converts that into body lengths per second. That speed drives the moving, stationary or unknown label, using thresholds and a short delay before changing state. The same ground positions are mapped back into the current image to draw the two-second trail behind each vehicle. At the end, each track becomes a record in the JSON report with its lifetime, class, time in each state, path length, interruptions and how it ended.
Limits seen on real footage
The tracker has no appearance model. A vehicle that leaves the frame and comes back gets a new ID, and so does one that is missed for more than two seconds. Scene cuts end all tracks. Dense rows of parked cars are partly missed, but that comes from detector recall rather than tracking. On the 46-second test video for account 5, the run produced 59 track IDs, 53 of which lasted at least one second, with a peak of 28 vehicles in view. The ID count leans high because fragmented tracks add extra IDs, and the in-view count leans low because the detector misses some vehicles. The report says that neither number is validated against ground truth.
Results
https://tinyurl.com/raviobjtrk
No comments:
Post a Comment