From 4a35f091037eacfc58013659105d31ebc6aba6ee Mon Sep 17 00:00:00 2001 From: SkyLi Date: Sun, 29 Mar 2026 01:25:25 +0800 Subject: [PATCH] fix: send RGB image to diagnose(), not grayscale The upstream diagnose.py expects RGB input for YOLO detection. Revert to RGB since the detector needs 3 channels. --- src/main.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main.py b/src/main.py index fc4dcbc..35003a6 100644 --- a/src/main.py +++ b/src/main.py @@ -47,9 +47,9 @@ async def infer(image: UploadFile = File(...)) -> dict: } } """ - # 读取图片内容(转灰度,与 diagnose.py 对文件路径的处理逻辑一致) + # 读取图片内容 contents = await image.read() - img = Image.open(io.BytesIO(contents)).convert("L") + img = Image.open(io.BytesIO(contents)).convert("RGB") img_array = np.array(img) diagnoser = get_diagnoser()