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

Function resize_batch

flowmap/misc/cropping.py:19–27  ·  view source on GitHub ↗
(batch: Batch, shape: tuple[int, int])

Source from the content-addressed store, hash-verified

17
18
19def resize_batch(batch: Batch, shape: tuple[int, int]) -> Batch:
20 b, f, _, _, _ = batch.videos.shape
21 h, w = shape
22
23 videos = rearrange(batch.videos, "b f c h w -> (b f) c h w")
24 videos = F.interpolate(videos, (h, w), mode="bilinear", align_corners=False)
25 videos = rearrange(videos, "(b f) c h w -> b f c h w", b=b, f=f)
26
27 return replace(batch, videos=videos)
28
29
30def compute_patch_cropped_shape(

Callers 2

Calls

no outgoing calls

Tested by

no test coverage detected