This README documents what the current production-style pipeline actually does, phase by phase, using the exact model names/checkpoints and the real runtime logic from sway_pose_mvp/tools/run_pipeline_v23_bigtest.py.
The pipeline is designed for crowded, high-occlusion dance footage where identity swaps and limb confusion are common. It prioritizes correctness and temporal consistency over raw speed.
sway_pose_mvp/tools/run_pipeline_v23_bigtest.pysway_pose_mvp/sway/sway_pose_mvp/models/The pipeline runs in this order:
Each phase is intentional: earlier phases maximize recall and preserve alternatives; later phases add increasingly strict temporal and identity constraints.
These are the exact model names/checkpoints used in the current code path:
yolo26l_dancetrack.pt (fixed policy, no fallback allowed)yolo26l_dancetracksam2.1_hiera_large.ptsam2.1_l.pt then sam2.1_b.ptultralytics.SAMusyd-community/vitpose-plus-largeRTMW384HybridEstimator (rendered/logged as RTMW-X, includes full-joint output path)deepocsortosnet_x0_25_msmt17.ptbpbreid_r50_market_msmt17.pth via torchreid (strict preflight)buffalo_l via InsightFace FaceAnalysisReIDMLPRouter for dynamic signal weightingscipy.optimize.linear_sum_assignment)CoalescenceDetector + NOOUGATGraphStitcherlift_poses_v23 from sway.mamba_ssm_lifterWhy this exact stack works in crowds:
yolo26l_dancetrack gives stable person proposals for dance motion patterns.What it does:
classes=[0])0.3phase1_detection.mp4detections_phase1.jsonyolo26l_dancetrack.Exact model:
yolo26l_dancetrack.pt from models/ (hard-required).Key runtime knobs:
SWAY_PHASE1_HEARTBEAT_EVERY (progress logging cadence).Why this phase exists:
What it does:
SWAY_MASK_REUSE_IOU (default 0.70).0.30).phase2_masks.mp4masks_phase2.json with quality values.Exact model:
sam2.1_hiera_large.pt -> fallback sam2.1_l.pt -> fallback sam2.1_b.pt.Key runtime knobs:
SWAY_DISABLE_SAM_MASKINGSWAY_SAM2_WEIGHTSSWAY_PHASE2_HEARTBEAT_EVERYSWAY_MASK_FRAME_STRIDESWAY_MASK_REUSE_IOUSWAY_SELECTIVE_MASKINGWhy this phase exists:
What it does:
usyd-community/vitpose-plus-large)RTMW384HybridEstimator)vitpose_keypointsrtmwx_keypointsrtmwx_keypoints_fullphase3_vitpose.mp4phase3_rtmwx.mp4phase3_vitpose_overlay.jsonExact models:
usyd-community/vitpose-plus-largeRTMW384HybridEstimatorKey runtime knobs:
SWAY_PHASE3_VIZ_MIN_POINT_CONF (default 0.03)SWAY_PHASE3_VIZ_MIN_BONE_CONF (default 0.05)SWAY_PHASE3_VIZ_ADAPT_QUANTILE (default 0.70)Why this phase exists:
What it does:
SWAY_PHASE35_ENABLED=1SWAY_PHASE35_MODE is shadow or activeshadow mode: computes decisions, writes diagnostics, does not mutate pipeline state.active mode: can replace pretrack_pose_by_frame_det with resolved map.SWAY_PHASE35_FORCE_FAIL_OPEN=1, baseline phase-3 data is retained.phase3_5_disambiguation.jsonphase3_5_metrics.jsonCore gating config (exact env family):
SWAY_PHASE35_IOU_THRESHSWAY_PHASE35_LOW_CONF_THRESHSWAY_PHASE35_MIN_MARGINSWAY_PHASE35_TEMPORAL_WEIGHTSWAY_PHASE35_HAIR_HAND_GUARDSWAY_PHASE35_HAIR_HAND_CONF_THRESHSWAY_PHASE35_HAIR_HAND_RT_CONF_THRESHSWAY_PHASE35_HAIR_HAND_DISAGREE_PXSWAY_PHASE35_HAIR_HAND_ARM_RATIO_MAXSWAY_PHASE35_HAIR_HAND_TEMPORAL_JUMP_PXSWAY_PHASE35_HAIR_HAND_LOCK_FRAMESSWAY_PHASE35_HAIR_HAND_REPLACE_ELBOWWhy this phase exists:
What it does:
deepocsort (BoxMOT), with dynamic backend compatibility wrappers.phase4_tracking_forward.mp4phase4_tracking_bidirectional.mp4tracklets_forward.jsontracklets_backward.jsondata.json (MOT-style export)Exact tracker models/checkpoints:
deepocsortosnet_x0_25_msmt17.ptKey runtime knobs:
SWAY_TRACKER_BACKEND, SWAY_TRACKER_DET_THRESH, SWAY_TRACKER_MAX_AGE,SWAY_TRACKER_IOU_THRESHOLD, SWAY_TRACKER_DELTA_T, SWAY_TRACKER_INERTIA,SWAY_TRACKER_W_ASSOC_EMBSWAY_TRACKER_AB, SWAY_TRACKER_AB_BACKENDS, SWAY_TRACKER_AB_MIN_OVERLAP_FRAMESSWAY_SHORT_TRACK_MIN_FRAMES, SWAY_SHORT_TRACK_MIN_CONFSWAY_REFLECTION_EDGE_MARGIN_FRAC, SWAY_REFLECTION_EDGE_PRESENCE_FRACSWAY_REFLECTION_MIN_SIGN_CONFLICT_FRAC, SWAY_REFLECTION_MAX_HEIGHT_FRACWhy this phase exists:
What it does:
SWAY_ENROLL_SAM_MASK_MIN_QUALITY, default 0.20)SWAY_ENROLL_VITPOSE_MIN_CONF (default 0.35)SWAY_ENROLL_RTMWX_MIN_CONF (default 0.35)gallery_identity_bank.jsonExact models involved:
bpbreid_r50_market_msmt17.pthbuffalo_lWhy this phase exists:
What it does:
SWAY_REID_SWITCH_COOLDOWN_FRAMES)phase6_reid_fusion.mp4phase6_identity_assignments_reid.json (+ alias copy)Key runtime knobs:
SWAY_FACE_EMBED_STRIDESWAY_PART_CACHE_TTL, SWAY_PART_CACHE_IOUSWAY_REID_TEMPORAL_WINDOWSWAY_REID_COLD_START_FRAMES, SWAY_REID_COLD_START_BONUSSWAY_REID_LOCK_CONFIRM_FRAMES, SWAY_REID_LOCK_SWITCH_PENALTY, SWAY_REID_UNLOCK_MARGINSWAY_REID_SWITCH_MARGIN, SWAY_REID_SWITCH_COOLDOWN_FRAMESWhy this phase exists:
What it does:
reid_assignments_phase4), optionally replacing with formation-constrained assignment logic when in formation mode.phase7_darkzone_resolution.mp4Exact algorithms/components:
CoalescenceDetector(iou_thresh=0.25, consecutive_frames=2)NOOUGATGraphStitcherformation_identity.Why this phase exists:
What it does:
SWAY_TEMPORAL_POSE_REFINE, radius configurable).pose2d_phase6.json (keypoints + visibility + confidence-state + geometric validity flags)lift_poses_v23phase7_legacy_pose3d_compat.mp4Why it still exists:
What it does:
SWAY_PHASE8_CONF_THRESH (default 0.90)SWAY_PHASE8_KIN_CONF_THRESH (default 0.70)SWAY_PHASE8_XTRACK_CONF_THRESH (default 0.88)SWAY_PHASE8_XTRACK_GATE_PX (default width*0.12)SWAY_PHASE8_NEIGHBOR_WINDOW (default 4)SWAY_PHASE8_NEIGHBOR_MIN_RATIO (default 0.50)SWAY_PHASE8_XTRACK_TARGET_APPLY_RATIOphase8_final_optimized.mp4final_identity_tracks.jsonphase8_reject_log.jsonWhy this phase exists:
The key principle is layered uncertainty reduction:
This ordering is important. If strict identity locking happens too early, the system cements mistakes. If global correction happens without prior multi-signal evidence, corrections become unstable. The current sequence is built to avoid both failure modes.
Primary outputs for debugging and analysis:
phase1_detection.mp4, detections_phase1.jsonphase2_masks.mp4, masks_phase2.jsonphase3_vitpose.mp4, phase3_rtmwx.mp4, phase3_vitpose_overlay.jsonphase3_5_disambiguation.json, phase3_5_metrics.json (when enabled)phase4_tracking_forward.mp4, phase4_tracking_bidirectional.mp4, tracklets_forward.json, tracklets_backward.json, data.jsongallery_identity_bank.jsonphase6_reid_fusion.mp4, phase6_identity_assignments_reid.jsonphase7_darkzone_resolution.mp4pose2d_phase6.json, phase7_legacy_pose3d_compat.mp4phase8_final_optimized.mp4, final_identity_tracks.json, phase8_reject_log.jsonevaluation_metrics.json, switch_event_log.json, run_manifest.jsonSWAY_STOP_AFTER_PHASE3=1, the run exits after tracking-side exports (for fast A/B and detector/tracker evaluation).SWAY_STOP_AFTER_PHASE4=1, the run exits after dark-zone/formation-level identity pass.off/shadow/active + fail-open).This README documents what the current production-style pipeline actually does, phase by phase, using the exact model names/checkpoints and the real runtime logic from sway_pose_mvp/tools/run_pipeline_v23_bigtest.py.
The pipeline is designed for crowded, high-occlusion dance footage where identity swaps and limb confusion are common. It prioritizes correctness and temporal consistency over raw speed.
sway_pose_mvp/tools/run_pipeline_v23_bigtest.pysway_pose_mvp/sway/sway_pose_mvp/models/The pipeline runs in this order:
Each phase is intentional: earlier phases maximize recall and preserve alternatives; later phases add increasingly strict temporal and identity constraints.
These are the exact model names/checkpoints used in the current code path:
yolo26l_dancetrack.pt (fixed policy, no fallback allowed)yolo26l_dancetracksam2.1_hiera_large.ptsam2.1_l.pt then sam2.1_b.ptultralytics.SAMusyd-community/vitpose-plus-largeRTMW384HybridEstimator (rendered/logged as RTMW-X, includes full-joint output path)deepocsortosnet_x0_25_msmt17.ptbpbreid_r50_market_msmt17.pth via torchreid (strict preflight)buffalo_l via InsightFace FaceAnalysisReIDMLPRouter for dynamic signal weightingscipy.optimize.linear_sum_assignment)CoalescenceDetector + NOOUGATGraphStitcherlift_poses_v23 from sway.mamba_ssm_lifterWhy this exact stack works in crowds:
yolo26l_dancetrack gives stable person proposals for dance motion patterns.What it does:
classes=[0])0.3phase1_detection.mp4detections_phase1.jsonyolo26l_dancetrack.Exact model:
yolo26l_dancetrack.pt from models/ (hard-required).Key runtime knobs:
SWAY_PHASE1_HEARTBEAT_EVERY (progress logging cadence).Why this phase exists:
What it does:
SWAY_MASK_REUSE_IOU (default 0.70).0.30).phase2_masks.mp4masks_phase2.json with quality values.Exact model:
sam2.1_hiera_large.pt -> fallback sam2.1_l.pt -> fallback sam2.1_b.pt.Key runtime knobs:
SWAY_DISABLE_SAM_MASKINGSWAY_SAM2_WEIGHTSSWAY_PHASE2_HEARTBEAT_EVERYSWAY_MASK_FRAME_STRIDESWAY_MASK_REUSE_IOUSWAY_SELECTIVE_MASKINGWhy this phase exists:
What it does:
usyd-community/vitpose-plus-large)RTMW384HybridEstimator)vitpose_keypointsrtmwx_keypointsrtmwx_keypoints_fullphase3_vitpose.mp4phase3_rtmwx.mp4phase3_vitpose_overlay.jsonExact models:
usyd-community/vitpose-plus-largeRTMW384HybridEstimatorKey runtime knobs:
SWAY_PHASE3_VIZ_MIN_POINT_CONF (default 0.03)SWAY_PHASE3_VIZ_MIN_BONE_CONF (default 0.05)SWAY_PHASE3_VIZ_ADAPT_QUANTILE (default 0.70)Why this phase exists:
What it does:
SWAY_PHASE35_ENABLED=1SWAY_PHASE35_MODE is shadow or activeshadow mode: computes decisions, writes diagnostics, does not mutate pipeline state.active mode: can replace pretrack_pose_by_frame_det with resolved map.SWAY_PHASE35_FORCE_FAIL_OPEN=1, baseline phase-3 data is retained.phase3_5_disambiguation.jsonphase3_5_metrics.jsonCore gating config (exact env family):
SWAY_PHASE35_IOU_THRESHSWAY_PHASE35_LOW_CONF_THRESHSWAY_PHASE35_MIN_MARGINSWAY_PHASE35_TEMPORAL_WEIGHTSWAY_PHASE35_HAIR_HAND_GUARDSWAY_PHASE35_HAIR_HAND_CONF_THRESHSWAY_PHASE35_HAIR_HAND_RT_CONF_THRESHSWAY_PHASE35_HAIR_HAND_DISAGREE_PXSWAY_PHASE35_HAIR_HAND_ARM_RATIO_MAXSWAY_PHASE35_HAIR_HAND_TEMPORAL_JUMP_PXSWAY_PHASE35_HAIR_HAND_LOCK_FRAMESSWAY_PHASE35_HAIR_HAND_REPLACE_ELBOWWhy this phase exists:
What it does:
deepocsort (BoxMOT), with dynamic backend compatibility wrappers.phase4_tracking_forward.mp4phase4_tracking_bidirectional.mp4tracklets_forward.jsontracklets_backward.jsondata.json (MOT-style export)Exact tracker models/checkpoints:
deepocsortosnet_x0_25_msmt17.ptKey runtime knobs:
SWAY_TRACKER_BACKEND, SWAY_TRACKER_DET_THRESH, SWAY_TRACKER_MAX_AGE,SWAY_TRACKER_IOU_THRESHOLD, SWAY_TRACKER_DELTA_T, SWAY_TRACKER_INERTIA,SWAY_TRACKER_W_ASSOC_EMBSWAY_TRACKER_AB, SWAY_TRACKER_AB_BACKENDS, SWAY_TRACKER_AB_MIN_OVERLAP_FRAMESSWAY_SHORT_TRACK_MIN_FRAMES, SWAY_SHORT_TRACK_MIN_CONFSWAY_REFLECTION_EDGE_MARGIN_FRAC, SWAY_REFLECTION_EDGE_PRESENCE_FRACSWAY_REFLECTION_MIN_SIGN_CONFLICT_FRAC, SWAY_REFLECTION_MAX_HEIGHT_FRACWhy this phase exists:
What it does:
SWAY_ENROLL_SAM_MASK_MIN_QUALITY, default 0.20)SWAY_ENROLL_VITPOSE_MIN_CONF (default 0.35)SWAY_ENROLL_RTMWX_MIN_CONF (default 0.35)gallery_identity_bank.jsonExact models involved:
bpbreid_r50_market_msmt17.pthbuffalo_lWhy this phase exists:
What it does:
SWAY_REID_SWITCH_COOLDOWN_FRAMES)phase6_reid_fusion.mp4phase6_identity_assignments_reid.json (+ alias copy)Key runtime knobs:
SWAY_FACE_EMBED_STRIDESWAY_PART_CACHE_TTL, SWAY_PART_CACHE_IOUSWAY_REID_TEMPORAL_WINDOWSWAY_REID_COLD_START_FRAMES, SWAY_REID_COLD_START_BONUSSWAY_REID_LOCK_CONFIRM_FRAMES, SWAY_REID_LOCK_SWITCH_PENALTY, SWAY_REID_UNLOCK_MARGINSWAY_REID_SWITCH_MARGIN, SWAY_REID_SWITCH_COOLDOWN_FRAMESWhy this phase exists:
What it does:
reid_assignments_phase4), optionally replacing with formation-constrained assignment logic when in formation mode.phase7_darkzone_resolution.mp4Exact algorithms/components:
CoalescenceDetector(iou_thresh=0.25, consecutive_frames=2)NOOUGATGraphStitcherformation_identity.Why this phase exists:
What it does:
SWAY_TEMPORAL_POSE_REFINE, radius configurable).pose2d_phase6.json (keypoints + visibility + confidence-state + geometric validity flags)lift_poses_v23phase7_legacy_pose3d_compat.mp4Why it still exists:
What it does:
SWAY_PHASE8_CONF_THRESH (default 0.90)SWAY_PHASE8_KIN_CONF_THRESH (default 0.70)SWAY_PHASE8_XTRACK_CONF_THRESH (default 0.88)SWAY_PHASE8_XTRACK_GATE_PX (default width*0.12)SWAY_PHASE8_NEIGHBOR_WINDOW (default 4)SWAY_PHASE8_NEIGHBOR_MIN_RATIO (default 0.50)SWAY_PHASE8_XTRACK_TARGET_APPLY_RATIOphase8_final_optimized.mp4final_identity_tracks.jsonphase8_reject_log.jsonWhy this phase exists:
The key principle is layered uncertainty reduction:
This ordering is important. If strict identity locking happens too early, the system cements mistakes. If global correction happens without prior multi-signal evidence, corrections become unstable. The current sequence is built to avoid both failure modes.
Primary outputs for debugging and analysis:
phase1_detection.mp4, detections_phase1.jsonphase2_masks.mp4, masks_phase2.jsonphase3_vitpose.mp4, phase3_rtmwx.mp4, phase3_vitpose_overlay.jsonphase3_5_disambiguation.json, phase3_5_metrics.json (when enabled)phase4_tracking_forward.mp4, phase4_tracking_bidirectional.mp4, tracklets_forward.json, tracklets_backward.json, data.jsongallery_identity_bank.jsonphase6_reid_fusion.mp4, phase6_identity_assignments_reid.jsonphase7_darkzone_resolution.mp4pose2d_phase6.json, phase7_legacy_pose3d_compat.mp4phase8_final_optimized.mp4, final_identity_tracks.json, phase8_reject_log.jsonevaluation_metrics.json, switch_event_log.json, run_manifest.jsonSWAY_STOP_AFTER_PHASE3=1, the run exits after tracking-side exports (for fast A/B and detector/tracker evaluation).SWAY_STOP_AFTER_PHASE4=1, the run exits after dark-zone/formation-level identity pass.off/shadow/active + fail-open).