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

Deep Learning for Image

Deep Learning for Image

A practioners' perspective on doing Deep Learning for Image

Amit Kapoor

March 10, 2018
Tweet

More Decks by Amit Kapoor

Other Decks in Programming

Transcript

  1. Outline for today... 1. Why deep learning now? 2. How

    to adopt a practical approach? a. Learning b. Data c. Tools & Deploy 3. Where do you go from here?
  2. Outline for today... 1. Why deep learning now? 2. How

    to adopt a practical approach? a. Learning b. Data c. Tools & Deploy 3. Where do you go from here?
  3. Task: Write the function Input → f(x) → Output Write

    the function user types the text 4 Update database 4
  4. Challenge: Robust Functions Input → f(x) → Output Write the

    function user types the text 4. Update database 4 Challenge Test to ensure it is robust for all possible inputs
  5. Learning Paradigm Input → ? → Output Learn the function

    user writes the text Update database 4
  6. Task: Create Features & Learn Input → Feature → g(x)

    → Output Create features user types the text Update database 4 Learn the Function
  7. Input → Feature → g(x) → Output Challenge: Hand-crafted features

    Create features user types the text Update database 4 Learn the Function Challenge How do I hand-craft the right set of features to learn the function
  8. Input → f(x) → Output Input → Features → g(x)

    → Output learn Two Paradigms Create Create Learning Paradigm Programming Paradigm
  9. - Structure of Data (tabular, text, image, video, sound) -

    Amount of Data (none, small, medium, large) - Knowledge of Domain (limited, expert) When to use which paradigm?
  10. Input → Features → g(x) → Output Input → Features

    → h(x) → Output learn Deep Learning Create Deep Learning Traditional Machine Learning learn
  11. What is deep about it? user types the text Update

    database 4 Layer 1 Layer 2 Layer 3 Layer 4 Learning Higher Order Represenastions
  12. - Access to more Data - Faster Compute (using GPUs)

    - Clever Algorithmic choices Why now?
  13. Outline for today... 1. Why deep learning now? 2. How

    to adopt a practical approach? a. Learning b. Data c. Tools & Deploy 3. Where do you go from here?
  14. Model: Convolutional Neural Network Key ideas for image 1. Local

    Receptive Fields 2. Shared Weights 3. Sub-sampling
  15. Shared Weights: localized feature maps - One feature map detects

    a single kind of localized feature - Use several feature maps
  16. Outline for today... 1. Why deep learning now? 2. How

    to adopt a practical approach? a. Learning b. Data c. Tools & Deploy 3. Where do you go from here?
  17. Input: Pre-processing - Zero-centered X = X - np.mean(X, axis

    = 0) - Normalization X = X / np.std(X, axis = 0)
  18. In the wild : CNN from scratch (1/2) - Define

    architecture - Smart weight initialization (e.g. Xavier)
  19. First model : Transfer Learning Pre-trained model - Model built

    on a large dataset (eg: ImageNet) - Most libraries have model zoo - architecture with final trained weights
  20. Transfer Learning: Practicalities Less Data More Data Same Domain Retrain

    last classifier layer Fine tune last few layers Different Domain TROUBLE !! Fine tune a number of layers
  21. Less Data More Data Same Domain Retrain last classifier layer

    Fine tune last few layers Different Domain TROUBLE !! Fine tune a number of layers Pre-trained models: Initial results We started here! Using pre-trained models - achieved 88% accuracy. < 10 min train time
  22. Outline for today... 1. Why deep learning now? 2. How

    to adopt a practical approach? a. Learning b. Data c. Tools & Deploy 3. Where do you go from here?
  23. Data: Augmentation - Horizontal/Vertical Flips - Scale - Random cropping

    - Jitter Any combination(s) of: - Translation - Rotation - Stretching - Shearing - Lens distortion
  24. Generation: Why? - Need images in different conditions e.g. snow,

    rain, fog - Models and compute better than manually coding many possibilities
  25. Generation: Neural Style Transfer Content of an image fused with

    style of another image *This is illustrative. Not real output from the model(s)
  26. - Training takes a lot of time - More data

    - Complex model Training: Challenges
  27. Training: Model parallelization Need to synchronize for both forward pass

    and backward pass http://timdettmers.com/2014/10/09/deep-learning-data-parallelism/
  28. Outline for today... 1. Why deep learning now? 2. How

    to adopt a practical approach? a. Learning b. Data c. Tools & Deploy 3. Where do you go from here?
  29. Hardware: GPU (no brainer ) - Single GPU? - Cluster?

    - Cloud? - Build your own? It depends on the problem(s)
  30. Software: Computational Graph Static Model Architecture Defined Computational Graph compiled

    Model trained Dynamic Model Architecture Defined Computational Graph created for every run
  31. Software: Tensorflow Vs PyTorch Tensorflow: good for productionizing PyTorch: good

    for rapid prototyping of ideas Some pointers on making the choice: - Tensorflow does have eager execution and fold - but PyTorch is more Pythonic and quite popular with researchers - Horovod is quite good for distributed training on tensorflow - MXNet has distributed training at its core - but no widespread adoption yet
  32. Deploy: Production - Cloud (Rest API - Tensorflow Serving, Flask)

    - Edge (CoreML, Tensorflow Lite) - Browser (deeplearn.js / mxnet.js / keras.js)
  33. Deploy: Cloud vs Edge vs Browser - Easier to update

    on cloud - Faster prediction on edge - Energy consumption ! - Model size is HUGE! - Pruning - Quantization (typical: 8 bit) - SqueezeNet
  34. Outline for today... 1. Why deep learning now? 2. How

    to adopt a practical approach? a. Learning b. Data c. Tools & Deploy 3. Where do you go from here?
  35. Where do you go from here? - Learn deep learning:

    resource link - Practice, Practice, Practice! - Take iterative approach