JoJosmin commited on
Commit
d725458
ยท
verified ยท
1 Parent(s): b646871

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -2
app.py CHANGED
@@ -111,7 +111,13 @@ def detect_clothing_onnx(image):
111
  categories = []
112
 
113
  for detection in detections:
114
- x1, y1, x2, y2, conf, cls = detection[:6] # ํ•„์š”ํ•œ ๊ฐ’๋งŒ ์ถ”์ถœ
 
 
 
 
 
 
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]))