Forrest Wargo commited on
Commit
996299a
·
1 Parent(s): 416a2e8

fixing size error

Browse files
Files changed (1) hide show
  1. handler.py +4 -2
handler.py CHANGED
@@ -256,10 +256,11 @@ class EndpointHandler:
256
  image = image.convert("RGB")
257
 
258
  w, h = image.size
 
259
  if image_size is None:
260
- imgsz = {"h": h, "w": w}
261
  else:
262
- imgsz = [image_size.get("h", h), image_size.get("w", w)]
263
 
264
  out = self.yolo.predict(
265
  image,
@@ -267,6 +268,7 @@ class EndpointHandler:
267
  conf=bbox_threshold,
268
  iou=iou_threshold or 0.7,
269
  verbose=False,
 
270
  )[0]
271
  if out.boxes is None:
272
  raise RuntimeError(
 
256
  image = image.convert("RGB")
257
 
258
  w, h = image.size
259
+ # Use full-resolution inference for maximum accuracy; YOLO expects [h, w]
260
  if image_size is None:
261
+ imgsz = [h, w]
262
  else:
263
+ imgsz = [int(image_size.get("h", h)), int(image_size.get("w", w))]
264
 
265
  out = self.yolo.predict(
266
  image,
 
268
  conf=bbox_threshold,
269
  iou=iou_threshold or 0.7,
270
  verbose=False,
271
+ augment=True, # enable TTA for accuracy (scales/flips)
272
  )[0]
273
  if out.boxes is None:
274
  raise RuntimeError(