From 9f6bb4873e606119888ec45e88af9e741a8febe3 Mon Sep 17 00:00:00 2001 From: wangchunlin Date: Fri, 17 Feb 2023 17:47:27 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=A0=E5=85=A5yolov7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- serverless/onnx/WongKinYiu/yolov7/nuclio/main.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/serverless/onnx/WongKinYiu/yolov7/nuclio/main.py b/serverless/onnx/WongKinYiu/yolov7/nuclio/main.py index 7f03715a..d64d309c 100644 --- a/serverless/onnx/WongKinYiu/yolov7/nuclio/main.py +++ b/serverless/onnx/WongKinYiu/yolov7/nuclio/main.py @@ -6,6 +6,9 @@ import yaml from model_handler import ModelHandler from PIL import Image +from PIL import ImageFile +ImageFile.LOAD_TRUNCATED_IMAGES = True + def init_context(context): context.logger.info("Init context... 0%") @@ -28,7 +31,7 @@ def handler(context, event): context.logger.info("Run YoloV7 ONNX model") data = event.body buf = io.BytesIO(base64.b64decode(data["image"])) - threshold = float(data.get("threshold", 0.5)) + threshold = float(data.get("threshold", 0.3)) image = Image.open(buf) results = context.user_data.model.infer(image, threshold)