산업용어플리케이션을위한딥러닝기반머신비전 솔루션 · machine vision visual...

52
산업용 어플리케이션을 위한 딥러닝 기반 머신비전 솔루션 송완빈, MathWorks

Upload: others

Post on 09-Sep-2020

5 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: 산업용어플리케이션을위한딥러닝기반머신비전 솔루션 · Machine Vision Visual Inspection Automated Inspection Automated Defect Detection. ... Model design and

산업용어플리케이션을위한딥러닝기반머신비전솔루션

송완빈, MathWorks

Page 2: 산업용어플리케이션을위한딥러닝기반머신비전 솔루션 · Machine Vision Visual Inspection Automated Inspection Automated Defect Detection. ... Model design and

What is Automated Optical Inspection?

“ Automated optical inspection is the image-based or visual

inspection of manufacturing parts where a camera scans

the device under test for both failures and quality defects"

1

Machine Vision Visual Inspection

Automated Inspection

Automated Defect Detection

Page 3: 산업용어플리케이션을위한딥러닝기반머신비전 솔루션 · Machine Vision Visual Inspection Automated Inspection Automated Defect Detection. ... Model design and

Automatic Defect Detection

Defect Detection in Railway Components

Visual Inspection of Automotive Parts

Pipe

Assess Pipe Weld Damage at Power Plants

Customer References

2

Page 4: 산업용어플리케이션을위한딥러닝기반머신비전 솔루션 · Machine Vision Visual Inspection Automated Inspection Automated Defect Detection. ... Model design and

3

Page 5: 산업용어플리케이션을위한딥러닝기반머신비전 솔루션 · Machine Vision Visual Inspection Automated Inspection Automated Defect Detection. ... Model design and

Can you find the defective hex nut?

4

Page 6: 산업용어플리케이션을위한딥러닝기반머신비전 솔루션 · Machine Vision Visual Inspection Automated Inspection Automated Defect Detection. ... Model design and

5

Page 7: 산업용어플리케이션을위한딥러닝기반머신비전 솔루션 · Machine Vision Visual Inspection Automated Inspection Automated Defect Detection. ... Model design and

6

Page 8: 산업용어플리케이션을위한딥러닝기반머신비전 솔루션 · Machine Vision Visual Inspection Automated Inspection Automated Defect Detection. ... Model design and

7

Page 9: 산업용어플리케이션을위한딥러닝기반머신비전 솔루션 · Machine Vision Visual Inspection Automated Inspection Automated Defect Detection. ... Model design and

Finding Defective Hex Nuts

8

Page 10: 산업용어플리케이션을위한딥러닝기반머신비전 솔루션 · Machine Vision Visual Inspection Automated Inspection Automated Defect Detection. ... Model design and

Detecting Parts

9

Page 11: 산업용어플리케이션을위한딥러닝기반머신비전 솔루션 · Machine Vision Visual Inspection Automated Inspection Automated Defect Detection. ... Model design and

10

Defect Detection Workflow

Ground truth labeling

DATA PREPARATION

Data access and preprocessing

Simulation-based data generation

I Iteration and Refinement

AI MODELING

Model exchange across frameworks

Model design andtuning

Hardware-accelerated training

DEPLOYMENT

Edge, cloud, desktop

Enterprise Systems

Embedded Devices

Ground truth labeling

10

Page 12: 산업용어플리케이션을위한딥러닝기반머신비전 솔루션 · Machine Vision Visual Inspection Automated Inspection Automated Defect Detection. ... Model design and

11

Defect Detection Workflow

Ground truth labeling

DATA PREPARATION

Data access and preprocessing

Simulation-based data generation

I Iteration and Refinement

AI MODELING

Model exchange across frameworks

Model design andtuning

Hardware-accelerated training

DEPLOYMENT

Edge, cloud, desktop

Enterprise Systems

Embedded Devices

Ground truth labeling

11

Page 13: 산업용어플리케이션을위한딥러닝기반머신비전 솔루션 · Machine Vision Visual Inspection Automated Inspection Automated Defect Detection. ... Model design and

Data Access and Preprocessing – Common Challenges

12

How do I access large data that might not fit in memory?

How do I preprocess data and get the right features?

How do I label my data faster?

What if I have an imbalanced dataset or don’t have enough data?

Page 14: 산업용어플리케이션을위한딥러닝기반머신비전 솔루션 · Machine Vision Visual Inspection Automated Inspection Automated Defect Detection. ... Model design and

Data Access and Preprocessing – Common Challenges

How do I access large data that might not fit in memory?

13

Page 15: 산업용어플리케이션을위한딥러닝기반머신비전 솔루션 · Machine Vision Visual Inspection Automated Inspection Automated Defect Detection. ... Model design and

How do I load and access large amounts of data?

Loads image/signal data

into memory as and

when needed

Work with out-of-

memory numeric data

– Train deep neural

networks for

numeric arrays

>> imageDatastore

>> audioDatastore

>> fileDatastore

Custom Datastores also

available

Datastores Tall Arrays

Work with very large, tiled and

multi-resolution images

BigImage

Each red box is a 1024-by-1024 tile in the file.L1's dimensions = 29,600 x 46,000L2's dimensions = 14,800 x 23,000L3's dimensions = 7,500 x 12,000Rows = 29600Columns = 46000TileSizeIntrinsic = [1024 1024]ResolutionLevelSizes = [29600 46000

14800 230007500

12000]CoarsestLevel = 3FinestLevel = 1PixelSpacings = [1 1; 2 2; 3.947 3.833]

14

Page 16: 산업용어플리케이션을위한딥러닝기반머신비전 솔루션 · Machine Vision Visual Inspection Automated Inspection Automated Defect Detection. ... Model design and

Data Access and Preprocessing – Common Challenges

15

How do I preprocess data and get the right features?

Page 17: 산업용어플리케이션을위한딥러닝기반머신비전 솔루션 · Machine Vision Visual Inspection Automated Inspection Automated Defect Detection. ... Model design and

Pre-processing Data – Registration Estimator App

16

Page 18: 산업용어플리케이션을위한딥러닝기반머신비전 솔루션 · Machine Vision Visual Inspection Automated Inspection Automated Defect Detection. ... Model design and

Pre-processing Data – Image Segmenter App

17

Page 19: 산업용어플리케이션을위한딥러닝기반머신비전 솔루션 · Machine Vision Visual Inspection Automated Inspection Automated Defect Detection. ... Model design and

Preprocessing Data - Apps

18

Color Thresholder Image Region Analyzer

Page 20: 산업용어플리케이션을위한딥러닝기반머신비전 솔루션 · Machine Vision Visual Inspection Automated Inspection Automated Defect Detection. ... Model design and

Pre-processing Data – Built-in Algorithms

imgaborfilt fibermetricimadjust

19

And Many More!

Page 21: 산업용어플리케이션을위한딥러닝기반머신비전 솔루션 · Machine Vision Visual Inspection Automated Inspection Automated Defect Detection. ... Model design and

Without Preprocessing With Preprocessing

20

Defect detection using AlexNet: Results with preprocessing

Page 22: 산업용어플리케이션을위한딥러닝기반머신비전 솔루션 · Machine Vision Visual Inspection Automated Inspection Automated Defect Detection. ... Model design and

Data Access and Preprocessing – Common Challenges

21

How do I label my data faster?

Page 23: 산업용어플리케이션을위한딥러닝기반머신비전 솔루션 · Machine Vision Visual Inspection Automated Inspection Automated Defect Detection. ... Model design and

Data Preprocessing - Labeling

22

Page 24: 산업용어플리케이션을위한딥러닝기반머신비전 솔루션 · Machine Vision Visual Inspection Automated Inspection Automated Defect Detection. ... Model design and

Image Labeler

23

Image

Labeler

Video

Labeler

Big-Image

Labeler

Page 25: 산업용어플리케이션을위한딥러닝기반머신비전 솔루션 · Machine Vision Visual Inspection Automated Inspection Automated Defect Detection. ... Model design and

Video Labeler

Image

Labeler

Video

Labeler

24

Big-Image

Labeler

Page 26: 산업용어플리케이션을위한딥러닝기반머신비전 솔루션 · Machine Vision Visual Inspection Automated Inspection Automated Defect Detection. ... Model design and

Big Image Labeler

25

Image

Labeler

Video

Labeler

Big-Image

Labeler

Page 27: 산업용어플리케이션을위한딥러닝기반머신비전 솔루션 · Machine Vision Visual Inspection Automated Inspection Automated Defect Detection. ... Model design and

Data Access and Preprocessing – Common Challenges

What if I have an imbalanced dataset or don’t have enough data?

26

Page 28: 산업용어플리케이션을위한딥러닝기반머신비전 솔루션 · Machine Vision Visual Inspection Automated Inspection Automated Defect Detection. ... Model design and

Contrast Jitter on Grayscale

Data Augmentation by Transformation

Original

Dataset

Augmented

Dataset

N times as

much data

27

Page 29: 산업용어플리케이션을위한딥러닝기반머신비전 솔루션 · Machine Vision Visual Inspection Automated Inspection Automated Defect Detection. ... Model design and

Data Augmentation : Generative Adversarial Networks (GANs)

Generative Adversarial Networks

28

Page 30: 산업용어플리케이션을위한딥러닝기반머신비전 솔루션 · Machine Vision Visual Inspection Automated Inspection Automated Defect Detection. ... Model design and

29

Defect Detection Workflow

Ground truth labeling

DATA PREPARATION

Data access and preprocessing

Simulation-based data generation

I Iteration and Refinement

AI MODELING

Model exchange across frameworks

Model design andtuning

Hardware-accelerated training

DEPLOYMENT

Edge, cloud, desktop

Enterprise Systems

Embedded Devices

Ground truth labeling

29

Page 31: 산업용어플리케이션을위한딥러닝기반머신비전 솔루션 · Machine Vision Visual Inspection Automated Inspection Automated Defect Detection. ... Model design and

Deep Learning for Defect Detection

30

Deep learning for Classification

Deep Learning for Object Detection

Page 32: 산업용어플리케이션을위한딥러닝기반머신비전 솔루션 · Machine Vision Visual Inspection Automated Inspection Automated Defect Detection. ... Model design and

Deep Learning for Defect Detection – Multiple techniques

31

Deep learning for Classification

Page 33: 산업용어플리케이션을위한딥러닝기반머신비전 솔루션 · Machine Vision Visual Inspection Automated Inspection Automated Defect Detection. ... Model design and

Two Approaches for Deep Learning

2. Fine-tune a pre-trained model (transfer learning)

1. Train a deep neural network from scratch

32

Page 34: 산업용어플리케이션을위한딥러닝기반머신비전 솔루션 · Machine Vision Visual Inspection Automated Inspection Automated Defect Detection. ... Model design and

Train a Deep Neural Network from Scratch

33

Page 35: 산업용어플리케이션을위한딥러닝기반머신비전 솔루션 · Machine Vision Visual Inspection Automated Inspection Automated Defect Detection. ... Model design and

Convolution +

ReLu PoolingInput

Convolution +

ReLu Pooling

Feature Learning

Fully

ConnectedSoftmax

cartruck

bicycle

van

… …

Classification

Two approaches for Deep learning

Fully

Connected Softmaxfood

tree…

New Classification

Approach 2. Fine-tune a pre-trained model (Transfer learning)

34

Page 36: 산업용어플리케이션을위한딥러닝기반머신비전 솔루션 · Machine Vision Visual Inspection Automated Inspection Automated Defect Detection. ... Model design and

Fine-tune a Pre-trained Model (Transfer Learning)

35

Page 37: 산업용어플리케이션을위한딥러닝기반머신비전 솔루션 · Machine Vision Visual Inspection Automated Inspection Automated Defect Detection. ... Model design and

Experiment Manager

36

Page 38: 산업용어플리케이션을위한딥러닝기반머신비전 솔루션 · Machine Vision Visual Inspection Automated Inspection Automated Defect Detection. ... Model design and

Classification with Trained MobileNetV2

37

Why the defect nuts are classified as ‘Bad’?

Page 39: 산업용어플리케이션을위한딥러닝기반머신비전 솔루션 · Machine Vision Visual Inspection Automated Inspection Automated Defect Detection. ... Model design and

Challenges with Deep Learning Models

▪ Deep Learning model is a black box model

Car

Truck

Bicycle

▪ Is it possible to classify an unknown image correctly?

▪ Why the model misclassify for certain images?

• Class Activation Mapping(CAM)• Grad-CAM

Explainable AI

is required

Page 40: 산업용어플리케이션을위한딥러닝기반머신비전 솔루션 · Machine Vision Visual Inspection Automated Inspection Automated Defect Detection. ... Model design and

Classified as “keyboard” due to

the presence of the mouse

Incorrectly classified “coffee

mug” as “buckle” due to the

watch

39

Class Activation Mapping to Investigate Network Predictions

Attribution Reveals the Why Behind Deep Learning Decisions Full code available

Page 41: 산업용어플리케이션을위한딥러닝기반머신비전 솔루션 · Machine Vision Visual Inspection Automated Inspection Automated Defect Detection. ... Model design and

Visualization of Features with CAM

OK → Reacts to whole surface

Bad→ Reacts to the scratch

Captured Image Classification and CAM

40

The network judges the unit as Bad by seeing the scratched area

Page 42: 산업용어플리케이션을위한딥러닝기반머신비전 솔루션 · Machine Vision Visual Inspection Automated Inspection Automated Defect Detection. ... Model design and

Deep Learning for Defect Detection

41

Deep Learning for Object Detection

Page 43: 산업용어플리케이션을위한딥러닝기반머신비전 솔루션 · Machine Vision Visual Inspection Automated Inspection Automated Defect Detection. ... Model design and

Object Detection in Image/Vision System

▪ Object detection

– Computer technology related to computer vision and image processing that deals with detecting

instances of semantic objects of a certain class (such as humans, buildings, or cars) in digital

images and videos

Object

Detection

Page 44: 산업용어플리케이션을위한딥러닝기반머신비전 솔루션 · Machine Vision Visual Inspection Automated Inspection Automated Defect Detection. ... Model design and

Increase productivity using built-in functions for design and analysis

Use MATLAB high-level API for changing network type, backbone network for better

performance easily.

Model design and

tuning

Hardware

accelerated training

Interoperability

AI Modeling

Page 46: 산업용어플리케이션을위한딥러닝기반머신비전 솔루션 · Machine Vision Visual Inspection Automated Inspection Automated Defect Detection. ... Model design and

Defect Detection Workflow

Ground truth labeling

DATA PREPARATION

Data access and preprocessing

Simulation-based data generation

I Iteration and Refinement

AI MODELING

Model exchange across frameworks

Model design andtuning

Hardware-accelerated training

DEPLOYMENT

Edge, cloud, desktop

Enterprise Systems

Embedded Devices

Ground truth labeling

45

Page 47: 산업용어플리케이션을위한딥러닝기반머신비전 솔루션 · Machine Vision Visual Inspection Automated Inspection Automated Defect Detection. ... Model design and

Deploy to Any Processor with Best-in-class Performance

FPGA

CPU

GPUCode

Generation

46

Page 48: 산업용어플리케이션을위한딥러닝기반머신비전 솔루션 · Machine Vision Visual Inspection Automated Inspection Automated Defect Detection. ... Model design and

Deploy defect detection algorithms from

MATLAB to Jetson AGX XavierDeploy defect detection algorithms from

MATLAB to ZCU102 board from Xilinx

Deploy to Hardware

47

Page 49: 산업용어플리케이션을위한딥러닝기반머신비전 솔루션 · Machine Vision Visual Inspection Automated Inspection Automated Defect Detection. ... Model design and

Deploy to Hardware

Additional Resources

▪ Deploying Deep Neural Networks to GPUs and

CPUs Using MATLAB Coder and GPU Coder

▪ Using GPU Coder to Prototype and Deploy on

NVIDIA Drive, Jetson

▪ Real-Time Object Detection with YOLO v2 Using

GPU Coder

▪ Image Classification on ARM CPU: SqueezeNet

on Raspberry Pi

▪ Deep Learning on an Intel Processor with MKL-

DNNDefect detection deployed on

ARM Cortex-A microprocessor

48

Page 50: 산업용어플리케이션을위한딥러닝기반머신비전 솔루션 · Machine Vision Visual Inspection Automated Inspection Automated Defect Detection. ... Model design and

Defect Detection Workflow

Ground truth labeling

DATA PREPARATION

Data access and preprocessing

Simulation-based data generation

I Iteration and Refinement

AI MODELING

Model exchange across frameworks

Model design andtuning

Hardware-accelerated training

DEPLOYMENT

Edge, cloud, desktop

Enterprise Systems

Embedded Devices

Ground truth labeling

49

Page 51: 산업용어플리케이션을위한딥러닝기반머신비전 솔루션 · Machine Vision Visual Inspection Automated Inspection Automated Defect Detection. ... Model design and

Key Takeaways

▪ Interactive and easy to use apps help explore, iterate and automate

workflows

▪ Flexibility and options to choose networks and optimizations based on

data and requirements

▪ MATLAB provides an easy and extensible framework for defect

detection from data access to deployment

Page 52: 산업용어플리케이션을위한딥러닝기반머신비전 솔루션 · Machine Vision Visual Inspection Automated Inspection Automated Defect Detection. ... Model design and

Thank You