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:
+2
-2
@@ -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()
|
||||||
|
|||||||
Reference in New Issue
Block a user