2. 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.
9. 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.
10. 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.
13. 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
14. 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.
15. 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.
16. 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
17. 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.