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

Method rescale_mask

flowmap/flow/flow_predictor.py:50–57  ·  view source on GitHub ↗
(
        mask: Float[Tensor, "batch frame height width"],
        shape: tuple[int, int],
    )

Source from the content-addressed store, hash-verified

48
49 @staticmethod
50 def rescale_mask(
51 mask: Float[Tensor, "batch frame height width"],
52 shape: tuple[int, int],
53 ) -> Float[Tensor, "batch frame height_scaled width_scaled"]:
54 b, f, _, _ = mask.shape
55 flow = rearrange(mask, "b f h w -> (b f) () h w")
56 flow = F.interpolate(flow, shape, mode="bilinear", align_corners=False)
57 return rearrange(flow, "(b f) () h w -> b f h w", b=b, f=f)
58
59 @staticmethod
60 def compute_consistency_mask(

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected