LoginSignup
21
22

More than 5 years have passed since last update.

RaspberryPi3にカメラモジュールつけて撮影した画像をDeepLearningで分類してみた

Last updated at Posted at 2016-07-16

開発環境

・RaspberryPi3
・Raspberry Pi ハイビジョン ビデオカメラ モジュール HD Video Camera Module
・Raspbian(Debian version 8.0)

Raspberrypiでカメラを有効化

まずはカメラモジュールをカメラコネクタに差し込む

image

初期設定では、カメラが有効になっていないので、設定で有効にする。
$ sudo raspi-config
として、「5 Enable Camera」を選択。
メニュー画面で「Finished」を選択し、ラズパイを再起動する。

下記コマンドでカメラが有効になっていることを確認。

$ vcgencmd get_camera
supported=1 detected=1

DeepLearning用ライブラリ「DeepBeliefSDK」の導入

$ git clone https://github.com/jetpacapp/DeepBeliefSDK.git
$ sudo apt-get install -y mercurial
$ hg clone https://bitbucket.org/eigen/eigen
$ cd DeepBeliefSDK
$ ln -s ../eigen
$ cd source
$ make clean
$ sudo apt-get install gcc-4.8 g++-4.8
$ make GEMM=eigen TARGET=pi2 CC=gcc-4.8 CXX=g++-4.8
$ sudo cp libjpcnn.so /usr/lib
$ sudo ldconfig

写真撮影〜画像分類実行

コーヒーカップを300x300のサイズで撮影してみる
$ raspistill -w 300 -h 300 -o raspistill -o camera1.png

camera5.png

撮影した画像の分類を実行

$ ./jpcnn -i camera1.png -n ../networks/jetpac.ntwk -t -m s -d

結果は・・・

************************
0.011523    pitcher
0.011059    measuring cup
0.162259    cup
0.024144    coffeepot
0.640897    coffee mug
0.040280    beaker
0.013066    espresso
0.013102    espresso maker
Classification took 1782 milliseconds

なかなか良好かと

21
22
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
21
22