Skip to content

Latest commit

 

History

History
89 lines (70 loc) · 4.93 KB

Lesson2.md

File metadata and controls

89 lines (70 loc) · 4.93 KB

Deep Learning

Lesson 2

What is Image Classification?

Image classification is the process of categorizing and labeling groups of pixels or vectors within an image based on specific rules. For a computer, an image is represented as one large 3-dimensional array of numbers.


  • In this example, the cat image is 248 pixels wide, 400 pixels tall, and has three color channels Red,Green,Blue.
  • Therefore, the image consists of 248 x 400 x 3 numbers, or a total of 297,600 numbers.
  • Each number is an integer that ranges from 0 (black) to 255 (white).
  • The task of a machine learning algorithm is to turn this quarter of a million numbers into a single label, such as “cat”.

Challenges in Image Classification

Some of the challenges that that arise during image classification from a perspective of Computer Vision are as follows:

  • Viewpoint Variation: An image can be viewed from many different perspective as the orientation of an object may differ with respect to the camera.


  • Deformation: The shape of an object may be deformed in many different ways.


  • Illumination: The object may have variation in illumination conditions causing the pixels to change drastically.


  • Occlusion: Sometimes the object may only be partially visible in the image.


  • Background Clutter: The objects of interest may blend into their environment, making them hard to identify.


Data Driven Aprroach

So to fix the above problems, we’re going to provide the computer with many examples of each class and then develop learning algorithms that look at these examples and learn about the visual appearance of each class.


Nearest Neighbor Classifier

Nearest Neighbor Classifier is a simple machine learning approach which allows us to get an idea about the basic approach to an image classification problem.The nearest neighbor classifier will take a test image, compare it to every single one of the training images, and predict the label of the closest training image.


K-Nearest Neighbor Classifier

Instead of finding the single closest image in the training set, we will find the top k closest images, and have them vote on the label of the test image. In particular, when k = 1, we recover the Nearest Neighbor classifier.


Validation sets for Hyperparameter Tuning

In the K-Nearest Neighbor Classifier, we have to choose the best value of k. But how do we do that? One way is to use hit and trail method for many values of k and see what value fits best. Since the test data should only be used near the end, we should use a validation dataset to find out the best hyperparameters for the machine learning model.The validation data can be obtained by reducing the training dataset size inton a smaller one and using the remaining as validation dataset.


Cross Validation

In cases where the size of your training data (and therefore also the validation data) might be small, people sometimes use a more sophisticated technique for hyperparameter tuning called cross-validation.