From 54dd7b58ca71ec220338634ce72b5b065f5be9ee Mon Sep 17 00:00:00 2001 From: felix Date: Fri, 13 Oct 2023 15:34:23 +0200 Subject: [PATCH] round angle to int --- doctr/models/_utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doctr/models/_utils.py b/doctr/models/_utils.py index 81c3fc6c1c..d37679ac9d 100644 --- a/doctr/models/_utils.py +++ b/doctr/models/_utils.py @@ -26,7 +26,7 @@ def get_max_width_length_ratio(contour: np.ndarray) -> float: return max(w / h, h / w) -def estimate_orientation(img: np.ndarray, n_ct: int = 50, ratio_threshold_for_lines: float = 5) -> float: +def estimate_orientation(img: np.ndarray, n_ct: int = 50, ratio_threshold_for_lines: float = 5) -> int: """Estimate the angle of the general document orientation based on the lines of the document and the assumption that they should be horizontal. @@ -72,7 +72,7 @@ def estimate_orientation(img: np.ndarray, n_ct: int = 50, ratio_threshold_for_li return 0 # in case no angles is found else: median = -median_low(angles) - return median if abs(median) != 0 else 0 + return round(median) if abs(median) != 0 else 0 def rectify_crops(