目的
Kerasのドキュメントで公開されているimage ocrの実行をWindowsでできるようにする
環境
os: windows 10
rpu: rtx 1080 ti
python: 3.6
公開されたimage ocrとは
直接公開されているのはソースコードで、論文も掲載されている。
https://keras.io/examples/image_ocr/
・An End-to-End Trainable Neural Network for Image-based Sequence Recognition and Its Application to Scene Text Recognition
https://arxiv.org/pdf/1507.05717.pdf
参考にしたページ
https://stackoverflow.com/questions/44847446/how-can-i-use-the-keras-ocr-example
windowsでcairocffiをインストールする必要があるらしい
止まったエラー箇所
OSError: dlopen() failed to load a library: cairo / cairo-2 / cairo-gobject-2 / cairo.so.2
cairoが必要だけど、そのためには「GTK+-2」と「GTK+-3」が必要なのでダウンロードする
WeasyPrintのインストールができると上のエラー箇所がなくなるので、このページに従ってインストールしていく
https://weasyprint.readthedocs.io/en/latest/install.html#linux
https://weasyprint.readthedocs.io/en/latest/install.html#msys2-gtk
https://github.com/tschoonj/GTK-for-Windows-Runtime-Environment-Installer
GTX+-2はcドライブ直下、GTK+-3はC:/Program Files/GTK3-Runtime Win64にある。
なぜか、GTX+-2のbin直下にはものがなかったけども、コードの方は実行できたので良しとする。
これで実行ができた
検討したこと
windowsの環境にubuntuを入れたりできる、Windows Subsystem for Linux (WSL)なるものがあった。
実際にインストールしてapt getで入れてみたけど、osの共有?のようなものができなくてGTKが認識されなかったので、別のホスト環境ができたようだった。
すぐにやめてWeasyPrintのインストールに注力した。