-
Notifications
You must be signed in to change notification settings - Fork 755
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
support Chinese for kie show result #464
Conversation
mmocr/core/visualize.py
Outdated
font_size = int(new_box[3][1] - new_box[0][1]) | ||
dirname, _ = os.path.split(os.path.abspath(__file__)) | ||
font_path = os.path.join(dirname, 'font.TTF') | ||
if not os.path.exists(font_path): | ||
url = ('http://download.openmmlab.com/mmocr/data/font.TTF') | ||
print(f'Downloading {url} ...') | ||
local_filename, _ = urllib.request.urlretrieve(url) | ||
shutil.move(local_filename, font_path) | ||
fnt = ImageFont.truetype(font_path, font_size) | ||
pred_draw.text((x_min * 2, y_min), text, font=fnt, fill=(0, 0, 255)) | ||
del pred_draw |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not use draw_texts_by_pil()
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
draw_texts_by_pil
will draw text on a new empty image (then return) but not the original image. Here we need draw the text on pred_img
directly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about adding an in_place
option to draw_texts_by_pil
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cannot done in_place since it need to convert numpy array
to PIL Image
and then PIL Image
to numpy array
Codecov Report
@@ Coverage Diff @@
## main #464 +/- ##
==========================================
- Coverage 85.72% 85.72% -0.01%
==========================================
Files 142 142
Lines 9516 9532 +16
Branches 1360 1365 +5
==========================================
+ Hits 8158 8171 +13
- Misses 1045 1046 +1
- Partials 313 315 +2
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
* support Chinese for kie show result * update visualize * add arg for draw_texts * update font_size
* support Chinese for kie show result * update visualize * add arg for draw_texts * update font_size
No description provided.