neural networks across space time
play

Neural networks across space & time Dave Snowdon @davesnowdon - PowerPoint PPT Presentation

Neural networks across space & time Dave Snowdon @davesnowdon https://www.linkedin.com/in/davesnowdon/ About me Java & javascript by day Python & clojure by night Amateur social roboticist Been learning about deep


  1. Neural networks across space & time Dave Snowdon @davesnowdon https://www.linkedin.com/in/davesnowdon/

  2. About me • Java & javascript by day • Python & clojure by night • Amateur social roboticist • Been learning about deep learning for 18 months

  3. Agenda • Why neural networks • How do neural networks work • Convolutional neural networks • Recurrent neural networks

  4. Why neural networks?

  5. Why care about deep learning? • Impressive results in a wide range of domains • image classification, text descriptions of images, language translation, speech generation, speech recognition… • Predictable execution (inference) time • Amenable to hardware acceleration • Automatic feature extraction

  6. What are features? Average statement length Number of variables 10 PRINT “Hello QCon London” 20 GOTO 10 Number of statements Cyclomatic complexity

  7. Feature extraction Traditional machine learning process Pre- Extract Data Model Results features process Deep learning process Pre- Data Model Results process

  8. Neural network downsides • Need to define the model and it’s training parameters • Large models can take days or weeks to train • May need a lot of data. > 10K examples

  9. How neural networks work

  10. Deep learning != your brain NOT YOUR NEURAL NETWORK

  11. Neuron model bias (weight for fixed input) b input 0 x 0 w 0 weight 0 weight 1 w 1 S S input 1 x 1 u u F( ) output m m weight N w N input N x N

  12. Neuron model 0.8 0.5 0.1 -0.5 S 1 -1.65 F( ) u m 4 -0.5

  13. Neuron model 0.8 identity 0.5 0.1 -0.5 S 1 -1.65 F( ) u -1.65 m 4 -0.5

  14. Neuron model 0.8 sigmoid 0.5 0.1 -0.5 S 1 -1.65 F( ) u 0.1611 m 4 -0.5

  15. Neuron model 0.8 tanh 0.5 0.1 -0.5 S 1 -1.65 F( ) u -0.9289 m 4 -0.5

  16. Neuron model 0.8 ReLU 0.5 0.1 -0.5 S 1 -1.65 F( ) u 0 m 4 -0.5

  17. Neural networks are not graphs

  18. Neural networks are like onions (they have layers and can make you cry) Input layer Hidden layer Output layer

  19. Why layers? x x x x x Layer 1 Layer 2

  20. Neural networks are like onions (they have layers and can make you cry) W 2 W 1 � � W W W W � � 11 12 13 14 ⎧ ⎫ � � W 11 W 12 W 13 W W W W ⎪ ⎪ � � 21 22 23 24 � � ⎪ ⎪ W 21 W 22 W 23 ⎪ ⎪ ⎨ ⎬ W 31 W 32 W 33 ⎪ ⎪ ⎪ ⎪ Input layer output = f(W 2 . f(W 1 . Input + B 1 ) + B 2 ) Hidden layer Output layer W 41 W 42 W 43 ⎪ ⎪ ⎩ ⎭

  21. Going deeper Input layer Hidden layer Hidden layer Output layer

  22. What do the layers do? Successive layers model higher level features

  23. What input can a network accept? • Anything you like as long as it’s a tensor • Tensor = general multi-dimensional numeric quantity • scalar = tensor of 0 dimensions (AKA rank 0) • vector = 1 dimensional tensor (rank 1) • matrix = 2 dimensional tensor (rank 2) • tensor = N dimensional tensor (rank > 2)

  24. Images Can represent image as tensor of rank 3 Source: https://www.slideshare.net/BertonEarnshaw/a-brief-survey-of-tensors

  25. One-hot encoding : input “enums” FAVOURITE PROGRAMMING LANGUAGE JAVA CLOJURE PYTHON JAVASCRIPT 1 0 0 0 BARRY 0 1 0 0 BRUCE RUSSEL 0 0 1 0

  26. One-hot encoding: output Also useful for output Probability distribution JAVA CLOJURE PYTHON JAVASCRIPT 0.6 0.1 0.1 0.2 BARRY 0.15 0.75 0.05 0.05 BRUCE RUSSEL 0.34 0.05 0.6 0.01

  27. Back propagation Input example Training example Expected output Cost Error Function (also known as cost or loss) ⎛ ⎛ ⎞ ⎞ w 11 w 11 w 12 w 12 ⎜ ⎜ ⎟ ⎟ ⎛ ⎞ ⎛ ⎞ ⎜ ⎜ ⎟ ⎟ w 21 w 22 w 21 w 22 w 11 w 11 w 12 w 12 w 13 w 13 w 14 w 14 ⎜ ⎟ ⎜ ⎟ ⎜ ⎟ ⎜ ⎟ ⎜ ⎟ ⎜ ⎟ w 31 w 32 w 31 w 32 ⎜ ⎜ ⎟ ⎟ w 21 w 21 w 22 w 22 w 23 w 23 w 24 w 24 ⎜ ⎟ ⎜ ⎟ ⎜ ⎟ ⎜ ⎟ ⎜ ⎟ ⎜ ⎟ ⎜ ⎟ w 41 w 42 w 41 w 42 ⎜ ⎟ w 31 w 31 w 32 w 32 w 33 w 33 w 34 w 34 ⎝ ⎠ ⎝ ⎠ ⎝ ⎝ ⎠ ⎠

  28. More on back propagation

  29. Frameworks

  30. Summary so far • Neural networks are NOT like your brain • Networks are arranged as layers • Forward pass compute output of network • Backward pass compute gradients & adjust weights • Frameworks take care of the math for you • but still good to understand what’s going on

  31. A request from marketing

  32. Images that mention VMware

  33. First we need a dataset

  34. Highlight the parts for training

  35. Creating the dataset • Grab images from google image search • PyImageSearch “How to create a deep learning dataset using Google Images” • Use dlib imglab tool to draw bounding boxes around logos / not Logos • https://github.com/davisking/dlib/tree/master/tools/imglab • Wrote python script to read imglab XML and produce cropped images using OpenCV

  36. Sliding windows

  37. Multiple scales

  38. How it all adds up • 5501 images total • 883 VMware • 4318 not VMware • Scaled to 75x22x3 -> 4950 inputs • Easily 4,950,000 weights in first layer alone • Maybe we need another neural network architecture

  39. Convolutional Neural Networks

  40. Convolution

  41. Convolution example(s) 1 0 -1 1 1 1 -1 -1 -1 1 0 -1 0 0 0 -1 8 -1 1 0 -1 -1 -1 -1 -1 -1 -1

  42. Convolutional layer

  43. Max Pooling layer

  44. Convolutional network

  45. DL4J model structure Convolution Convolution Fully connected Softmax Pooling Input Pooling

Recommend


More recommend