-
-
Notifications
You must be signed in to change notification settings - Fork 16k
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
how to change lebels to Korean? #7460
Comments
👋 Hello @AlvinPark09, thank you for your interest in YOLOv5 🚀! Please visit our ⭐️ Tutorials to get started, where you can find quickstart guides for simple tasks like Custom Data Training all the way to advanced concepts like Hyperparameter Evolution. If this is a 🐛 Bug Report, please provide screenshots and minimum viable code to reproduce your issue, otherwise we can not help you. If this is a custom training ❓ Question, please provide as much information as possible, including dataset images, training logs, screenshots, and a public link to online W&B logging if available. For business inquiries or professional support requests please visit https://ultralytics.com or email support@ultralytics.com. RequirementsPython>=3.7.0 with all requirements.txt installed including PyTorch>=1.7. To get started: git clone https://github.com/ultralytics/yolov5 # clone
cd yolov5
pip install -r requirements.txt # install EnvironmentsYOLOv5 may be run in any of the following up-to-date verified environments (with all dependencies including CUDA/CUDNN, Python and PyTorch preinstalled):
StatusIf this badge is green, all YOLOv5 GitHub Actions Continuous Integration (CI) tests are currently passing. CI tests verify correct operation of YOLOv5 training (train.py), validation (val.py), inference (detect.py) and export (export.py) on macOS, Windows, and Ubuntu every 24 hours and on every commit. |
this is a list with Korean that i'm trying to show names = ['쌀밥', 'Multigrain Rice', '콩밥'] which means ['Rice', 'Multigrain Rice', 'Rice with beans'] |
@AlvinPark09 does the Korean print correctly in the terminal window when printing your detections? |
Dear. @glenn-jocher from plot.py, I bolded(** ** marked) where I modified for those who are looking for a solution about same issue
result image is attached for ref. |
@AlvinPark09 thanks for the suggested solution! I used your class name and trained a model and I am able to reproduce your issue. The name prints correctly in the console but does not plot correctly with PIL. So it seems that the Arial.Unicode.ttf font we use for Chinese characters is not working with your Korean characters? This line is supposed to detect special characters with Lines 79 to 80 in d876caa
|
@AlvinPark09 ok I've tracked down the problem. The is_chinese() function is not correctly identifying the characters as non-latin. To reproduce: from utils.general import is_chinese
is_chinese('쌀밥')
False |
* Improved non-latin labels Annotator plotting May resolve #7460 * Update train.py * Update train.py * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * add progress arg Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
@AlvinPark09 good news 😃! Your original issue may now be fixed ✅ in PR #7488. This PR generalizes Annotator to use Unicode fonts when ANY non-latin characters are detected (not just Chinese characters). This also adds a check before training starts to pre-download any required fonts. The resulting training now correctly plots labels for your Korean fonts use-case: To receive this update:
Thank you for spotting this issue and informing us of the problem. Please let us know if this update resolves the issue for you, and feel free to inform us of any other issues you discover or feature requests that come to mind. Happy trainings with YOLOv5 🚀! |
@glenn-jocher thx for your all efforts. |
* Improved non-latin labels Annotator plotting May resolve ultralytics#7460 * Update train.py * Update train.py * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * add progress arg Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* Improved non-latin labels Annotator plotting May resolve ultralytics#7460 * Update train.py * Update train.py * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * add progress arg Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Hello, @glenn-jocher and @AlvinPark09 I was researching to change my Yolov5 label to Japanese and came across this article. When I was changing plots.py as per this article, I got the error How did you set the FONT_PATH? Here is the plots.py I changed
Here is the error text
Also, when I changed the contents of the data.yaml I created to Japanese, the label is not displayed correctly in the Anaconda Prompt and is blank. names: ['ひと', '自転車', 'car']which means['person', 'bicycle', 'car']
Is there any solution to this problem? |
@caramelpop korean and other fonts like arabic, cyrillic are all supported in image annotations using PIL, but not all consoles can print these correctly, so your korean labels should work correctly in YOLOv5 with no changes, but like you've seen may not appear everywhere in console printouts and matplotlib printouts. |
@glenn-jocher Thanks for replying.
Understood. So what should I do about OSError? |
@caramelpop You should be able to use the fonts by specifying the FONT_PATH as the font file's absolute path like FONT_PATH = 'C:\Windows\Fonts\yumin.ttc' using double-backslashes '\' or with forward slashes '/' to reference the font file directly. Also make sure the font file is passed in the correct method signature. As for the data.yaml file, you'll also have to configure your console to display Japanese characters correctly. This can be a bit system-specific, so you may need to look up how to enable Japanese language settings in your specific OS. |
Search before asking
Question
hello there.
I'm new to yolov5 and trying to change labels to Korean.
I also edited names with Korean in data.yaml
but result came out with squares not Korean.
I know it is a problem with fonts but couldn't find where to modify.
thanks
Additional
No response
The text was updated successfully, but these errors were encountered: