scanning for patterns aka convolutional networks
play

Scanning for patterns (aka convolutional networks) Bhiksha Raj 1 - PowerPoint PPT Presentation

Deep Neural Networks Scanning for patterns (aka convolutional networks) Bhiksha Raj 1 Story so far MLPs are universal function approximators Boolean functions, classifiers, and regressions MLPs can be trained through variations of


  1. Training the network • These are really just large networks • Can just use conventional backpropagation to learn the parameters – Provide many training examples • Images with and without flowers • Speech recordings with and without the word “welcome” – Gradient descent to minimize the total divergence between predicted and desired outputs • Backprop learns a network that maps the training inputs to the target binary outputs

  2. Training the network: constraint • These are shared parameter networks – All lower-level subnets are identical • Are all searching for the same pattern – Any update of the parameters of one copy of the subnet must equally update all copies

  3. Learning in shared parameter networks 𝐸𝑗𝑤(𝑒, 𝑧) • Consider a simple network with 𝑒 Div shared weights 𝑧 𝑙 = 𝑥 𝑛𝑜 𝑚 = 𝑥 𝒯 𝑥 𝑗𝑘 𝑙 is required to be – A weight 𝑥 𝑗𝑘 𝑚 identical to the weight 𝑥 𝑛𝑜 • For any training instance 𝒀 , a small perturbation of 𝑥 𝒯 perturbs both 𝑙 and 𝑥 𝑛𝑜 𝑚 𝑥 𝑗𝑘 identically – Each of these perturbations will individually influence the 𝒀 divergence 𝐸𝑗𝑤(𝑒, 𝑧)

  4. Computing the divergence of shared parameters Influence diagram 𝐸𝑗𝑤(𝑒, 𝑧) 𝐸𝑗𝑤 𝑒 Div 𝑧 𝑙 𝑚 𝑥 𝑗𝑘 𝑥 𝑛𝑜 𝑥 𝒯 𝑙 𝑚 𝑒𝑥 𝑗𝑘 𝑒𝐸𝑗𝑤 𝑒𝑥 𝒯 = 𝑒𝐸𝑗𝑤 𝑒𝑥 𝒯 + 𝑒𝐸𝑗𝑤 𝑒𝑥 𝑛𝑜 𝑙 𝑚 𝑒𝑥 𝒯 𝑒𝑥 𝑗𝑘 𝑒𝑥 𝑛𝑜 = 𝑒𝐸𝑗𝑤 𝑙 + 𝑒𝐸𝑗𝑤 𝑚 𝑒𝑥 𝑗𝑘 𝑒𝑥 𝑛𝑜 𝒀 • Each of the individual terms can be computed via backpropagation

  5. Computing the divergence of shared parameters 𝒯 = 𝑓 1 , 𝑓 1 , … , 𝑓 𝑂 More generally, let 𝒯 be any set of edges that have a common value, and 𝑥 𝒯 be • the common weight of the set – E.g. the set of all red weights in the figure 𝑒𝐸𝑗𝑤 𝑒𝐸𝑗𝑤 𝑒𝑥 𝒯 = ෍ 𝑒𝑥 𝑓 𝑓∈𝒯 • The individual terms in the sum can be computed via backpropagation

  6. Standard gradient descent training of networks Total training error: 𝐹𝑠𝑠 = ෍ 𝐸𝑗𝑤(𝒁 𝒖 , 𝒆 𝒖 ; 𝐗 1 , 𝐗 2 , … , 𝐗 𝐿 ) 𝒖 • Gradient descent algorithm: • Initialize all weights 𝐗 1 , 𝐗 2 , … , 𝐗 𝐿 • Do: – For every layer 𝑙 for all 𝑗, 𝑘, update: (𝑙) = 𝑥 𝑗,𝑘 (𝑙) − 𝜃 𝑒𝐹𝑠𝑠 • 𝑥 𝑗,𝑘 (𝑙) 𝑒𝑥 𝑗,𝑘 • Until 𝐹𝑠𝑠 has converged 57

  7. Training networks with shared parameters • Gradient descent algorithm: • Initialize all weights 𝐗 1 , 𝐗 2 , … , 𝐗 𝐿 • Do: – For every set 𝒯 : • Compute: 𝛼 𝒯 𝐹𝑠𝑠 = 𝑒𝐹𝑠𝑠 𝑒𝑥 𝒯 𝑥 𝒯 = 𝑥 𝒯 − 𝜃𝛼 𝒯 𝐹𝑠𝑠 • For every (𝑙, 𝑗, 𝑘) ∈ 𝒯 update: (𝑙) = 𝑥 𝒯 𝑥 𝑗,𝑘 • Until 𝐹𝑠𝑠 has converged 58

  8. Training networks with shared parameters • Gradient descent algorithm: • Initialize all weights 𝐗 1 , 𝐗 2 , … , 𝐗 𝐿 • Do: – For every set 𝒯 : • Compute: 𝛼 𝒯 𝐹𝑠𝑠 = 𝑒𝐹𝑠𝑠 𝑒𝑥 𝒯 𝑥 𝒯 = 𝑥 𝒯 − 𝜃𝛼 𝒯 𝐹𝑠𝑠 • For every (𝑙, 𝑗, 𝑘) ∈ 𝒯 update: (𝑙) = 𝑥 𝒯 𝑥 𝑗,𝑘 • Until 𝐹𝑠𝑠 has converged 59

  9. Training networks with shared parameters • Gradient descent algorithm: For every training instance 𝑌 • • For every set 𝒯 : • Initialize all weights 𝐗 1 , 𝐗 2 , … , 𝐗 𝐿 For every (𝑙, 𝑗, 𝑘) ∈ 𝒯 : • 𝛼 𝒯 𝐸𝑗𝑤 += 𝑒𝐸𝑗𝑤 • Do: (𝑙) 𝑒𝑥 𝑗,𝑘 – For every set 𝒯 : • 𝛼 𝒯 𝐹𝑠𝑠 += 𝛼 𝒯 𝐸𝑗𝑤 • Compute: 𝛼 𝒯 𝐹𝑠𝑠 = 𝑒𝐹𝑠𝑠 𝑒𝑥 𝒯 𝑥 𝒯 = 𝑥 𝒯 − 𝜃𝛼 𝒯 𝐹𝑠𝑠 • For every (𝑙, 𝑗, 𝑘) ∈ 𝒯 update: (𝑙) = 𝑥 𝒯 𝑥 𝑗,𝑘 • Until 𝐹𝑠𝑠 has converged 60

  10. Training networks with shared parameters • Gradient descent algorithm: For every training instance 𝑌 • • Computed by For every set 𝒯 : • Initialize all weights 𝐗 1 , 𝐗 2 , … , 𝐗 𝐿 For every (𝑙, 𝑗, 𝑘) ∈ 𝒯 : • Backprop 𝛼 𝒯 𝐸𝑗𝑤 += 𝑒𝐸𝑗𝑤 • Do: (𝑙) 𝑒𝑥 𝑗,𝑘 – For every set 𝒯 : • 𝛼 𝒯 𝐹𝑠𝑠 += 𝛼 𝒯 𝐸𝑗𝑤 • Compute: 𝛼 𝒯 𝐹𝑠𝑠 = 𝑒𝐹𝑠𝑠 𝑒𝑥 𝒯 𝑥 𝒯 = 𝑥 𝒯 − 𝜃𝛼 𝒯 𝐹𝑠𝑠 • For every (𝑙, 𝑗, 𝑘) ∈ 𝒯 update: (𝑙) = 𝑥 𝒯 𝑥 𝑗,𝑘 • Until 𝐹𝑠𝑠 has converged 61

  11. Story so far • Position-invariant pattern classification can be performed by scanning – 1-D scanning for sound – 2-D scanning for images – 3-D and higher-dimensional scans for higher dimensional data • Scanning is equivalent to composing a large network with repeating subnets – The large network has shared subnets • Learning in scanned networks: Backpropagation rules must be modified to combine gradients from parameters that share the same value – The principle applies in general for networks with shared parameters

  12. Scanning: A closer look Input (the pixel data) • Scan for the desired object • At each location, the entire region is sent through an MLP

  13. Scanning: A closer look Input layer Hidden layer • The “input layer” is just the pixels in the image connecting to the hidden layer

  14. Scanning: A closer look • Consider a single neuron

  15. Scanning: A closer look 𝑏𝑑𝑢𝑗𝑤𝑏𝑢𝑗𝑝𝑜 ෍ 𝑥 𝑗𝑘 𝑞 𝑗𝑘 + 𝑐 𝑗,𝑘 • Consider a single perceptron • At each position of the box, the perceptron is evaluating the part of the picture in the box as part of the classification for that region – We could arrange the outputs of the neurons for each position correspondingly to the original picture

  16. Scanning: A closer look • Consider a single perceptron • At each position of the box, the perceptron is evaluating the picture as part of the classification for that region – We could arrange the outputs of the neurons for each position correspondingly to the original picture

  17. Scanning: A closer look • Consider a single perceptron • At each position of the box, the perceptron is evaluating the picture as part of the classification for that region – We could arrange the outputs of the neurons for each position correspondingly to the original picture

  18. Scanning: A closer look • Consider a single perceptron • At each position of the box, the perceptron is evaluating the picture as part of the classification for that region – We could arrange the outputs of the neurons for each position correspondingly to the original picture

  19. Scanning: A closer look • Consider a single perceptron • At each position of the box, the perceptron is evaluating the picture as part of the classification for that region – We could arrange the outputs of the neurons for each position correspondingly to the original picture

  20. Scanning: A closer look • Consider a single perceptron • At each position of the box, the perceptron is evaluating the picture as part of the classification for that region – We could arrange the outputs of the neurons for each position correspondingly to the original picture

  21. Scanning: A closer look • Consider a single perceptron • At each position of the box, the perceptron is evaluating the picture as part of the classification for that region – We could arrange the outputs of the neurons for each position correspondingly to the original picture

  22. Scanning: A closer look • Consider a single perceptron • At each position of the box, the perceptron is evaluating the picture as part of the classification for that region – We could arrange the outputs of the neurons for each position correspondingly to the original picture

  23. Scanning: A closer look • Consider a single perceptron • At each position of the box, the perceptron is evaluating the picture as part of the classification for that region – We could arrange the outputs of the neurons for each position correspondingly to the original picture

  24. Scanning: A closer look • Consider a single perceptron • At each position of the box, the perceptron is evaluating the picture as part of the classification for that region – We could arrange the outputs of the neurons for each position correspondingly to the original picture

  25. Scanning: A closer look • Consider a single perceptron • At each position of the box, the perceptron is evaluating the picture as part of the classification for that region – We could arrange the outputs of the neurons for each position correspondingly to the original picture

  26. Scanning: A closer look • Consider a single perceptron • At each position of the box, the perceptron is evaluating the picture as part of the classification for that region – We could arrange the outputs of the neurons for each position correspondingly to the original picture

  27. Scanning: A closer look • Consider a single perceptron • At each position of the box, the perceptron is evaluating the picture as part of the classification for that region – We could arrange the outputs of the neurons for each position correspondingly to the original picture

  28. Scanning: A closer look • Consider a single perceptron • At each position of the box, the perceptron is evaluating the picture as part of the classification for that region – We could arrange the outputs of the neurons for each position correspondingly to the original picture • Eventually, we can arrange the outputs from the response at each scanned position into a rectangle that’s proportional in size to the original picture

  29. Scanning: A closer look • Consider a single perceptron • At each position of the box, the perceptron is evaluating the picture as part of the classification for that region – We could arrange the outputs of the neurons for each position correspondingly to the original picture • Eventually, we can arrange the outputs from the response at each scanned position into a rectangle that’s proportional in size to the original picture

  30. Scanning: A closer look • Similarly, each perceptron’s outputs from each of the scanned positions can be arranged as a rectangular pattern

  31. Scanning: A closer look • To classify a specific “patch” in the image, we send the first level activations from the positions corresponding to that position to the next layer

  32. Scanning: A closer look • We can recurse the logic – The second level neurons too are “ scanning ” the rectangular outputs of the first-level neurons – (Un)like the first level, they are jointly scanning multiple “pictures” • Each location in the output of the second level neuron considers the corresponding locations from the outputs of all the first-level neurons

  33. Scanning: A closer look • We can recurse the logic – The second level neurons too are “ scanning ” the rectangular outputs of the first-level neurons – (Un)like the first level, they are jointly scanning multiple “pictures” • Each location in the output of the second level neuron considers the corresponding locations from the outputs of all the first-level neurons

  34. Scanning: A closer look • We can recurse the logic – The second level neurons too are “ scanning ” the rectangular outputs of the first-level neurons – (Un)like the first level, they are jointly scanning multiple “pictures” • Each location in the output of the second level neuron considers the corresponding locations from the outputs of all the first-level neurons

  35. Scanning: A closer look • We can recurse the logic – The second level neurons too are “ scanning ” the rectangular outputs of the first-level neurons – (Un)like the first level, they are jointly scanning multiple “pictures” • Each location in the output of the second level neuron considers the corresponding locations from the outputs of all the first-level neurons

  36. Scanning: A closer look • We can recurse the logic – The second level neurons too are “ scanning ” the rectangular outputs of the first-level neurons – (Un)like the first level, they are jointly scanning multiple “pictures” • Each location in the output of the second level neuron considers the corresponding locations from the outputs of all the first-level neurons

  37. Scanning: A closer look • We can recurse the logic – The second level neurons too are “ scanning ” the rectangular outputs of the first-level neurons – (Un)like the first level, they are jointly scanning multiple “pictures” • Each location in the output of the second level neuron considers the corresponding locations from the outputs of all the first-level neurons

  38. Scanning: A closer look • We can recurse the logic – The second level neurons too are “ scanning ” the rectangular outputs of the first-level neurons – (Un)like the first level, they are jointly scanning multiple “pictures” • Each location in the output of the second level neuron considers the corresponding locations from the outputs of all the first-level neurons

  39. Scanning: A closer look • We can recurse the logic – The second level neurons too are “ scanning ” the rectangular outputs of the first-level neurons – (Un)like the first level, they are jointly scanning multiple “pictures” • Each location in the output of the second level neuron considers the corresponding locations from the outputs of all the first-level neurons

  40. Scanning: A closer look • To detect a picture at any location in the original image, the output layer must consider the corresponding outputs of the last hidden layer

  41. Detecting a picture anywhere in the image? • Recursing the logic, we can create a map for the neurons in the next layer as well – The map is a flower detector for each location of the original image

  42. Detecting a picture anywhere in the image? • To detect a picture at any location in the original image, the output layer must consider the corresponding output of the last hidden layer • Actual problem? Is there a flower in the image – Not “detect the location of a flower”

  43. Detecting a picture anywhere in the image? • To detect a picture at any location in the original image, the output layer must consider the corresponding output of the last hidden layer • Actual problem? Is there a flower in the image – Not “detect the location of a flower”

  44. Detecting a picture anywhere in the image? • Is there a flower in the picture? • The output of the almost-last layer is also a grid/picture • The entire grid can be sent into a final neuron that performs a logical “OR” to detect a picture – Finds the max output from all the positions – Or..

  45. Detecting a picture in the image • Redrawing the final layer – “Flatten” the output of the neurons into a single block, since the arrangement is no longer important – Pass that through an MLP

  46. Generalizing a bit • At each location, the net searches for a flower • The entire map of outputs is sent through a follow-up perceptron (or MLP) to determine if there really is a flower in the picture

  47. Generalizing a bit • The final objective is determine if the picture has a flower • No need to use only one MLP to scan the image – Could use multiple MLPs.. – Or a single larger MLPs with multiple outputs • Each providing independent evidence of the presence of a flower

  48. Generalizing a bit.. • The final objective is determine if the picture has a flower • No need to use only one MLP to scan the image – Could use multiple MLPs.. – Or a single larger MLPs with multiple output • Each providing independent evidence of the presence of a flower

  49. For simplicity.. • We will continue to assume the simple version of the model for the sake of explanation

Recommend


More recommend