Compute the output size given input size and target long side length.
(
oldh: int, oldw: int, long_side_length: int
)
| 2 | |
| 3 | |
| 4 | def 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) |
no outgoing calls
no test coverage detected