Pedestrian Recognition

21
Image Processing and Pattern Recognition Task: Pedestrian classification using Bayesian Classifier 04/26/2022 Image Processing and Pattern Recognition 1 Anilil Ashwin Nair, Gurucharan Srinivas, Mustafa Dilbaz Master Information Communication System 3 Semester Under Guidance of : Prof. Dr. Gerd Wanielik Dipl.-Ing. André Welzel

Transcript of Pedestrian Recognition

Page 1: Pedestrian Recognition

05/01/2023 Image Processing and Pattern Recognition 1

Image Processing and Pattern Recognition

Task: Pedestrian classification using Bayesian Classifier

Anilil Ashwin Nair, Gurucharan Srinivas, Mustafa Dilbaz

Master Information Communication System 3 Semester

Under Guidance of :Prof. Dr. Gerd WanielikDipl.-Ing. André Welzel

Page 2: Pedestrian Recognition

05/01/2023 Image Processing and Pattern Recognition 2

Overview: Pedestrian Detection using Classifier.

Classifier we use here is Bayesian Classifier. Method 1: Using particular pixel and its Grey Value as feature

and based on its probability distribution , we classify the images as pedestrian and non-pedestrians.

Method 2: Using HOG of the image as the feature and based on its probability distribution ,we classify the image as pedestrian and non-pedestrian.

Page 3: Pedestrian Recognition

05/01/2023 Image Processing and Pattern Recognition 3

Method 1: Using Pixel and its Grey value as the feature vector and classifying it into pedestrian or non-pedestrian class.

Our images are 36*18=648 pixels.

Each Pixel’s intensity can vary from 0-255 range.

Now we should train the classifier using these intensity of each pixel, for every pixel and every image in the training set

NOW HOW DO WE DO THAT.

Page 4: Pedestrian Recognition

05/01/2023 Image Processing and Pattern Recognition 4

Training the Classifier for Pedestrian Images and Non-Pedestrian Images.

Class Pedestrian

• Pixel[0] = Intensity distribution for Pixel[0]• Pixel[1] = Intensity distribution for Pixel[1]• Pixel[2] = Intensity distribution for Pixel[2]• Pixel[3] = Intensity distribution for Pixel[3]• • • • • • Pixel[647] = Intensity distribution for Pixel[]

Class Non-Pedestrian

• Pixel[0] = Intensity distribution for Pixel[0]• Pixel[1] = Intensity distribution for Pixel[1]• Pixel[2] = Intensity distribution for Pixel[2]• Pixel[3] = Intensity distribution for Pixel[3]• • • • • • Pixel[647] = Intensity distribution for Pixel[]

Pixel[X] =

0 255Intensity distribution of particular pixel[X]

Page 5: Pedestrian Recognition

05/01/2023 Image Processing and Pattern Recognition 5

How to select Feature vector?

Calculating Mean for each class.

Mean for Ped-Class Mean for NonPed-Class

Using the Class means I calculate the Pixel’s having maximum standard deviation .

These Pixels having the standard deviation are selected as feature vector.(In our case we have selected 6 Pixels as Feature vectors)

Page 6: Pedestrian Recognition

05/01/2023 Image Processing and Pattern Recognition 6

How to classify the Test Image into Pedestrian class or Non-Pedestrian class?

Now we know which pixels are to be selected as the feature vector. We select particular pixel along there intensities from the Test Image. Let Pixel[0]=78 and Pixel[354]=128 are feature vectors.

Pixel[0]

Pixel[354]

0 255

Ped Non-Ped

Pixel[0] 0.054 0.032

Pixel[354] 0.033 0.012

Page 7: Pedestrian Recognition

05/01/2023 Image Processing and Pattern Recognition 7

Probability for Pedestrian Class= 0.054*0.033=0.0017

Probability for Non-Pedestrian Class= 0.032*0.012= 0.00038

Prediction

If (Ped_Probabilty > Non_Ped_Probability){Class Pedestrian}Else If (Ped_Probabilty <= Non_Ped_Probability){Class Non-Pedestrian}

Page 8: Pedestrian Recognition

05/01/2023 Image Processing and Pattern Recognition 8

Experimental Results for Our Case

Grey values alone as a feature is not enough. Hence we should use better properties of a image as Features(like HOG…)

Page 9: Pedestrian Recognition

05/01/2023 Image Processing and Pattern Recognition 9

Method2: Histogram Of Oriented Gradients

Why another Feature ? Why not use pixel values as a Feature?

• Due to changes in lighting conditions The Accuracy of of Pixel low.

• Changes in clothing or poses from training set.• Global descriptor for the complete body.• Non-interpretable.

Page 10: Pedestrian Recognition

05/01/2023 Image Processing and Pattern Recognition 10

• Gradient magnitude is affected by illumination changes but Direction isn’t.• Avoid hard decisions compared to edge based feature.• Histogram of Oriented Gradient descriptor assumes that the local

object appearance and shape within an image can be described by the distribution of intensity gradients or edge directions.

• Since it operates on localized cells, it shows invariance to geometric and photometric transformations such changes (the would only appear in larger spatial regions).

• As HOG uses the general structure of an object to classify it permits the individual body movement of pedestrians to be ignored so long as they maintain a roughly upright position.

Why Histogram of Oriented Gradients?

Page 11: Pedestrian Recognition

05/01/2023 Image Processing and Pattern Recognition 11

How to Get HOG Descriptors from an Image ?

• The implementation of these descriptors can be achieved by dividing the image into small connected regions (cells), and for each cell computing a histogram of gradient directions (i.e. edge orientations) for the pixels within the cell. The combination of these histograms then represents the descriptor.

• Firstly Find the X and Y gradients of the image using a Sobel or other masks. For e.g.:- [1,0,-1] & [1,0,-1]T• Calculate the angle and intensities of the images for angle Arctan can be used

and √(x^2)+(y^2) used to calculate intensity's

Input image X Gradient Y Gradient

Page 12: Pedestrian Recognition

05/01/2023 Image Processing and Pattern Recognition 12

Each cell has 6x6 elements.Each with Gradient and Angle.The Angles have to be binned into 1-9.(20o Each)And normalized gradient 1-20. (0.05 Each)

2 5 7 5 3 39 7 4 3 8 0

6 4 3 7 9 6

3 6 8 9 5 8

7 8 4 5 8 4

2 1 4 3 3 8

After Binning Angle After Binning Gradient

11 5 14 2 14 1

1 3 15 12 3 17

15 12 1 5 9 6

3 18 8 9 11 8

7 8 18 5 8 10

2 1 4 3 3 8

Page 13: Pedestrian Recognition

05/01/2023 Image Processing and Pattern Recognition 13

After Creating The HOG for all cells If Visualized would look like this

Note: Visualization not built from our functions

Page 14: Pedestrian Recognition

05/01/2023 Image Processing and Pattern Recognition 14

How to decide if given image is a Pedestrian or not ?

• A bin of a Particular Cell can be selected as a feature. • For e.g.: The figure below shows Cell3_bin1(0-20o)• Where the Normalized Gradient is distributed across bins 1-20 of 0.05 each.

Page 15: Pedestrian Recognition

05/01/2023 Image Processing and Pattern Recognition 15

As each image is 18x36 =648 pixels. And each Cell is 6x6=36 pixels We have 6x3= 18 Cells in total. Each Cell has 9 bins of 20o

Hence we have 18x9 =162 Possible Features per Image

• Cell1_bin1 = Gradient distribution over 1-20• Cell1_bin2 = Gradient distribution over 1-20• Cell1_bin3 = Gradient distribution over 1-20• Cell1_bin4 = Gradient distribution over 1-20• • Cell1_bin9 = Gradient distribution over 1-20• • • • Cell18_bin9 = Gradient distribution over 1-20

Page 16: Pedestrian Recognition

05/01/2023 Image Processing and Pattern Recognition 16

• Using the given Training datasets of Pedestrian and non Pedestrian images.• Calculate the HOG descriptor for all the training images.• Calculate the Hog features of the test image• Check the Feature selected as feature vector in both the class databases

and find the probability of the value of the feature in both classes and multiply the probability's of all selected feature vectors.

Selecting The Feature Vector:• Selection of Features was made looking into Weka and we Had shortlisted

a few with good Standard Deviations.• Later we had Selected 6 Best Features as Feature Vectors by Trial and error.

Page 17: Pedestrian Recognition

05/01/2023 Image Processing and Pattern Recognition 17

Now we know the feature vector. We select particular Cell and Bin from the Test Image. For e.g. : Cell7_bin3=4 and Cell4_bin6=2 are feature vectors.

Cell7_bin3=

Cell4_bin6=

Ped Non-Ped

Cell7_bin3

0.034 0.062

Cell4_bin6

0.033 0.0012

Page 18: Pedestrian Recognition

05/01/2023 Image Processing and Pattern Recognition 18

Prediction

Probability for Pedestrian Class= 0.034*0.033=0.001122

Probability for Non-Pedestrian Class= 0.062*0.0012= 0.000074

As previously Stated The greater Value would be the class of the test image.In this case it would be Pedestrian.

Page 19: Pedestrian Recognition

05/01/2023 Image Processing and Pattern Recognition 19

Experimental Results for Our Case

The outcome of both the tests conducted shows that the HOG descriptor is a better and more reliable.

Page 20: Pedestrian Recognition

05/01/2023 Image Processing and Pattern Recognition 20

Questions?

Page 21: Pedestrian Recognition

05/01/2023 Image Processing and Pattern Recognition 21

Thank you