Skip to content

Commit

Permalink
fix: Fixed compatibility with FP16
Browse files Browse the repository at this point in the history
  • Loading branch information
fg-mindee committed Nov 10, 2021
1 parent 1af2e73 commit a4de6c4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion doctr/models/detection/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def __call__(

for p_, bitmap_ in zip(proba_map, bitmap):
# Perform opening (erosion + dilatation)
bitmap_ = cv2.morphologyEx(bitmap_, cv2.MORPH_OPEN, kernel)
bitmap_ = cv2.morphologyEx(bitmap_.astype(np.float32), cv2.MORPH_OPEN, kernel)
# Rotate bitmap and proba_map
angle = get_bitmap_angle(bitmap_)
angles_batch.append(angle)
Expand Down
2 changes: 1 addition & 1 deletion doctr/utils/geometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ def rotate_image(

height, width = exp_img.shape[:2]
rot_mat = cv2.getRotationMatrix2D((width / 2, height / 2), angle, 1.0)
rot_img = cv2.warpAffine(exp_img, rot_mat, (width, height))
rot_img = cv2.warpAffine(exp_img.astype(np.float32), rot_mat, (width, height))
if expand:
# Pad to get the same aspect ratio
if (image.shape[0] / image.shape[1]) != (rot_img.shape[0] / rot_img.shape[1]):
Expand Down

0 comments on commit a4de6c4

Please sign in to comment.