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.
This commit is contained in:
SkyLi
2026-03-29 01:25:25 +08:00
parent 8c4ba20920
commit 4a35f09103
+2 -2
View File
@@ -47,9 +47,9 @@ async def infer(image: UploadFile = File(...)) -> dict:
} }
} }
""" """
# 读取图片内容(转灰度,与 diagnose.py 对文件路径的处理逻辑一致) # 读取图片内容
contents = await image.read() 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) img_array = np.array(img)
diagnoser = get_diagnoser() diagnoser = get_diagnoser()