
画像識別システム作りました!
最近、ちゅらさんでおなじみのゴーヤーマンと愛・地球博でおなじみのモリゾーを識別するシステムをPythonで作ってみました!
ゴーヤーマンとモリゾーはどちらも緑のキャラクターで少し似てるので、この似てるキャラクターを識別させたいなと思っていました!
まずはIDLEというエディターでシステムを作ってみましたが、使用するモジュールのバージョンの関係等で上手く動かす事ができなったので、次はコードを変えて開発環境もGoogle Colaboratoryに変えました。



コードはこんな感じでして、goyamanというディレクトリにゴーヤーマンのいくつかの画像を入れ、morizoというディレクトリにモリゾーのいくつかの画像を入れてゴーヤーマンとモリゾーの画像を学習させ、識別させたい画像をアップロードして予測させ、その画像がゴーヤーマンなのかモリゾーなのかを識別させます。


学習させるゴーヤーマンの画像はこんな感じです。


学習させるモリゾーの画像はこんな感じです。


まずはgt.jpgという画像を予測させてみると、ゴーヤーマンという結果が出ました!


次にmt.jpgという画像を予測させてみると、モリゾーという結果が出ました!
本当は学習データをもっと用意する方が良いのですが、学習データが少なくてもしっかり識別できるのは凄いですよね!