From 27c969ff95b074306054ccf2ac3d0e146b5cbe5c Mon Sep 17 00:00:00 2001 From: Victor Elias Date: Mon, 18 Nov 2024 13:24:19 -0300 Subject: [PATCH] runner/live: Fix image resize logic to always set width,heiht (#281) The log afterwards was breaking --- runner/app/live/streamer/streamer.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/runner/app/live/streamer/streamer.py b/runner/app/live/streamer/streamer.py index 91d853ac..ae18ff99 100644 --- a/runner/app/live/streamer/streamer.py +++ b/runner/app/live/streamer/streamer.py @@ -124,8 +124,8 @@ async def run_ingress_loop(self, done: Event): # crop the max square from the center of the image and scale to 512x512 # most models expect this size especially when using tensorrt - if frame.width != frame.height: - width, height = frame.size + width, height = frame.size + if width != height: square_size = min(width, height) frame = frame.crop((width // 2 - square_size // 2, height // 2 - square_size // 2, width // 2 + square_size // 2, height // 2 + square_size // 2)) if frame.size != (512, 512):