This article describes how to run the Handwritten Japanese Text Recognition demo found in the Intel® Distribution of OpenVINO™ toolkit.
Familiarity with GNU Linux* commands
UP* Xtreme*: i7-8665UE 1.70GHz 4 Core
System, software and more
|Distro||Ubuntu 18.04.3 LTS Bionic Beaver|
Linux* kernel 5.0.0-1
Intel® Distribution of OpenVINO™ toolkit
What is the Kondate Nakayosi Character List?
The Kondate Nakayosi character list includes 4441 characters. This list can be used to check against any characters you may want to use in your testing or demo. This list is included with the demo as a txt file.
Run the Original Demo
The demo uses handwritten input and when inference is run, the results of the input are displayed. For the purposes of this demo, the Up Xtreme
This section includes details for the following steps:
- Download the model
- Initialize the environment
- Change directory
- Run demo
- Validate with the displayed results
Step 1: Download the model
There are several ways to download the model. A model downloader script, downloader.py is included with the toolkit in the deployment_tools/tools directory in the model_downloader directory. For more information about downloading models using the model downloader, visit Model Downloader and other automation tools.
In /opt/intel/openvino/deployment_tools/tools/model_downloader, use the following command to download the handwritten japanese text models:
downloader.py --name handwritten*
A sample of the path to the downloaded model is found below.
The original demo is found in the python_demos directory.
The directory tree below lists the contents of the directory.
│ ├── kondate_nakayosi_char_list.txt
│ └── test.png
3 directories, 10 files
The original handwritten image file is named: test.png
Step 2: Initialize environment
Manually initialize the environment quickly by running the following command. Alternately, type "source" rather than use the replacement "." for source when initializing the environment.
Use the same terminal to run the demo.
Step 3: Change directory
To run the python script, move to the handwritten_japanese_recognition_demo directory.
Step 4: Run demo
Run the python script, handwritten_japanese_recognition_demo.py at the command line. Add the input (-i) image and model (-m) with path to the model in the command.
python3 handwritten_japanese_recognition_demo.py -i data/test.png -m /opt/intel/openvino/deployment_tools/tools/model_downloader/intel/handwritten-japanese-recognition-0001/FP16/handwritten-japanese-recognition-0001.xml
Troubleshooting Tip: If the notification "import cv2 ModuleNotFoundError:init No module named 'cv2' diplays, initialize the environment in the current terminal.
Step 5: Validate with the displayed results
Next Up: Modify the demo
Modify the Demo
In this example, the text used was not handwritten but a typed character is used.
Step 1: Select Text
Selected character to test text recognition is found below.
薫 kanji for kaoru
Step 2: Replace test.png file with an image of the selected character(s)
Replace the current test.png with this image or change the name and use this in the command in place of test.png
When inference is run, this character will display as the result.
The character was included in the kondate akayoshi character list (kondate_nakayosi_char_list.txt).
Next Steps: Handwritten
For the next steps, try other characters. Replace the input image and run the python script.
Remember, the characters are included in the kondate_nakayosi_char_list.txt file.
# In /opt/intel/openvino/deployment_tools/tools/model_downloader, use the following command to download the handwritten japanese text models # download the model downloader.py --name handwritten* # location of the demo /opt/intel/openvino/deployment_tools/inference_engine/demos/python_demos/handwritten_japanese_recognition_demo # initialize environment if not already . /opt/intel/openvino/bin/setupvars.sh # The original demo is found in the python_demos directory. cd /opt/intel/openvino/inference_engine/demos/python_demos/handwritten_japanese_recognition_demo # run the demo # -i input, -m model python3 handwritten_japanese_recognition_demo.py -i data/test.png -m /opt/intel/openvino/deployment_tools/tools/model_downloader/intel/handwritten-japanese-recognition-0001/FP16/handwritten-japanese-recognition-0001.xml
About the author:
marcia kaoru wilburは、GNU Linux +フリーソフトウェアのDebian開発者およびベテランです。彼女の母親、マサヨウィルバーは日本人で、ソルトレイクシティの系図センターの引退した翻訳者です。
Product and Performance Information
Performance varies by use, configuration and other factors. Learn more at www.Intel.com/PerformanceIndex.