Skip to content

Commit 75d7466

Browse files
mypy
1 parent 7683aaf commit 75d7466

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

pyroengine/vision.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def __init__(self, model_path: Optional[str] = "data/model.onnx", base_img_size:
4444
self.ort_session = onnxruntime.InferenceSession(model_path)
4545
self.base_img_size = base_img_size
4646

47-
def preprocess_image(self, pil_img: Image.Image, new_img_size: tuple) -> Tuple[np.ndarray, Tuple[int, int]]:
47+
def preprocess_image(self, pil_img: Image.Image, new_img_size: list) -> Tuple[np.ndarray, Tuple[int, int]]:
4848
"""Preprocess an image for inference
4949
5050
Args:
@@ -67,8 +67,8 @@ def __call__(self, pil_img: Image.Image, occlusion_mask: Optional[np.ndarray] =
6767

6868
w, h = pil_img.size
6969
ratio = self.base_img_size / max(w, h)
70-
new_img_size = (int(ratio * w), int(ratio * h))
71-
new_img_size = tuple([x - x % 32 for x in new_img_size]) # size need to be a multiple of 32 to fit the model
70+
new_img_size = [int(ratio * w), int(ratio * h)]
71+
new_img_size = [x - x % 32 for x in new_img_size] # size need to be a multiple of 32 to fit the model
7272
np_img = self.preprocess_image(pil_img, new_img_size)
7373

7474
# ONNX inference

0 commit comments

Comments
 (0)