Skip to content

Commit

Permalink
Use np.isclose in check_bbox (#958)
Browse files Browse the repository at this point in the history
* Use np.isclose in check_bbox

* Version bump
  • Loading branch information
Dipet authored Jul 15, 2021
1 parent 904957d commit 929cbd8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion albumentations/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from __future__ import absolute_import

__version__ = "1.0.2"
__version__ = "1.0.3"

from .core.composition import *
from .core.transforms_interface import *
Expand Down
2 changes: 1 addition & 1 deletion albumentations/augmentations/bbox_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ def convert_bboxes_from_albumentations(bboxes, target_format, rows, cols, check_
def check_bbox(bbox):
"""Check if bbox boundaries are in range 0, 1 and minimums are lesser then maximums"""
for name, value in zip(["x_min", "y_min", "x_max", "y_max"], bbox[:4]):
if not 0 <= value <= 1:
if not 0 <= value <= 1 and not np.isclose(value, 0) and not np.isclose(value, 1):
raise ValueError(
"Expected {name} for bbox {bbox} "
"to be in the range [0.0, 1.0], got {value}.".format(bbox=bbox, name=name, value=value)
Expand Down

0 comments on commit 929cbd8

Please sign in to comment.