Abijith commited on
Commit
fd7dc8f
1 Parent(s): e1484f5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -98,7 +98,7 @@ def foward_pass(image_input: np.ndarray, points: List[List[int]]) -> np.ndarray:
98
  masks = processor.image_processor.post_process_masks(
99
  outputs.pred_masks.cpu(), inputs["original_sizes"].to(device), inputs["reshaped_input_sizes"].to(device)
100
  )
101
- masks = masks[0].squeeze(0).numpy().transpose(1, 2, 0)
102
 
103
  return masks
104
 
@@ -114,7 +114,7 @@ def main_func(inputs):
114
  final_mask = masks[0]
115
  mask_colors = np.zeros((final_mask.shape[0], final_mask.shape[1], 3), dtype=np.uint8)
116
  mask_colors[final_mask, :] = np.array([[128, 0, 0]])
117
- return Image.fromarray((mask_colors * 0.6 + image_input * 0.4).astype('uint8'), 'RGB')
118
  else:
119
  print('Prediction:: No vehicle found in the image')
120
  return Image.fromarray(image_input)
 
98
  masks = processor.image_processor.post_process_masks(
99
  outputs.pred_masks.cpu(), inputs["original_sizes"].to(device), inputs["reshaped_input_sizes"].to(device)
100
  )
101
+ masks = masks[0][0].squeeze(0).numpy()
102
 
103
  return masks
104
 
 
114
  final_mask = masks[0]
115
  mask_colors = np.zeros((final_mask.shape[0], final_mask.shape[1], 3), dtype=np.uint8)
116
  mask_colors[final_mask, :] = np.array([[128, 0, 0]])
117
+ return Image.fromarray((mask_colors+ image_input).astype('uint8'), 'RGB')
118
  else:
119
  print('Prediction:: No vehicle found in the image')
120
  return Image.fromarray(image_input)