SMART MANUFACTURING With Apache Spark Streaming and Deep Leaning - - PowerPoint PPT Presentation

smart manufacturing
SMART_READER_LITE
LIVE PREVIEW

SMART MANUFACTURING With Apache Spark Streaming and Deep Leaning - - PowerPoint PPT Presentation

ApacheCon Big Data Europe Nov 2016, Seville, Spain SMART MANUFACTURING With Apache Spark Streaming and Deep Leaning Prajod Vettiyattil, Wipro @prajods https://in.linkedin.com/in/prajod 2 AGENDA Introduction Smart Manufacturing


slide-1
SLIDE 1

SMART MANUFACTURING

With Apache Spark Streaming and Deep Leaning ApacheCon Big Data Europe Nov 2016, Seville, Spain Prajod Vettiyattil, Wipro @prajods https://in.linkedin.com/in/prajod

slide-2
SLIDE 2

AGENDA

  • Introduction
  • Smart Manufacturing
  • Applications
  • Deep learning solution
  • CNN
  • Deeplearning4j (DL4J)
  • Apache Spark
  • Deploying machine learning

Smart Manufacturing with Apache Spark and Deep Learning #apacheconbigdata @prajods 2

slide-3
SLIDE 3

INTRODUCTION

  • Industrialization
  • Automation
  • Scale
  • Commoditization
  • Accessibility

Smart Manufacturing with Apache Spark and Deep Learning #apacheconbigdata @prajods 3

slide-4
SLIDE 4

MEN AND MACHINES

Smart Manufacturing with Apache Spark and Deep Learning #apacheconbigdata @prajods 4

slide-5
SLIDE 5

KEY POINT

Machines can do what humans can’t

Smart Manufacturing with Apache Spark and Deep Learning #apacheconbigdata @prajods 5

slide-6
SLIDE 6

SMART MANUFACTURING

  • Holistic view of entire process
  • Sourcing to product sale
  • Efficiency
  • Eco friendliness
  • Predict over react
  • Autonomous machines
  • Learning and AI
  • Use data and analytics

Smart Manufacturing with Apache Spark and Deep Learning #apacheconbigdata @prajods 6

slide-7
SLIDE 7

APPLICATIONS

  • Detecting overheating
  • Equipment
  • Finished products
  • Glass defect detection

Smart Manufacturing with Apache Spark and Deep Learning #apacheconbigdata @prajods 7

slide-8
SLIDE 8

OVERHEATING

  • Detect temperatures above

defined boundaries

Smart Manufacturing with Apache Spark and Deep Learning #apacheconbigdata @prajods 8

slide-9
SLIDE 9

COOLING TOWER

Smart Manufacturing with Apache Spark and Deep Learning #apacheconbigdata @prajods 9

slide-10
SLIDE 10

ELECTRIC MOTOR

Smart Manufacturing with Apache Spark and Deep Learning #apacheconbigdata @prajods 10

slide-11
SLIDE 11

ELECTRIC MOTOR: OVERHEATING

Smart Manufacturing with Apache Spark and Deep Learning #apacheconbigdata @prajods 11

slide-12
SLIDE 12

OVERHEATING: LOWER RESOLUTION

Smart Manufacturing with Apache Spark and Deep Learning #apacheconbigdata @prajods 12

slide-13
SLIDE 13

ELECTRIC MOTOR: NORMAL VIEW

Smart Manufacturing with Apache Spark and Deep Learning #apacheconbigdata @prajods 13

slide-14
SLIDE 14

GLASS DEFECT

Smart Manufacturing with Apache Spark and Deep Learning #apacheconbigdata @prajods 14

slide-15
SLIDE 15

ZOOMING IN

Smart Manufacturing with Apache Spark and Deep Learning #apacheconbigdata @prajods 15

slide-16
SLIDE 16

UNDER A DIFFERENT LIGHT

Smart Manufacturing with Apache Spark and Deep Learning #apacheconbigdata @prajods 16

slide-17
SLIDE 17

AUTOMATING DETECTION

  • Machine learning
  • Multivariate Analysis
  • Multiple categories of defects
  • Deep Learning

Smart Manufacturing with Apache Spark and Deep Learning #apacheconbigdata @prajods 17

slide-18
SLIDE 18

DEEP LEARNING: WHAT

  • Neural Network based Machine Learning
  • Neural Network
  • 1 Input layer
  • 1 or more hidden layers
  • 1 Output layer
  • Basic unit of NN
  • Neuron or Perceptron
  • Combine perceptrons in many

ways using multiple parameters

  • Model parameters
  • Hyperparameters

Smart Manufacturing with Apache Spark and Deep Learning #apacheconbigdata @prajods 18

Image from: ucalgary.ca

slide-19
SLIDE 19

DEEP LEARNING: WHY

  • Can discern complex input patterns
  • Higher accuracy than most other ML methods
  • for image analysis
  • Ideally suited for spatial data analysis
  • Higher time needed for training
  • Parallel execution
  • Higher level architectures for evolving needs
  • CNN, RNN, LSTM

Smart Manufacturing with Apache Spark and Deep Learning #apacheconbigdata @prajods 19

slide-20
SLIDE 20

CONVOLUTIONAL NEURAL NETWORKS

Smart Manufacturing with Apache Spark and Deep Learning #apacheconbigdata @prajods 20

slide-21
SLIDE 21

CONVOLUTIONAL NEURAL NETWORK

  • Convolutional Neural Network (CNN)
  • Convolve: mix two functions
  • Matrix multiplication and addition
  • Dot product
  • Pass many filters over an image
  • Image features
  • Images are 3D features
  • Discern the important features/signals
  • Filter = kernel

Smart Manufacturing with Apache Spark and Deep Learning #apacheconbigdata @prajods 21

slide-22
SLIDE 22

CNN: APPLICATION

  • Self driving cars
  • Robotics
  • Drones
  • Industrial automation
  • Physical security
  • Medical labs
  • Wherever images or videos are used

Smart Manufacturing with Apache Spark and Deep Learning #apacheconbigdata @prajods 22

slide-23
SLIDE 23

IMAGE FOR CONVOLUTION

Smart Manufacturing with Apache Spark and Deep Learning #apacheconbigdata @prajods 23

slide-24
SLIDE 24

CONVOLUTION

Filter matrix Image

Smart Manufacturing with Apache Spark and Deep Learning #apacheconbigdata @prajods 24

slide-25
SLIDE 25

CNN ARCHITECTURE

Smart Manufacturing with Apache Spark and Deep Learning #apacheconbigdata @prajods 25

1st Convolution Non linear transform

(RELU, tanh etc)

Pooling Nth Convolution Non linear transform

(RELU, tanh etc)

Pooling Fully connected layers Output probabiities Feature extraction + dimension reduction Classification

…..

slide-26
SLIDE 26

CNN PARAMETERS

  • Model parameters
  • Filter values
  • Weights
  • Biases

Smart Manufacturing with Apache Spark and Deep Learning #apacheconbigdata @prajods 26

  • Hyperparameters
  • Activation function
  • # layers
  • # nodes in each layer
  • Filter size and count
  • Regularization
  • Convolution layers
  • Maxpooling layers

Learned by NN Experience of designer

slide-27
SLIDE 27

CNN: SAMPLE CODE

  • MultiLayerConfiguration conf = new NeuralNetConfiguration.Builder()

.seed(seed).iterations(iterations).regularization(false).l2(0.003).activation(“relu") .learningRate(0.0007).weightInit(WeightInit.XAVIER) .optimizationAlgo(OptimizationAlgorithm.STOCHASTIC_GRADIENT_DESCENT) .updater(Updater.RMSPROP).momentum(0.9).list() .layer(0, convInit("cnn1", channels, 50 , new int[]{5, 5}, new int[]{1, 1}, new int[]{0, 0}, 0)) .layer(1, maxPool("maxpool1", new int[]{2,2})) …. .layer(4, new DenseLayer.Builder().nOut(500).build()) .layer(5, new OutputLayer.Builder(LossFunctions.LossFunction.NEGATIVELOGLIKELIHOOD) .nOut(numLabels).activation("softmax").build()) .backprop(true).pretrain(false).cnnInputSize(height, width, channels).build();

Smart Manufacturing with Apache Spark and Deep Learning #apacheconbigdata @prajods 27

slide-28
SLIDE 28

DEEPLEARNING4J (DL4J)

  • Deep learning library
  • Open source
  • Apache 2.0 license
  • Java based
  • Distributed execution
  • Runs on Spark and Hadoop

Smart Manufacturing with Apache Spark and Deep Learning #apacheconbigdata @prajods 28

slide-29
SLIDE 29

DEEPLEARNING4J: FEATURES

  • ND4J
  • N Dimensional Arrays/Tensors
  • Like numpy
  • Canova/DataVec
  • Data extraction, vectorization
  • Arbitrer
  • Evaluate and tune models
  • CPU or GPU
  • OpenBLAS, Intel MKL, Nvidia CUDA

Smart Manufacturing with Apache Spark and Deep Learning #apacheconbigdata @prajods 29

slide-30
SLIDE 30

DEEPLEARNING4J: SUPPORT

  • Community support
  • https://gitter.im/deeplearning4j/deeplearning4j
  • Commercial support
  • www.skymind.io

Smart Manufacturing with Apache Spark and Deep Learning #apacheconbigdata @prajods 30

slide-31
SLIDE 31

APACHE SPARK

  • Incubated in 2009 at Berkeley University
  • 100s of contributors
  • Yahoo, Intel, UC Berkeley,…,50+ orgs
  • 10 to 100 times faster than Hadoop MR
  • https://databricks.com/blog/2014/10/10/spark-petabyte-sort.html

Smart Manufacturing with Apache Spark and Deep Learning #apacheconbigdata @prajods 31

slide-32
SLIDE 32

APACHE SPARK

  • Complements Hadoop
  • Replaces Hadoop MR
  • Adds
  • In memory processing
  • Stream processing
  • Interactive queries
  • YARN or Mesos for clustering
  • Java, Scala, Python, R

Smart Manufacturing with Apache Spark and Deep Learning #apacheconbigdata @prajods 32

slide-33
SLIDE 33

SPARK: LOGICAL VIEW

Apache Spark Core

Spark SQL Spark Streaming MLlib GraphX

Smart Manufacturing with Apache Spark and Deep Learning #apacheconbigdata @prajods 33

slide-34
SLIDE 34

SPARK: DEPLOYMENT VIEW

Worker Node Executor Master Node

Executor

Task

Cache

Task

Task

Worker Node Executor Executor

Executor

Task Task

Task Cache Spark’s Cluster Manager Spark Driver

Smart Manufacturing with Apache Spark and Deep Learning #apacheconbigdata @prajods 34

slide-35
SLIDE 35

PARALLEL TRAINING: SPARK + DL4J

Smart Manufacturing with Apache Spark and Deep Learning #apacheconbigdata @prajods 35

Spark Worker Node 1

Spark Master Node

Spark Worker Node 2

Data Data Split 1 Data Split 2 Mini Batch 1 Mini Batch 2

Calculate model parameters Calculate model parameters Averaged parameters from workers

slide-36
SLIDE 36

THE MACHINE LEARNING PROCESS

Smart Manufacturing with Apache Spark and Deep Learning #apacheconbigdata @prajods 36

slide-37
SLIDE 37

A LONG JOURNEY

Smart Manufacturing with Apache Spark and Deep Learning #apacheconbigdata @prajods 37

Select problem Non ML solution ? Analyze process Data available ? Define success KPI Classify ML type Select 2 or 3 algo Pick one Gather data Analyze data Filter data Convert data Vectorize

Select hyperparams Iterate hyperparams

Iterate data sets Evaluate perform Validation set Deploy Continuous eval

slide-38
SLIDE 38

SELECT PROBLEM

Smart Manufacturing with Apache Spark and Deep Learning #apacheconbigdata @prajods 38

slide-39
SLIDE 39

GATHER AND FORMAT DATA

Smart Manufacturing with Apache Spark and Deep Learning #apacheconbigdata @prajods 39

slide-40
SLIDE 40

PROGRAM

Smart Manufacturing with Apache Spark and Deep Learning #apacheconbigdata @prajods 40

slide-41
SLIDE 41

Smart Manufacturing with Apache Spark and Deep Learning #apacheconbigdata @prajods 41

ITERATE WITH HYPERPARAMETERS AND DATA

slide-42
SLIDE 42

Smart Manufacturing with Apache Spark and Deep Learning #apacheconbigdata @prajods 42

CONTINUOUS EVALUATION

slide-43
SLIDE 43

SUMMARY

  • Automation and commoditization
  • Humans and machines
  • Beyond human capacity
  • Application to product quality inspection
  • Deep leaning and images: higher accuracy
  • CNN
  • DL4J + Spark
  • The Machine Learning process

Smart Manufacturing with Apache Spark and Deep Learning #apacheconbigdata @prajods 43

slide-44
SLIDE 44

REFERENCES

  • https://en.wikipedia.org/wiki/Smart_manufacturing
  • http://karpathy.github.io/neuralnets/
  • http://cs231n.github.io/convolutional-networks/
  • https://deeplearning4j.org/convolutionalnets.html
  • https://ujjwalkarn.me/2016/08/11/intuitive-explanation-convnets/
  • https://en.wikipedia.org/wiki/Glass_production
  • http://www.qorpak.com/pages/lab-glass-defects-inspect-packaging
  • https://en.wikipedia.org/wiki/Automated_analyser

Smart Manufacturing with Apache Spark and Deep Learning #apacheconbigdata @prajods 44

slide-45
SLIDE 45

QUESTIONS

Smart Manufacturing with Apache Spark and Deep Learning #apacheconbigdata @prajods 45

Prajod Vettiyattil, Wipro @prajods https://in.linkedin.com/in/prajod