Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -111,7 +111,13 @@ def detect_clothing_onnx(image):
|
|
111 |
categories = []
|
112 |
|
113 |
for detection in detections:
|
114 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
115 |
if conf > 0.5: # ์ ๋ขฐ๋ ์๊ณ๊ฐ ์ค์
|
116 |
category = onnx_model_labels[int(cls)]
|
117 |
categories.append({
|
@@ -121,7 +127,6 @@ def detect_clothing_onnx(image):
|
|
121 |
})
|
122 |
|
123 |
return categories
|
124 |
-
|
125 |
# ์ด๋ฏธ์ง ์๋ฅด๊ธฐ
|
126 |
def crop_image(image, bbox):
|
127 |
return image.crop((bbox[0], bbox[1], bbox[2], bbox[3]))
|
|
|
111 |
categories = []
|
112 |
|
113 |
for detection in detections:
|
114 |
+
# detection์์ ํ์ํ ๊ฐ ์ถ์ถ
|
115 |
+
x1, y1, x2, y2, conf, cls = detection[:6]
|
116 |
+
|
117 |
+
# conf๊ฐ NumPy ๋ฐฐ์ด์ธ ๊ฒฝ์ฐ, ๋จ์ผ ๊ฐ์ผ๋ก ๋ณํ
|
118 |
+
if isinstance(conf, np.ndarray):
|
119 |
+
conf = conf.item() # ๋ฐฐ์ด์ ๋จ์ผ ๊ฐ์ผ๋ก ๋ณํ
|
120 |
+
|
121 |
if conf > 0.5: # ์ ๋ขฐ๋ ์๊ณ๊ฐ ์ค์
|
122 |
category = onnx_model_labels[int(cls)]
|
123 |
categories.append({
|
|
|
127 |
})
|
128 |
|
129 |
return categories
|
|
|
130 |
# ์ด๋ฏธ์ง ์๋ฅด๊ธฐ
|
131 |
def crop_image(image, bbox):
|
132 |
return image.crop((bbox[0], bbox[1], bbox[2], bbox[3]))
|