From 58fbceef97434faeeb9686e3e5bcdb5e4f30fcdc Mon Sep 17 00:00:00 2001 From: zchengrong Date: Mon, 23 Jun 2025 15:54:32 +0800 Subject: [PATCH] =?UTF-8?q?feat=EF=BC=88=E6=96=B0=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=EF=BC=89:=20fix=EF=BC=88=E4=BF=AE=E5=A4=8Dbug=EF=BC=89:=20=20c?= =?UTF-8?q?lothing=20seg=20=E6=9C=8D=E5=8A=A1=E5=9B=BE=E7=89=87=E7=BC=BA?= =?UTF-8?q?=E5=B0=913=E9=80=9A=E9=81=93=E9=80=BB=E8=BE=91=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=20docs=EF=BC=88=E6=96=87=E6=A1=A3=E5=8F=98=E6=9B=B4?= =?UTF-8?q?=EF=BC=89:=20refactor=EF=BC=88=E9=87=8D=E6=9E=84=EF=BC=89:=20te?= =?UTF-8?q?st(=E5=A2=9E=E5=8A=A0=E6=B5=8B=E8=AF=95):?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/service/clothing_seg/service.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/service/clothing_seg/service.py b/app/service/clothing_seg/service.py index 46cc444..6d2b4d0 100644 --- a/app/service/clothing_seg/service.py +++ b/app/service/clothing_seg/service.py @@ -62,7 +62,11 @@ class ClothingSeg: image = data["image"] clothing_result = [] if image_type == "sketch": - seg_mask = get_seg_result(1, image[:, :, :3]) + if len(image.shape) == 2: + image = np.stack([image] * 3, axis=-1) + seg_mask = get_seg_result(1, image[:, :, :3]) + else: + seg_mask = get_seg_result(1, image[:, :, :3]) temp = seg_mask != 0.0 mask = (255 * (temp + 0).astype(np.uint8)) x_min, y_min, x_max, y_max = get_bounding_box(mask)