ragavsachdeva commited on
Commit
60704d4
1 Parent(s): 25b2461

Update utils.py

Browse files
Files changed (1) hide show
  1. utils.py +5 -1
utils.py CHANGED
@@ -90,7 +90,11 @@ class UnionFind:
90
  return labels
91
 
92
  def visualise_single_image_prediction(image_as_np_array, predictions, filename):
93
- figure, subplot = plt.subplots(1, 1, figsize=(10, 10))
 
 
 
 
94
  subplot.imshow(image_as_np_array)
95
  plot_bboxes(subplot, predictions["panels"], color="green")
96
  plot_bboxes(subplot, predictions["texts"], color="red", add_index=True)
 
90
  return labels
91
 
92
  def visualise_single_image_prediction(image_as_np_array, predictions, filename):
93
+ h, w = image_as_np_array.shape[:2]
94
+ if h > w:
95
+ figure, subplot = plt.subplots(1, 1, figsize=(10, 10 * h / w))
96
+ else:
97
+ figure, subplot = plt.subplots(1, 1, figsize=(10 * w / h, 10))
98
  subplot.imshow(image_as_np_array)
99
  plot_bboxes(subplot, predictions["panels"], color="green")
100
  plot_bboxes(subplot, predictions["texts"], color="red", add_index=True)