it@M InnovationLab commited on
Commit
9af0a64
1 Parent(s): 76d6c53

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -1
app.py CHANGED
@@ -29,7 +29,8 @@ def detect(image):
29
  if seg_box[5] in vehicle_classes:
30
  vehicle_box = seg_box[:4].to(torch.int32)
31
  vehicle_crop = image.crop(vehicle_box.tolist())
32
- lp_result = lp_model(vehicle_crop, imgsz=(vehicle_crop.height, vehicle_crop.width), device="cpu")[0]
 
33
  lp_boxes = lp_result.boxes.data[:, :4]
34
  vehicle_offset = torch.cat((vehicle_box[:2], vehicle_box[:2]))
35
  for lp_box in lp_boxes:
 
29
  if seg_box[5] in vehicle_classes:
30
  vehicle_box = seg_box[:4].to(torch.int32)
31
  vehicle_crop = image.crop(vehicle_box.tolist())
32
+ imgsz = (vehicle_crop.height, vehicle_crop.width) if vehicle_crop.width < 640 and vehicle_crop.height < 640 else (640, 640)
33
+ lp_result = lp_model(vehicle_crop, imgsz=imgsz, device="cpu")[0]
34
  lp_boxes = lp_result.boxes.data[:, :4]
35
  vehicle_offset = torch.cat((vehicle_box[:2], vehicle_box[:2]))
36
  for lp_box in lp_boxes: