Skip to content

Commit

Permalink
Merge pull request #8 from LDOUBLEV/fixocr
Browse files Browse the repository at this point in the history
update det process code, +32 -> -32
  • Loading branch information
dyning authored May 13, 2020
2 parents 5022503 + 2a298fa commit c01e326
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
8 changes: 6 additions & 2 deletions ppocr/data/det/db_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,12 +143,16 @@ def resize_image_type0(self, im):
resize_w = int(resize_w * ratio)
if resize_h % 32 == 0:
resize_h = resize_h
elif resize_h // 32 <= 1:
resize_h = 32
else:
resize_h = (resize_h // 32 + 1) * 32
resize_h = (resize_h // 32 - 1) * 32
if resize_w % 32 == 0:
resize_w = resize_w
elif resize_w // 32 <= 1:
resize_w = 32
else:
resize_w = (resize_w // 32 + 1) * 32
resize_w = (resize_w // 32 - 1) * 32
try:
if int(resize_w) <= 0 or int(resize_h) <= 0:
return None, (None, None)
Expand Down
4 changes: 4 additions & 0 deletions ppocr/data/det/east_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -485,10 +485,14 @@ def resize_image(self, im):
resize_w = int(resize_w * ratio)
if resize_h % 32 == 0:
resize_h = resize_h
elif resize_h // 32 <= 1:
resize_h = 32
else:
resize_h = (resize_h // 32 - 1) * 32
if resize_w % 32 == 0:
resize_w = resize_w
elif resize_w // 32 <= 1:
resize_w = 32
else:
resize_w = (resize_w // 32 - 1) * 32
im = cv2.resize(im, (int(resize_w), int(resize_h)))
Expand Down

0 comments on commit c01e326

Please sign in to comment.