MCPcopy Create free account
hub / github.com/MrSyee/SAM-remove-background / get_preprocess_shape

Function get_preprocess_shape

src/client/utils.py:4–14  ·  view source on GitHub ↗

Compute the output size given input size and target long side length.

(
    oldh: int, oldw: int, long_side_length: int
)

Source from the content-addressed store, hash-verified

2
3
4def get_preprocess_shape(
5 oldh: int, oldw: int, long_side_length: int
6) -> Tuple[int, int]:
7 """
8 Compute the output size given input size and target long side length.
9 """
10 scale = long_side_length * 1.0 / max(oldh, oldw)
11 newh, neww = oldh * scale, oldw * scale
12 neww = int(neww + 0.5)
13 newh = int(newh + 0.5)
14 return (newh, neww)

Callers 2

get_image_embeddingFunction · 0.90
extract_objectFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected