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

Function resize_to_resolution

flowmap/subsample.py:83–95  ·  view source on GitHub ↗
(
    image: Float[Tensor, "3 height width"],
    resolution: int,
)

Source from the content-addressed store, hash-verified

81
82
83def resize_to_resolution(
84 image: Float[Tensor, "3 height width"],
85 resolution: int,
86) -> Float[Tensor, "3 resized_height resized_width"]:
87 _, h, w = image.shape
88
89 scale = (resolution / (h * w)) ** 0.5
90 return F.interpolate(
91 image[None],
92 scale_factor=scale,
93 mode="bilinear",
94 align_corners=False,
95 )[0]
96
97
98def subsample_frames(

Callers 1

subsample_framesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected