File Exchange

image thumbnail

Deep Learning for Defect Detection on Raspberry Pi

version 1.0.1 (8.4 MB) by Kei Otsuka
How to create, train simple network, integrate it into pre/post image processing and generate C code to run it on Raspberry Pi


Updated 09 Oct 2018

View License

This example shows how to create and train a simple convolutional neural network for defect detection, and how to integrate it into pre/post image processing and generate C code for pre-processing, neural network and post processing to run it on Raspberry Pi.
The algorithm is to detect defective hexagon nuts that has scratch on a surface.

This example demonstrates how to:
#1. Load and explore image data.
#2. Define the network architecture
#3. Train the network
#4. Confirm if trained network works well for new data
#5. Walk through whole algorithm that consist of pre-processing, CNN and
#6. Generate C++ code for whole algorithm to test it on host machine
#7. Generate C++ code for ARM target(Raspberry Pi)
#8. Build and run the exe on the Raspberry Pi

Note : Code generation for ARM target is only supported on Linux and Windows.

[Japanese]本プログラムでは、簡単な畳み込みニューラルネットワークの作成と、前処理・後処理との統合、コード生成してRaspberry Pi上で動作させるまでの一連の流れをご紹介します。
今回は六角ナットを使用していますが、表面にキズがあるナットは不良品としており、良品と不良品を分類できるネットワークを作成します。また、ナットが写っている場所をROIとして抽出する部分は前処理として、検出された位置に注釈を挿入する部分は後処理として定義しており、それぞれコード生成して統合し、Raspberry Pi上で動作させます。


画像処理・画像分類・ディープラーニング・DeepLearning・デモ・IPCVデモ・ニューラルネットワーク・Raspberry Pi・ラズパイ

Comments and Ratings (4)

Kei Otsuka

Hi Vivian,
Did you see any error message when you attempted to run this example? It might be helpful to narrow down where the issue is.

vivian wang

Thanks.But I can't run this method.Is there any other code should be loaded? such as, CNN?

Dan Doherty

Pradeep KS



Removed GPU Coder from required products

MATLAB Release Compatibility
Created with R2018b
Compatible with any release
Platform Compatibility
Windows macOS Linux

Discover Live Editor

Create scripts with code, output, and formatted text in a single executable document.

Learn About Live Editor