surveys of image
TRANSCRIPT
![Page 1: Surveys of Image](https://reader030.vdocuments.mx/reader030/viewer/2022020302/587738071a28ab342e8b4f69/html5/thumbnails/1.jpg)
Surveys of Image Recognition Algorithms
![Page 2: Surveys of Image](https://reader030.vdocuments.mx/reader030/viewer/2022020302/587738071a28ab342e8b4f69/html5/thumbnails/2.jpg)
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.
![Page 3: Surveys of Image](https://reader030.vdocuments.mx/reader030/viewer/2022020302/587738071a28ab342e8b4f69/html5/thumbnails/3.jpg)
LBP Descriptor
![Page 4: Surveys of Image](https://reader030.vdocuments.mx/reader030/viewer/2022020302/587738071a28ab342e8b4f69/html5/thumbnails/4.jpg)
Working on Images
![Page 5: Surveys of Image](https://reader030.vdocuments.mx/reader030/viewer/2022020302/587738071a28ab342e8b4f69/html5/thumbnails/5.jpg)
Example 1
![Page 6: Surveys of Image](https://reader030.vdocuments.mx/reader030/viewer/2022020302/587738071a28ab342e8b4f69/html5/thumbnails/6.jpg)
Example 2
![Page 7: Surveys of Image](https://reader030.vdocuments.mx/reader030/viewer/2022020302/587738071a28ab342e8b4f69/html5/thumbnails/7.jpg)
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.
![Page 8: Surveys of Image](https://reader030.vdocuments.mx/reader030/viewer/2022020302/587738071a28ab342e8b4f69/html5/thumbnails/8.jpg)
Where it is used?
![Page 9: Surveys of Image](https://reader030.vdocuments.mx/reader030/viewer/2022020302/587738071a28ab342e8b4f69/html5/thumbnails/9.jpg)
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.
![Page 10: Surveys of Image](https://reader030.vdocuments.mx/reader030/viewer/2022020302/587738071a28ab342e8b4f69/html5/thumbnails/10.jpg)
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.
![Page 11: Surveys of Image](https://reader030.vdocuments.mx/reader030/viewer/2022020302/587738071a28ab342e8b4f69/html5/thumbnails/11.jpg)
Images
Positive Images:
Negative Images
Sample Images
![Page 12: Surveys of Image](https://reader030.vdocuments.mx/reader030/viewer/2022020302/587738071a28ab342e8b4f69/html5/thumbnails/12.jpg)
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
![Page 13: Surveys of Image](https://reader030.vdocuments.mx/reader030/viewer/2022020302/587738071a28ab342e8b4f69/html5/thumbnails/13.jpg)
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
![Page 14: Surveys of Image](https://reader030.vdocuments.mx/reader030/viewer/2022020302/587738071a28ab342e8b4f69/html5/thumbnails/14.jpg)
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.
![Page 15: Surveys of Image](https://reader030.vdocuments.mx/reader030/viewer/2022020302/587738071a28ab342e8b4f69/html5/thumbnails/15.jpg)
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.
![Page 16: Surveys of Image](https://reader030.vdocuments.mx/reader030/viewer/2022020302/587738071a28ab342e8b4f69/html5/thumbnails/16.jpg)
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
![Page 17: Surveys of Image](https://reader030.vdocuments.mx/reader030/viewer/2022020302/587738071a28ab342e8b4f69/html5/thumbnails/17.jpg)
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.
![Page 18: Surveys of Image](https://reader030.vdocuments.mx/reader030/viewer/2022020302/587738071a28ab342e8b4f69/html5/thumbnails/18.jpg)
THANK YOU