加入yolov7

main
wangchunlin 3 years ago
parent abf799884e
commit 9f6bb4873e

@ -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)

Loading…
Cancel
Save