日本語手書き文字の認識

OpenVINO Version2020.2では、日本語の手書き文字認識がデモで格納されています
早速試してみましょう!

格納されているフォルダは、

/opt/intel/openvino/deployment_tools/open_model_zoo/demos/python_demos/handwritten_japanese_recognition_demo 

次にモデルのダウンロードを行います

 python3 /opt/intel/openvino/deployment_tools/open_model_zoo/tools/downloader/downloader.py --list models.lst -o ~/model_2020.2 

ここまでの作業でほぼ完了です

次に手書き文字を用意しましょう

最初は灰色の紙に適当に走り書きをしたものを切り抜いただけの画像データで試してみました
下記のコマンドで実行してみます

 python3 handwritten_japanese_recognition_demo.py -m ~/model_2020.2/intel/handwritten-japanese-recognition-0001/FP16/handwritten-japanese-recognition-0001.xml -i ~/handwritting_crop.jpg 

実行結果
[ INFO ] Preparing input/output blobs
[ INFO ] Loading model to the plugin
[ INFO ] Starting inference (1 iterations)
['手書き字']
[ INFO ] Average throughput: 320.4326629638672 ms

惜しいですね
恐らく背景と文字の分離は前処理としてやらないといけないのかもしれないので、下記のような白黒データで入れてみることにしました

/opt/intel/openvino/deployment_tools/open_model_zoo/demos/python_demos/handwritten_japanese_recognition_demo$ python3 handwritten_japanese_recognition_demo.py -m ~/model_2020.2/intel/handwritten-japanese-recognition-0001/FP16/handwritten-japanese-recognition-0001.xml -i ~/handwritting_crop_bin.jpg

実行結果
[ INFO ] Preparing input/output blobs
[ INFO ] Loading model to the plugin
[ INFO ] Starting inference (1 iterations)
['手書き文字']
[ INFO ] Average throughput: 320.8739757537842 ms

お見事です!ちゃんと認識できました
Jpegの汚いデータで右上がりの手書き文字を認識しています

試しに罫線入りのデータを入れてみました

このデータの場合、[‘書き浜字認識’]と解釈されるようです
やはり背景処理を前処理として考えてあげないといけないですね