Example: bankruptcy

Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 2 ...

Fei-Fei Li & Justin Johnson & Serena YeungLecture 2 - April 6, 2017 Fei-Fei Li & Justin Johnson & Serena YeungLecture 2 - April 6, 20171 Fei-Fei Li & Justin Johnson & Serena YeungLecture 2 - April 6, 2017 Administrative: PiazzaFor questions about midterm, poster session, projects, use Piazza instead of staff list!SCPD students: Use your address to register for Piazza; contact for Li & Justin Johnson & Serena YeungLecture 2 - April 6, 2017 Administrative: Assignment 1 Out tonight, due 4/18 11:59pm-K-Nearest Neighbor-Linear classifiers: SVM, Softmax-Two-layer neural network-Image features3 Fei-Fei Li & Justin Johnson & Serena YeungLecture 2 - April 6, 2017 Administrative: Python + Numpy4 Fei-Fei Li & Justin Johnson & Serena YeungLecture 2 - April 6, 2017 Administrative: Google Cloud5 Fei-Fei Li & Justin Johnson & Serena YeungLecture 2 - April 6, 2017 Image Classification: A core task in Computer Vision6cat(assume given set of discrete labels){dog, cat, truck, plane.}

Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 2 - April 6, 2017 Administrative: Piazza For questions about midterm, poster session, projects,

Tags:

  Li amp justin johnson amp serena yeung lecture

Information

Domain:

Source:

Link to this page:

Please notify us if you found a problem with this document:

Other abuse

Transcription of Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 2 ...

1 Fei-Fei Li & Justin Johnson & Serena YeungLecture 2 - April 6, 2017 Fei-Fei Li & Justin Johnson & Serena YeungLecture 2 - April 6, 20171 Fei-Fei Li & Justin Johnson & Serena YeungLecture 2 - April 6, 2017 Administrative: PiazzaFor questions about midterm, poster session, projects, use Piazza instead of staff list!SCPD students: Use your address to register for Piazza; contact for Li & Justin Johnson & Serena YeungLecture 2 - April 6, 2017 Administrative: Assignment 1 Out tonight, due 4/18 11:59pm-K-Nearest Neighbor-Linear classifiers: SVM, Softmax-Two-layer neural network-Image features3 Fei-Fei Li & Justin Johnson & Serena YeungLecture 2 - April 6, 2017 Administrative: Python + Numpy4 Fei-Fei Li & Justin Johnson & Serena YeungLecture 2 - April 6, 2017 Administrative: Google Cloud5 Fei-Fei Li & Justin Johnson & Serena YeungLecture 2 - April 6, 2017 Image Classification: A core task in Computer Vision6cat(assume given set of discrete labels){dog, cat, truck, plane.}

2 }This image by Nikita is licensed under CC-BY Li & Justin Johnson & Serena YeungLecture 2 - April 6, 2017 This image by Nikita is licensed under CC-BY Problem: Semantic Gap7 What the computer seesAn image is just a big grid of numbers between [0, 255] 800 x 600 x 3(3 channels RGB) Fei-Fei Li & Justin Johnson & Serena YeungLecture 2 - April 6, 2017 Challenges: Viewpoint variation8 All pixels change when the camera moves!This image by Nikita is licensed under CC-BY Li & Justin Johnson & Serena YeungLecture 2 - April 6, 2017 Challenges: Illumination9 This image is CC0 public domainThis image is CC0 public domainThis image is CC0 public domainThis image is CC0 public domainFei-Fei Li & Justin Johnson & Serena YeungLecture 2 - April 6, 2017 Challenges: Deformation10 This image by Umberto Salvagnin is licensed under CC-BY image by Tom Thai is licensed under CC-BY This image by sare bear is licensed under CC-BY image by Umberto Salvagnin is licensed under CC-BY Li & Justin Johnson & Serena YeungLecture 2 - April 6, 2017 Challenges.

3 Occlusion11 This image is CC0 public domainThis image by jonsson is licensed under CC-BY image is CC0 public domainFei-Fei Li & Justin Johnson & Serena YeungLecture 2 - April 6, 201712 This image is CC0 public domainChallenges: Background ClutterThis image is CC0 public domainFei-Fei Li & Justin Johnson & Serena YeungLecture 2 - April 6, 2017 Challenges: Intraclass variation13 This image is CC0 public domainFei-Fei Li & Justin Johnson & Serena YeungLecture 2 - April 6, 2017An image classifier14 Unlike sorting a list of numbers, no obvious way to hard-code the algorithm for recognizing a cat, or other Li & Justin Johnson & Serena YeungLecture 2 - April 6, 2017 Attempts have been made15 John Canny, A Computational Approach to Edge Detection , IEEE TPAMI 1986 Find edgesFind corners? Fei-Fei Li & Justin Johnson & Serena YeungLecture 2 - April 6, 2017 Data-Driven a dataset of images and Machine Learning to train a the classifier on new imagesExample training setFei-Fei Li & Justin Johnson & Serena YeungLecture 2 - April 6, 2017 First classifier: Nearest Neighbor17 Memorize all data and labelsPredict the label of the most similar training imageFei-Fei Li & Justin Johnson & Serena YeungLecture 2 - April 6, 2017 Example Dataset: CIFAR1018 Alex Krizhevsky, Learning Multiple Layers of Features from Tiny Images , Technical Report, classes50,000 training images10,000 testing imagesFei-Fei Li & Justin Johnson & Serena YeungLecture 2 - April 6, 2017 Example Dataset.

4 CIFAR1019 Alex Krizhevsky, Learning Multiple Layers of Features from Tiny Images , Technical Report, classes50,000 training images10,000 testing imagesTest images and nearest neighborsFei-Fei Li & Justin Johnson & Serena YeungLecture 2 - April 6, 2017 Distance Metric to compare images20L1 distance:addFei-Fei Li & Justin Johnson & Serena YeungLecture 2 - April 6, 201721 Nearest Neighbor classifierFei-Fei Li & Justin Johnson & Serena YeungLecture 2 - April 6, 201722 Nearest Neighbor classifierMemorize training dataFei-Fei Li & Justin Johnson & Serena YeungLecture 2 - April 6, 201723 Nearest Neighbor classifierFor each test image: Find closest train image Predict label of nearest imageFei-Fei Li & Justin Johnson & Serena YeungLecture 2 - April 6, 201724 Nearest Neighbor classifierQ: With N examples, how fast are training and prediction? Fei-Fei Li & Justin Johnson & Serena YeungLecture 2 - April 6, 201725 Nearest Neighbor classifierQ: With N examples, how fast are training and prediction?

5 A: Train O(1), predict O(N) Fei-Fei Li & Justin Johnson & Serena YeungLecture 2 - April 6, 201726 Nearest Neighbor classifierQ: With N examples, how fast are training and prediction?A: Train O(1), predict O(N)This is bad: we want classifiers that are fast at prediction; slow for training is okFei-Fei Li & Justin Johnson & Serena YeungLecture 2 - April 6, 2017 What does this look like?27 Fei-Fei Li & Justin Johnson & Serena YeungLecture 2 - April 6, 2017K-Nearest Neighbors28 Instead of copying label from nearest neighbor, take majority vote from K closest pointsK = 1K = 3K = 5 Fei-Fei Li & Justin Johnson & Serena YeungLecture 2 - April 6, 201729 What does this look like? Fei-Fei Li & Justin Johnson & Serena YeungLecture 2 - April 6, 201730 What does this look like? Fei-Fei Li & Justin Johnson & Serena YeungLecture 2 - April 6, 2017K-Nearest Neighbors: Distance Metric31L1 (Manhattan) distanceL2 (Euclidean) distanceFei-Fei Li & Justin Johnson & Serena YeungLecture 2 - April 6, 2017K-Nearest Neighbors: Distance Metric32L1 (Manhattan) distanceL2 (Euclidean) distanceK = 1K = 1 Fei-Fei Li & Justin Johnson & Serena YeungLecture 2 - April 6, 2017K-Nearest Neighbors: Demo Time33 Fei-Fei Li & Justin Johnson & Serena YeungLecture 2 - April 6, 2017 Hyperparameters34 What is the best value of k to use?

6 What is the best distance to use?These are hyperparameters: choices about the algorithm that we set rather than learnFei-Fei Li & Justin Johnson & Serena YeungLecture 2 - April 6, 2017 Hyperparameters35 What is the best value of k to use?What is the best distance to use?These are hyperparameters: choices about the algorithm that we set rather than learnVery problem-dependent. Must try them all out and see what works Li & Justin Johnson & Serena YeungLecture 2 - April 6, 2017 Setting Hyperparameters36 Idea #1: Choose hyperparameters that work best on the dataYour DatasetFei-Fei Li & Justin Johnson & Serena YeungLecture 2 - April 6, 2017 Setting Hyperparameters37 Idea #1: Choose hyperparameters that work best on the dataBAD: K = 1 always works perfectly on training dataYour DatasetFei-Fei Li & Justin Johnson & Serena YeungLecture 2 - April 6, 2017 Setting Hyperparameters38 Idea #1: Choose hyperparameters that work best on the dataBAD: K = 1 always works perfectly on training dataIdea #2: Split data into train and test, choose hyperparameters that work best on test dataYour DatasettraintestFei-Fei Li & Justin Johnson & Serena YeungLecture 2 - April 6, 2017 Setting Hyperparameters39 Idea #1.

7 Choose hyperparameters that work best on the dataBAD: K = 1 always works perfectly on training dataIdea #2: Split data into train and test, choose hyperparameters that work best on test dataBAD: No idea how algorithm will perform on new dataYour DatasettraintestFei-Fei Li & Justin Johnson & Serena YeungLecture 2 - April 6, 2017 Setting Hyperparameters40 Idea #1: Choose hyperparameters that work best on the dataBAD: K = 1 always works perfectly on training dataIdea #2: Split data into train and test, choose hyperparameters that work best on test dataBAD: No idea how algorithm will perform on new dataYour DatasettraintestIdea #3: Split data into train, val, and test; choose hyperparameters on val and evaluate on testBetter!traintestvalidationFei-Fei Li & Justin Johnson & Serena YeungLecture 2 - April 6, 2017 Setting Hyperparameters41 Your Datasettestfold 1fold 2fold 3fold 4fold 5 Idea #4: Cross-Validation: Split data into folds, try each fold as validation and average the resultstestfold 1fold 2fold 3fold 4fold 5testfold 1fold 2fold 3fold 4fold 5 Useful for small datasets, but not used too frequently in deep learningFei-Fei Li & Justin Johnson & Serena YeungLecture 2 - April 6, 2017 Setting Hyperparameters42 Example of5-fold cross-validationfor the value of point: singleoutcome.

8 The line goesthrough the mean, barsindicated standarddeviation(Seems that k ~= 7 works bestfor this data) Fei-Fei Li & Justin Johnson & Serena YeungLecture 2 - April 6, 201743k-Nearest Neighbor on images never slow at test time-Distance metrics on pixels are not informative(all 3 images have same L2 distance to the one on the left)OriginalBoxedShiftedTintedOriginal image is CC0 public domainFei-Fei Li & Justin Johnson & Serena YeungLecture 2 - April 6, 201744k-Nearest Neighbor on images never of dimensionalityDimensions = 1 Points = 4 Dimensions = 3 Points = 43 Dimensions = 2 Points = 42 Fei-Fei Li & Justin Johnson & Serena YeungLecture 2 - April 6, 2017K-Nearest Neighbors: SummaryIn Image classification we start with a training set of images and labels, and must predict labels on the test setThe K-Nearest Neighbors classifier predicts labels based on nearest training examplesDistance metric and K are hyperparametersChoose hyperparameters using the validation set; only run on the test set once at the very end!

9 45 Fei-Fei Li & Justin Johnson & Serena YeungLecture 2 - April 6, 201746 Fei-Fei Li & Justin Johnson & Serena YeungLecture 2 - April 6, 201747 This image is CC0 public domainNeural NetworkLinear classifiersFei-Fei Li & Justin Johnson & Serena YeungLecture 2 - April 6, 201748 Man in black shirt is playing worker in orange safety vest is working on young girls are playing with lego is doing backflip on wakeboardKarpathy and Fei-Fei , Deep Visual-Semantic Alignments for Generating Image Descriptions , CVPR 2015 Figures copyright IEEE, 2015. Reproduced for educational Li & Justin Johnson & Serena YeungLecture 2 - April 6, 201749 Man in black shirt is playing worker in orange safety vest is working on young girls are playing with lego is doing backflip on wakeboardKarpathy and Fei-Fei , Deep Visual-Semantic Alignments for Generating Image Descriptions , CVPR 2015 Figures copyright IEEE, 2015.

10 Reproduced for educational Li & Justin Johnson & Serena YeungLecture 2 - April 6, 2017 Recall CIFAR105050,000 training images each image is 32x32x310,000 test Li & Justin Johnson & Serena YeungLecture 2 - April 6, 2017 Parametric Approach51 Imagef(x,W)10 numbers giving class scoresArray of 32x32x3 numbers(3072 numbers total)parametersor weightsWFei-Fei Li & Justin Johnson & Serena YeungLecture 2 - April 6, 2017 Parametric Approach: Linear Classifier52 Imageparametersor weightsWf(x,W)10 numbers giving class scoresArray of 32x32x3 numbers(3072 numbers total)f(x,W) = WxFei-Fei Li & Justin Johnson & Serena YeungLecture 2 - April 6, 2017 Parametric Approach: Linear Classifier53 Imageparametersor weightsWf(x,W)10 numbers giving class scoresArray of 32x32x3 numbers(3072 numbers total)f(x,W) = Wx10x110x30723072x1 Fei-Fei Li & Justin Johnson & Serena YeungLecture 2 - April 6, 2017 Parametric Approach: Linear Classifier54 Imageparametersor weightsWf(x,W)10 numbers giving class scoresArray of 32x32x3 numbers(3072 numbers total)f(x,W) = Wx + b3072x110x110x307210x1 Fei-Fei Li & Justin Johnson & Serena YeungLecture 2 - April 6, 201755 Example with an image with 4 pixels, and 3 classes (cat/dog/ship) image5623124256231242 Stretch pixels into + scoreDog scoreShip scoreFei-Fei Li & Justin Johnson & Serena YeungLecture 2 - April 6, 2017 Interpreting a Linear Classifier56 What is this thing doing?


Related search queries