skills/cv/bbox-interpolation-temporal-tracking/SKILL.md
Interpolate missing bounding boxes across video frames using bidirectional pandas interpolation to maintain smooth tracking through occlusions
npx skillsauth add wenmin-wu/ds-skills cv-bbox-interpolation-temporal-trackingInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
In video-based detection, helmet/object bounding boxes are often missing in some frames due to occlusion or detector failure. Rather than dropping those frames, collect known bbox coordinates into a DataFrame indexed by frame number, insert NaN rows for missing frames, and call interpolate(limit_direction='both'). This produces smooth trajectories for cropping player-centered patches across a temporal window.
import numpy as np
import pandas as pd
def interpolate_bboxes(detections, frame_range, subsample=4):
"""Interpolate missing bboxes across a temporal window.
detections: DataFrame with columns [frame, left, width, top, height]
frame_range: (start_frame, end_frame) inclusive
subsample: take every Nth frame after interpolation
"""
det_indexed = detections.set_index('frame')[['left', 'width', 'top', 'height']]
bboxes = []
for f in range(frame_range[0], frame_range[1] + 1):
if f in det_indexed.index:
bboxes.append(det_indexed.loc[f].values)
else:
bboxes.append([np.nan] * 4)
bboxes = pd.DataFrame(bboxes, columns=['left', 'width', 'top', 'height'])
bboxes = bboxes.interpolate(limit_direction='both').values
return bboxes[::subsample]
bboxes = interpolate_bboxes(frame_dets, (frame - 24, frame + 24), subsample=4)
interpolate(limit_direction='both')data-ai
Scaled Pinball Loss (SPL) metric for evaluating quantile forecasts, normalized by mean absolute successive differences of training data
data-ai
Walk backward through a time series and multiplicatively rescale segments when jumps exceed a fraction of the running mean to correct data collection anomalies
testing
Transform forecasting target to next/current ratio minus one so that optimizing MAE or squared error implicitly minimizes SMAPE
tools
Convert point forecasts to prediction intervals by scaling with logit-transformed quantile ratios passed through a Normal CDF