fix #101: fix assertion (#103)

* fix #101: fix assertion

* fix #101: fix pytest
This commit is contained in:
Jianyong Chen 2021-04-20 04:09:09 -05:00 committed by GitHub
parent 6c1c34fb91
commit 0bfda842c9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -188,6 +188,7 @@ class TextSnakeTargets(BaseTextDetTargets):
assert line.shape[0] >= 2
assert line.shape[1] == 2
assert isinstance(n, int)
assert n > 0
length_list = [
norm(line[i + 1] - line[i]) for i in range(len(line) - 1)
@ -234,8 +235,8 @@ class TextSnakeTargets(BaseTextDetTargets):
resampled_line2 (ndarray): The resampled line 2.
"""
assert sideline1.ndim == sideline1.ndim == 2
assert sideline1.shape[1] == sideline1.shape[1] == 2
assert sideline1.ndim == sideline2.ndim == 2
assert sideline1.shape[1] == sideline2.shape[1] == 2
assert sideline1.shape[0] >= 2
assert sideline2.shape[0] >= 2
assert isinstance(resample_step, float)
@ -250,7 +251,7 @@ class TextSnakeTargets(BaseTextDetTargets):
])
total_length = (length1 + length2) / 2
resample_point_num = int(float(total_length) / resample_step)
resample_point_num = max(int(float(total_length) / resample_step), 1)
resampled_line1 = self.resample_line(sideline1, resample_point_num)
resampled_line2 = self.resample_line(sideline2, resample_point_num)