surveys of image

Post on 23-Jan-2018

84 Views

Category:

Documents

2 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Surveys of Image Recognition Algorithms

Local Binary Pattern with Sci-kit

Local Binary Patterns, or LBPs for short, are a texture descriptor made popular by the work of Ojala.

If the current pixel value is greater or equal to the neighboring pixel value, the corresponding bit in the binary array is set to 1 else if the current pixel value is less than the neighboring pixel value, the corresponding bit in the binary array is set to 0.

LBP Descriptor

Working on Images

Example 1

Example 2

Working Steps

1. Load the color image.

2. Convert to grayscale image.

3. Calculate the LBP mask.

4. Calculate the LBP Histogram and normalize it.

Where it is used?

Haar Classifier + OpenCV

Object Detection using Haar feature-based cascade classifiers is an effective object detection method proposed by Paul Viola and Michael Jones in their paper, "Rapid Object Detection using a Boosted Cascade of Simple Features" in 2001.

Initially, the algorithm needs a lot of positive images (images of faces) and negative images (images without faces) to train the classifier. Then we need to extract features from it.

Methods

Three tools to use – “createsamples”, “haartraining” and “performance”

CreateSamples

Tool from OpenCV to automate creation of training samples

Four functionalities

1. create training samples from one image applying distortions.

2. create training samples from a collection of images, without distortions.

3. create testing samples with ground truth from one image applying distortions.

4. show images from the .vec internal format which contains a collection of samples.

Best to use a combination of the functionalities to create many samples from many images with distortions and merge them.

Images

Positive Images:

Negative Images

Sample Images

Query and Parameters

For positive image creation:

perl bin/createsamples.pl positives.txt negatives.txt samples 1500\ "opencv_createsamples

-bgcolor 0 -bgthresh 0 -maxxangle 1.1\ -maxyangle 1.1 maxzangle 0.5 -maxidev 40 -w 80

-h 40 ”

To start the testing:opencv_traincascade -data classifier -vec samples.vec -bg negatives.txt\ -numStages 20

–minHitRate 0.999 -maxFalseAlarmRate 0.5 -numPos 1000\ -numNeg 600 -w 80 -h 40

mode ALL -precalcValBufSize 1024\ -precalcIdxBufSize 1024

The software that performs the viola-jones algorithm and creates the cascade file

Sample run:

opencv_traincascade -data classifier -vec samples.vec -bg negatives.txt\

-numStages 20 -minHitRate 0.999 -maxFalseAlarmRate 0.5 -numPos 1000\

-numNeg 600 -w 80 -h 40 -mode ALL -precalcValBufSize 1024

“data” is the directory in which to store the output

“vec” is the .vec file containing the positive images

“bg” is a text file with a collection of paths to background (negative) images

“nstages” is the number of stages of boosting

“minhitrate” and “maxfalsealarm” are cutoff values for hit rate and false alarm, per stage

“npos” and “nneg” are the number of positive and negative images to be used from the given sets

“w” and “h” are the width and the height of the sample

“precalcValBufSize” buffer size to store the feature values

Advantages & Disadvantages

Advantages:

1. Easy to implement once classifier is ready.

Disadvantages:

1. Does not detect for all the images.

2. Training the classifier takes time.

3. Needs a lot of training data.

Tensorflow

Tensorflow is Google's open source deep learning library.

We will load the Inception-v3 model to generate descriptive labels for an image.

The Inception model is a deep convolutional neural network and was trained on the ImageNet dataset, where the task was to classify images into 1000 classes.

Build Training

Place the directory with all the images in respective folder.

Give path of the directory while starting the training.

bazel build tensorflow/examples/image_retraining:retrain

bazel-bin/tensorflow/examples/image_retraining/retrain --image_dir ~/fruits

Advantages & Disadvantages

ADVANTAGES

1. Pre-trained classifier can be used.

2. Training on our classes doesn't take much time.

3. Has a good accuracy rate.

4. Can be trained with any variations of the image.

DISADVANTAGES

1. Image detection may go wrong with Inception.

2. Single class cannot be trained.

THANK YOU

top related