MCPcopy Create free account
hub / github.com/dcharatan/flowmap / compute_tracks

Function compute_tracks

flowmap/tracking/__init__.py:80–110  ·  view source on GitHub ↗
(
    batch: Batch,
    device: torch.device,
    tracking_cfg: TrackPredictorCfg,
    precomputation_cfg: TrackPrecomputationCfg,
)

Source from the content-addressed store, hash-verified

78
79
80def compute_tracks(
81 batch: Batch,
82 device: torch.device,
83 tracking_cfg: TrackPredictorCfg,
84 precomputation_cfg: TrackPrecomputationCfg,
85) -> list[Tracks]:
86 # Set up the tracker.
87 tracker = get_track_predictor(tracking_cfg)
88 tracker.to(device)
89
90 # Since we only use tracks for overfitting, assert that the batch size is 1.
91 b, _, _, _, _ = batch.videos.shape
92 assert b == 1
93
94 cache_key = get_cache_key(
95 batch.datasets[0],
96 batch.scenes[0],
97 batch.indices[0],
98 precomputation_cfg.interval,
99 precomputation_cfg.radius,
100 )
101 disk_cache = make_cache(precomputation_cfg.cache_path)
102 return disk_cache(
103 cache_key,
104 lambda: generate_video_tracks(
105 tracker,
106 batch.videos[:1].to(device),
107 precomputation_cfg.interval,
108 precomputation_cfg.radius,
109 ),
110 )

Callers 1

overfitFunction · 0.85

Calls 5

get_track_predictorFunction · 0.85
get_cache_keyFunction · 0.85
make_cacheFunction · 0.85
generate_video_tracksFunction · 0.85
toMethod · 0.45

Tested by

no test coverage detected