Abijith commited on
Commit
ceb376b
1 Parent(s): cef3c32

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -28,8 +28,8 @@ vehicle_threshold = 0.5
28
  def bbox_normalization(bbox, width, height):
29
  height_coeff = height/352
30
  width_coeff = width/352
31
- normalized_bbox = [int(bbox[0]*width_coeff), int(bbox[1]*height_coeff),
32
- int(bbox[2]*width_coeff), int(bbox[3]*height_coeff)]
33
  return normalized_bbox
34
 
35
  def bbox_area(bbox):
@@ -47,7 +47,7 @@ def segment_to_bbox(segment_indexs):
47
  if x_points and y_points:
48
  return [np.min(x_points), np.min(y_points), np.max(x_points), np.max(y_points)]
49
  else:
50
- return [0,0,0,0]
51
 
52
  def clipseg_prediction(image):
53
 
@@ -77,9 +77,9 @@ def clipseg_prediction(image):
77
 
78
  # Vehicle checking
79
  if bbox_area(vehicle_bbox) > bbox_area(damage_bbox):
80
- return True, bbox_normalization(damage_bbox, img_w, img_h)
81
  else:
82
- return False, []
83
 
84
 
85
  @torch.no_grad()
 
28
  def bbox_normalization(bbox, width, height):
29
  height_coeff = height/352
30
  width_coeff = width/352
31
+ normalized_bbox = [bbox[0]*width_coeff, bbox[1]*height_coeff,
32
+ bbox[2]*width_coeff, bbox[3]*height_coeff]
33
  return normalized_bbox
34
 
35
  def bbox_area(bbox):
 
47
  if x_points and y_points:
48
  return [np.min(x_points), np.min(y_points), np.max(x_points), np.max(y_points)]
49
  else:
50
+ return [0.0,0.0,0.0,0.0]
51
 
52
  def clipseg_prediction(image):
53
 
 
77
 
78
  # Vehicle checking
79
  if bbox_area(vehicle_bbox) > bbox_area(damage_bbox):
80
+ return True, [bbox_normalization(damage_bbox, img_w, img_h)]
81
  else:
82
+ return False, [[]]
83
 
84
 
85
  @torch.no_grad()