src.dataset.sdd_dataset module#
- class src.dataset.sdd_dataset.SDDDataset(*args: Any, **kwargs: Any)[source]#
Bases:
BaseDatasetStanford Drone Dataset (SDD) loader.
This dataset contains top-down drone footage with multiple categories such as pedestrians, bicycles, skaters, and vehicles.
- raw_fps = 30#
- classmethod load_data(args: Namespace, data_path: str) SDDDataset[source]#
Load data for a single SDD video scene.
Read annotations.txt, convert coordinates from pixels to meters, apply nontrivial data-cleaning logic such as abnormal-speed removal and trajectory smoothing, and load map.png if it exists; otherwise create a blank map.
- Parameters:
args (Namespace) – Global arguments.
data_path (str) – Path to annotations.txt.
- Returns:
Initialized dataset instance.
- Return type:
- classmethod load_data_batch(args: Namespace, data_path: str, show_tqdm=True) List[SDDDataset][source]#
Batch-load SDD datasets.
- static get_homography_mat(data_path)[source]#
Get the homography matrix from the dataset directory structure, effectively capturing the pixel-to-meter ratio.
Different SDD scenes such as bookstore and deathCircle use different scale factors.
- Parameters:
data_path (Path) – Data file path, used to infer the scene name.
- Returns:
3x3 scaling matrix, effectively diagonal in this case.
- Return type:
np.ndarray
- static clean_trajectory(traj, median_k=5, do_savgol=True, sg_win=9, sg_poly=2, do_loess=False, loess_frac=0.08, speed_window=11, speed_k=5.0, angle_window=11, angle_k=5.0, theta_thresh=numpy.deg2rad, split_angle_thresh=numpy.deg2rad, split_speed_delta=0.5, split_time_thresh=1.0)[source]#
Static utility method for trajectory cleaning and smoothing.
Denoise and smooth the raw trajectory, using Savitzky-Golay or LOESS, detect speed and angle anomalies, and split the trajectory into reasonable segments.
- Parameters:
traj (np.ndarray) – Raw trajectory (N, 3) with columns [t, x, y].
median_k (int) – Median-filter window size.
do_savgol (bool) – Whether to use Savitzky-Golay filtering.
... (other smoothing and splitting threshold parameters)
- Returns:
List of cleaned trajectory segments.
- Return type:
List[np.ndarray]