Skip to content

Commit

Permalink
[Bug fix]compute_overlaps_masks
Browse files Browse the repository at this point in the history
In compute_overlaps_masks(), the code checking the shape of masks1 and masks2 is not correct.
1. It should check masks' last dimension instead of first dimension to determine whether it's empty or not
2. When masks1 or masks2 is empty, it should return a zero array of shape (masks1.shape[-1], masks2.shape[-1])
  • Loading branch information
keineahnung2345 authored and waleedka committed Oct 27, 2018
1 parent 8a09a75 commit 4c08252
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions mrcnn/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@ def compute_overlaps_masks(masks1, masks2):
"""

# If either set of masks is empty return empty result
if masks1.shape[0] == 0 or masks2.shape[0] == 0:
return np.zeros((masks1.shape[0], masks2.shape[-1]))
if masks1.shape[-1] == 0 or masks2.shape[-1] == 0:
return np.zeros((masks1.shape[-1], masks2.shape[-1]))
# flatten masks and compute their areas
masks1 = np.reshape(masks1 > .5, (-1, masks1.shape[-1])).astype(np.float32)
masks2 = np.reshape(masks2 > .5, (-1, masks2.shape[-1])).astype(np.float32)
Expand Down

0 comments on commit 4c08252

Please sign in to comment.