napatswift commited on
Commit
5242954
·
1 Parent(s): 567c46b

Update app and weights

Browse files
Files changed (2) hide show
  1. main.py +3 -8
  2. model/table-det/model.pth +2 -2
main.py CHANGED
@@ -84,21 +84,16 @@ def predict(image_input):
84
  # Inference the tables in the image.
85
  result = inference_detector(table_det, image_input)
86
 
87
- # Create a list to store the bounding boxes.
88
- bbox_list = []
89
-
90
  # Get the masks of the tables.
91
  mask_images = result.pred_instances.masks.cpu().numpy()
92
  scores = result.pred_instances.scores.cpu().numpy()
93
 
94
- # Filter out masks with low scores.
95
- mask_images = mask_images[scores > 0.5]
96
-
97
  if len(mask_images) == 0:
98
  return []
99
 
100
- # Merge the masks into one mask.
101
- mask_image = np.sum(mask_images, axis=0)
102
 
103
  return get_bbox(mask_image.astype(np.uint8))
104
 
 
84
  # Inference the tables in the image.
85
  result = inference_detector(table_det, image_input)
86
 
 
 
 
87
  # Get the masks of the tables.
88
  mask_images = result.pred_instances.masks.cpu().numpy()
89
  scores = result.pred_instances.scores.cpu().numpy()
90
 
91
+ # If there are no tables, return an empty list.
 
 
92
  if len(mask_images) == 0:
93
  return []
94
 
95
+ # Get mask with highest score
96
+ mask_image = mask_images[scores.argmax()]
97
 
98
  return get_bbox(mask_image.astype(np.uint8))
99
 
model/table-det/model.pth CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:ff4f4b8809fb9c886e96cc539cae6517fbdc289406d8b3649918d3fa497c6286
3
- size 352081121
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5e04ce5891ea3c2675b2b4b35268663b85f8a732c43844d912209c68cc4903d3
3
+ size 351141001