0% found this document useful (0 votes)
8 views

HOG Project DOCUMENTATION

DOcumenation for feature detection of images using HOG
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views

HOG Project DOCUMENTATION

DOcumenation for feature detection of images using HOG
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 39

A CENTER FOR INTER-DISCIPLINARY RESEARCH

2022-23

TITLE

ENHANCING OBJECT RECOGNITION: A MACHINE


LEARNING APPROACH WITH HOG CLASSIFIER

SUPERVISED BY
HARSHITHA

GOKARAJU RANGARAJU
INSTITUTE OF ENGINEERING AND TECHNOLOGY
AUTONOMOUS
Advanced Academic Center
(A Centre for Inter-Disciplinary Research)

This is to certify that the project titled.

ENHANCING OBJECT RECOGNITION: A MACHINE


LEARNING APPROACH WITH HOG CLASSIFIER

is a Bonafide Work Carried Out by The Following Students in Partial Fulfilment of The
Requirements for Advanced Academic Centre Intern, Submitted to The Chair, AAC During the
Academic Year 2023-24.

NAME ROLL NO BRANCH

G JAIDEEP 22241A05Z9 CSE

P SPOORTHI 22241A67A7 CSDS

T SAI SAKET 22241A6755 CSDS

V SAMMITH 22241A12C6 IT

This Work Was Not Submitted OR Published Earlier for Any Study

Dr/Ms./Mr.

HARSHITHA Dr. B.R.K. Reddy Dr. Kiran Kumar Reddy


Project Supervisor Program Coordinator Associate Dean, AAC
ACKNOWLEDGEMENTS

We express our deep sense of gratitude to our respected Director, Gokaraju Rangaraju
Institute of Engineering and Technology, for the valuable guidance and for permitting us
to carry out this project.
With immense pleasure, we extend our appreciation to our respected Principal, for
permitting us to carry out this project.
We are thankful to the Associate Dean, Advanced Academic Centre, for providing us an
appropriate environment required for the project completion.
We are grateful to our project supervisor who spared valuable time to influence us with
their novel insights.
We are indebted to all the above mentioned people without whom we would not have
concluded the project.
CONTENTS:
 ABSTRACT
 INTRODUCTION
 LITERATURE REVIEW
 METHODOLOGY
I. Research Design
II. Materials and Instruments
III. Procedure
IV. Data Analysis
 RESULTS AND ANALYSIS
 UI AND UX
 CONLUSION
I. Use Cases
II. Enhancements
 REFERENCES
ABSTRACT
This research investigates the application of the Histogram of Oriented
Gradients (HOG) algorithm and Support Vector Machines (SVM) for gender
detection in humans and vehicle classification. The study begins by
examining the foundational principles of HOG and its integration with SVM,
emphasizing their combined potential in computer vision applications.

A comprehensive review of existing methodologies for gender detection in


humans using HOG and SVM is presented, addressing challenges such as
clothing variations and diverse poses. Additionally, the study explores the
application of HOG and SVM in the context of vehicle classification,
considering challenges posed by different vehicle types and occlusions.

The integration of HOG feature extraction with SVM classifiers is evaluated


as an effective approach for gender detection and vehicle classification. The
research aims to contribute insights into the capabilities and limitations of
this combined approach, shedding light on its practical implications for real-
world scenarios.

By synthesizing findings from gender detection in humans and vehicle


classification, this study provides a comprehensive understanding of the
HOG-SVM framework's performance. The research outcome seeks to
contribute valuable insights to the fields of gender detection and vehicle
classification, demonstrating the potential of HOG and SVM in tandem for
robust and accurate computer vision applications.
INTRODUCTION

WHAT IS HOG CLASSIFIER?


The Histogram of Oriented Gradients (HOG) classifier is a method
used in computer vision to detect patterns and shapes in images. It works by
looking at the directions of changes in color and brightness in small regions
of an image. These directions are then organized into histograms, providing a
way to describe the overall pattern of changes in each region. The HOG
classifier is often used to identify objects or features in images, and it's
commonly paired with a Support Vector Machine (SVM) for accurate
classification. Overall, HOG is a useful tool for analyzing the visual
characteristics of images and finding specific patterns.

MACHINE LEARNING AND HOG CLASSIFIER:


The partnership between the Histogram of Oriented Gradients
(HOG) classifier and machine learning is like a team working together on
picture puzzles. HOG acts like a detective, spotting interesting things in
pictures, like colors and shapes changing. Machine learning is the clever
friend that learns from what HOG finds and figures out what those things
are. They help us understand and find things in pictures, whether it's people,
cars, or anything else. The cool part is, you can teach them to focus on
specific things you're curious about. It's like having a team of digital
detectives for the visual world around us.
LITERATURE REVIEW
The use of Histogram of Oriented Gradients (HOG) classifiers has garnered
attention for its efficacy in computer vision applications, particularly in
gender detection for humans and vehicle identification. The HOG
algorithm, known for capturing shape and edge information, forms the
basis for object detection in these scenarios.
Gender Detection in Humans:
Research on gender detection using HOG has demonstrated
promising outcomes. Previous studies have implemented various
approaches, with methodologies addressing challenges like clothing
variations and lighting conditions. These investigations lay the groundwork
for understanding the nuances and complexities of gender detection in
human subjects.
Vehicle Identification:
In the realm of vehicle identification, HOG classifiers have been
applied successfully to discern different types of vehicles. Studies have
showcased the algorithm's ability to overcome challenges such as
occlusions and variations in vehicle types. These applications highlight the
adaptability of HOG in diverse contexts, contributing to the broader field of
object recognition.
METHODOLOGY
I. Research Design:
This project utilizes a mixed-methods approach to assess the effectiveness of a Histogram
of Oriented Gradients (HOG) classifier for gender detection in humans and vehicle type
identification. For gender detection, an experimental design involves a diverse human sample, with
random sampling to ensure representation. The HOG algorithm extracts features for quantitative
analysis. For vehicle identification, an observational design uses images of various vehicles,
employing convenience sampling. Qualitative analysis includes categorizing success and challenges.
Ethical considerations involve informed consent and privacy protection. Limitations include
potential variations in image quality and lighting conditions. This mixed-methods research design
aims for a comprehensive understanding of HOG classifier performance in both applications.

II. Materials and Instruments:


Datasets:
To train this model, we have used 500 to 1000 images for each category, which
allows us to get a better degree of accuracy.

SOFTWARE:
Python with machine learning libraries (e.g., scikit-learn, TensorFlow, or
PyTorch) and Tkinter for UI design.

HOG FEATURE EXTRACTION:


Histogram of Oriented Gradients (HOG) is a feature extraction method used in
computer vision. It involves dividing an image into cells, calculating gradients within each
cell, and creating histograms of gradient orientations. These histograms capture the
distribution of edges and shapes in the image. Blocks of histograms are then normalized to
account for variations in lighting. The final output is a feature vector representing the
spatial distribution of gradients. HOG is effective for object detection due to its robustness
to lighting changes and its ability to capture object shapes.
Support Vector Machines (SVM):
Support Vector Machines (SVM) enhance Histogram of Oriented Gradients (HOG) by
serving as the classifier. After HOG extracts distinctive features from images, SVM is trained to
distinguish between different classes (e.g., gender categories or vehicle types). SVM then
determines an optimal decision boundary in the HOG feature space, allowing accurate classification
of new data. This combination of HOG and SVM strengthens the model's ability to detect and
categorize objects based on their visual features.

III. PROCEDURE:
Data Collection:
Collect diverse labeled image datasets for gender and vehicle categories.

Preprocessing:
Standardize image sizes and apply normalization techniques for consistency.

HOG Feature Extraction:


Utilize the HOG algorithm to extract distinctive features from images.

SVM Model Training:


Train separate SVM models for gender and vehicle identification using the extracted
HOG features.

Evaluation:
Assess model performance using an independent test dataset, focusing on precision,
recall, and accuracy.

Integration:
Incorporate the trained models into the system for seamless gender and vehicle
identification.

Testing:
Conduct thorough testing with a diverse set of images to validate real-
world performance.
IV. Data Analysis:
Data analysis is the process of analysing and interpreting datasets while
summarizing their characteristics with the help of data visualization methods.
In determining the best possible ways to manipulate data resources to obtain required
interferences, making data easier to study and discover hidden trends, test a hypothesis and
check assumptions. Moreover, the method scrutinizes data to deliver:

1.Optimal interpretation into a dataset,


2. Unearth promising structures,
3. Identify outliers and anomalies,
4. Determine optimal factor settings,
5. Detect significant data variables

RESULTS AND ANALYSIS:


Here we present the outcomes and analysis of our study leveraging the Histogram of
Oriented Gradients (HOG) feature extraction technique combined with Support Vector Machines
(SVM) for gender detection and vehicle type identification. The following subsections provide a
comprehensive overview of the performance metrics, key findings, and insights gained from our
approach.

Recap of Objectives:
As outlined in the research objectives, our primary aim was to develop a robust model
capable of accurately classifying gender in humans and identifying different vehicle types. The
integration of HOG feature extraction with SVM modelling was chosen for its effectiveness in
capturing intricate patterns and relationships within image data.

Overview of Methods:
A concise recapitulation of our methodology includes the collection of diverse labelled
datasets, preprocessing of images, extraction of HOG features, and the subsequent training of SVM
models for both gender and vehicle classification.
HOG IMAGES:
These are the histogram of oriented gradients pictures of humans and
vehicles.
Hog image of an airplane

Hog image of a Bike


Hog image of a Bus

Hog image of a Car


Hog image of a Ship

Hog image of a Submarine


Hog image of a Female

Hog image of a Male


CONFUSION MATRIX AND OUTPUT:
CONFUSION MATRIX:
A confusion matrix is a table used in classification to evaluate the performance
of a machine learning model. It summarizes the results of the classification process,
showing the number of true positive (TP), true negative (TN), false positive (FP), and
false negative (FN) predictions made by the model.

CONFUSION MATRIX FOR VECHILES


CONFUSION MATRIX FOR GENDER

The confusion matrix is a crucial tool in machine learning as it provides a detailed breakdown of
a model's performance by categorizing predictions into true positives, true negatives, false
positives, and false negatives. This allows for a nuanced evaluation of accuracy, identification of
different types of errors, calculation of various performance metrics, and insights into model
improvement, particularly in scenarios with imbalanced datasets. The confusion matrix aids in
decision-making and provides a comprehensive and easily understandable summary of model
results.
OUTPUT:

OUTPUT FOR VECHILES


IDENTIFICATION

OUTPUT FOR GENDER


RECONGNITION
UI AND UX:

The main page allows you


to choose a vehicle or
gender recognition.

Alternatively, you can


select a test image from
our library or upload your
own image here in this
page.
Additionally, you can see
the "help" option and the
"HOG images" option in
the main page. These are
the functions of these
options.
These pages display gender identification results that can be
done by two options: “Upload Image” and “Test Images”.
These pages display vehicle identification results that can be
done by two options: “Upload Image” and “Test Images”.
CODE:
Importing required modules

Hog feature’s function

Getting folder paths


Function to load names in folder

Function to load images

Function to get hog features of an image


Getting images

Getting datasets ready


Giving negative values

Vehicles dataset
Gender dataset

Training svm
Output
CONLUSION:
Use Cases:
Human Detection:
Detecting humans in images or videos for surveillance and security
applications.
Pedestrian Detection in Autonomous Vehicles:
Identifying pedestrians in real-time to enhance safety features in
autonomous vehicles.
Face Detection:
Locating and recognizing faces in images for applications like facial
recognition.
Vehicle Detection:
Detecting vehicles in images or videos, useful in traffic monitoring and
parking management.
Gesture Recognition:
Recognizing hand gestures for hands-free interaction with devices and
systems.
Object Detection in Robotics:
Identifying and navigating around objects in a robot's environment.
Quality Control in Manufacturing:
Inspecting and identifying defects in products during the manufacturing
process.
Medical Image Analysis:
Detecting tumours in medical images for diagnostic purposes.
Wildlife Monitoring:
Monitoring and tracking animals in their natural habitats for
conservation efforts.
Intrusion Detection in Security Systems:
Detecting intruders or unauthorized individuals in secured areas.
Fingerprint Recognition:
Using HOG for recognizing unique patterns in fingerprints for
biometric identification.
Text Recognition in Images:
Applying HOG for recognizing text in images, contributing to Optical
Character Recognition (OCR) systems
ENHANCEMENTS:
o Parameter Tuning
o Multiple Resolutions
o Contextual Information
o Adaptive Learning Rates
o Online Learning
o Parallelization
o Augmentation Strategies
o Dynamic Parameter Adaptation
o User Feedback Integration

Finally, integrating the Histogram of Oriented Gradients (HOG) feature extraction


technique with Support Vector Machines (SVM) has proved to be a robust approach for
detecting gender in humans and identifying vehicle types. The accuracy and effectiveness
of our HOG-based models were demonstrated through systematic analysis of diverse
datasets. Model performance was analysed using visualizations such as confusion matrices
and precision-recall curves. Although this study was successful in identifying vehicle type
and gender, it also identified potential areas for further study and enhancement. Future
investigation should focus on the interpretability of HOG features, the fine-tuning of SVM
parameters, and considerations for real-world application scenarios. In summary, the HOG
classifier offers a balance between simplicity and effectiveness in capturing intricate
patterns within visual data for image-based classification tasks.
REFERENCES:
I. https://www.analyticsvidhya.com/blog/2019/09/feature-engineering-images-
introduction-hog-feature-
descriptor/#:~:text=A%20HOG%20(Histogram%20of%20Oriented,learning%20
models%20to%20recognize%20objects
II. https://medium.com/@dnemutlu/hog-feature-descriptor-263313c3b40d
[HOG]
III. https://www.kaggle.com/datasets/ashishjangra27/gender-recognition-200k-
images-celeba [GENDER]
IV. https://www.kaggle.com/datasets/prondeau/the-car-connection-picture-
dataset [DATASETS FOR CAR]
V. https://www.kaggle.com/datasets/ayushjain001/bike-dataset [BIKE]
VI. https://www.kaggle.com/datasets/mrtontrnok/5-vehichles-for-multicategory-
classification [BUS]
VII. https://images.cv/dataset/submarine-image-classification-dataset
[SUBMARINE]
VIII. https://www.kaggle.com/datasets/swaroopkml/cifar10-pngs-in-folders
[AIRPLANE]
IX. https://www.kaggle.com/datasets/vinayakshanawad/ships-dataset [SHIPS]

You might also like