Abijith commited on
Commit
0386c75
·
1 Parent(s): bc3cd1b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -47,6 +47,8 @@ def segment_to_bbox(segment_indexs):
47
  return [np.min(x_points), np.min(y_points), np.max(x_points), np.max(y_points)]
48
 
49
  def clipseg_prediction(image):
 
 
50
  inputs = clip_processor(text=prompts, images=[image] * len(prompts), padding="max_length", return_tensors="pt")
51
  # predict
52
  with torch.no_grad():
@@ -71,7 +73,7 @@ def clipseg_prediction(image):
71
 
72
  # Vehicle checking
73
  if bbox_area(vehicle_bbox) > bbox_area(damage_bbox):
74
- return True, [bbox_normalization(damage_bbox)]
75
  else:
76
  return False, [[]]
77
 
 
47
  return [np.min(x_points), np.min(y_points), np.max(x_points), np.max(y_points)]
48
 
49
  def clipseg_prediction(image):
50
+ img_w = image.width
51
+ img_h = image.height
52
  inputs = clip_processor(text=prompts, images=[image] * len(prompts), padding="max_length", return_tensors="pt")
53
  # predict
54
  with torch.no_grad():
 
73
 
74
  # Vehicle checking
75
  if bbox_area(vehicle_bbox) > bbox_area(damage_bbox):
76
+ return True, [bbox_normalization(damage_bbox, img_w, img_h)]
77
  else:
78
  return False, [[]]
79