Upgrade to Pro — share decks privately, control downloads, hide ads and more …

JGS594 Lecture 12

JGS594 Lecture 12

Software Engineering for Machine Learning
Convolutional Neural Networks
(202203)

B546a9b97d993392e4b22b74b99b91fe?s=128

Javier Gonzalez
PRO

February 24, 2022
Tweet

More Decks by Javier Gonzalez

Other Decks in Programming

Transcript

  1. jgs SER 594 Software Engineering for Machine Learning Lecture 12:

    Convolutional Models Dr. Javier Gonzalez-Sanchez javiergs@asu.edu javiergs.engineering.asu.edu | javiergs.com PERALTA 230U Office Hours: By appointment
  2. Javier Gonzalez-Sanchez | SER 594 | Spring 2022 | 2

    jgs Assignment 04 1. Select a new dataset. Lecture 08 https://archive-beta.ics.uci.edu Your own CSV data from a project you are working on 2. Create a Java Program for training a model until achieving a good performance (0.05). Save the model. This can be console application or GUI. Your choice. 3. Create a Java Application that use the model. It should have a GUI Allow the user to input data: load an image, text, etc. Show a result/classification § You can work in a team of 2 or 3. No more than 3. Individual is OK. § Include Javadoc for classes and methods. https://www.oracle.com/technical-resources/articles/java/javadoc-tool.html § Submit java files. How many files?
  3. jgs Next

  4. Javier Gonzalez-Sanchez | SER 594 | Spring 2022 | 4

    jgs Problem § Imagine that we need to process images of size 300 x 300; § The input layer will have 90,000 neurons. § Then, if the next layer also has 90,000 neurons, there will be 90000 x 90000 connections between these two layers, which is a lot. § We have a problem for larger images! § For 28 x 28 images such as digits from MNIST, this was not a big deal
  5. Javier Gonzalez-Sanchez | SER 594 | Spring 2022 | 5

    jgs Solution § Convolutional Networks § Each neuron can interact with and make decisions based on a region of information. filter features matrix pooling ... convolution
  6. Javier Gonzalez-Sanchez | SER 594 | Spring 2022 | 6

    jgs Convolution § Mathematical operation which takes two inputs: (a) image matrix (small square of input data) and, (b) a filter (or kernel). The result is called a Features Matrix § Learning image features while preserving the relationship between pixels. filter features matrix convolution
  7. Javier Gonzalez-Sanchez | SER 594 | Spring 2022 | 7

    jgs Convolution § Convolutions have been used for a long time in image processing to blur, sharpen images, enhance edges, and emboss. 1 0 0 0 0 1 1 0 0 1 1 1 1 1 1 0 1 1 1 0 0 0 1 0 0 1 0 1 0 1 0 1 0 1 4 2 2 3 4 3 4 3 4 Image matrix: Filter: Feature: (RI x CI) (RF x CF) (RI-RF+1 x CI-CF+1)
  8. Javier Gonzalez-Sanchez | SER 594 | Spring 2022 | 8

    jgs Filters § There are a set of few filters that are used to perform a few tasks. blur sharp borders 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0 -1 0 -1 5 -1 0 -1 0 -1 0 1 -2 0 2 -1 0 1 -1 -2 -1 0 0 0 1 2 1 horizontal vertical
  9. Javier Gonzalez-Sanchez | SER 594 | Spring 2022 | 9

    jgs Filters § Our Filters are not defined. Filters are just collections of Ws. § The value of each filter is learned during the training process. They are updated every backpropagation § Each filter in this layer is randomly initialized to some distribution (Normal, Gaussian, etc.). By having different initialization criteria, each filter gets trained slightly differently. They eventually learn to detect different features in the image. § Convolution of an image with different filters can perform an operation such as blur, sharpen, and edge detection by applying filters.
  10. Javier Gonzalez-Sanchez | SER 594 | Spring 2022 | 10

    jgs Stride § The number of pixels which are shift over the input matrix. § When the stride is equaled to 1, then we move the filters to 1 pixel at a time and similarly, if the stride is equaled to 2, then we move the filters to 2 pixels at a time, etc. 11 21 31 41 51 12 22 32 42 52 13 23 33 43 53 14 24 34 44 54 15 25 35 45 54 61 62 63 64 65 0 1 2 3 4 16 26 36 46 55 10 20 30 40 50 66 60 5 6 1 1 1 1 1 1 1 1 1 99 117 135 279 * =
  11. Javier Gonzalez-Sanchez | SER 594 | Spring 2022 | 11

    jgs Padding § The pixel in the corner will only get covers one time, but the middle pixels will get covered more than once. § Padding refers to the number of pixels added to an image when it is being processed 1 0 0 0 0 1 1 0 0 1 1 1 1 1 1 0 1 1 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
  12. Javier Gonzalez-Sanchez | SER 594 | Spring 2022 | 12

    jgs Pooling § Pooling is downscaling of the image obtained from the previous layers. § It can be compared to shrinking an image to reduce its pixel density § Options: Max-pooling, Average-pooling, Sum-pooling 11 21 31 12 22 32 13 23 33 0 2 3 10 20 30 1 2x2 Max pooling 33 11 31 13
  13. Javier Gonzalez-Sanchez | SER 594 | Spring 2022 | 13

    jgs Architecture
  14. Javier Gonzalez-Sanchez | SER 594 | Spring 2022 | 14

    jgs Architecture
  15. Javier Gonzalez-Sanchez | SER 594 | Spring 2022 | 15

    jgs Use § This type of network is used frequently in image and video processing applications. § But they have a wide applicability in practical situations.
  16. Javier Gonzalez-Sanchez | SER 594 | Spring 2022 | 16

    jgs Architecture § It is always a good idea to use the existing architectures, as it solves a lot of time § Producing a good architecture on your own is a challenging task. Example for MNIST: 1. 20 filters of 5 x 5 in convolutional layer 2. Max pooling 3. 50 filters of 5 x 5 in convolutional layer 4. Max pooling 5. Fully connected layers with 500 neurons 6. Output layer with SoftMax
  17. Javier Gonzalez-Sanchez | SER 594 | Spring 2022 | 17

    jgs Code
  18. Javier Gonzalez-Sanchez | SER 594 | Spring 2022 | 18

    jgs Questions
  19. jgs SER 594 Software Engineering for Machine Learning Javier Gonzalez-Sanchez,

    Ph.D. javiergs@asu.edu Spring 2022 Copyright. These slides can only be used as study material for the class CSE205 at Arizona State University. They cannot be distributed or used for another purpose.