Object will classify to positive and negative. We

Object detection :

Object
detection is commonly referred to as a method that is responsible for
discovering and identifying the existence of objects of a certain class. An
extension of this can be considered as a method of image processing to identify
objects from digital images or videos.

We Will Write a Custom Essay Specifically
For You For Only $13.90/page!


order now

 

Haar-like Feature detection:

 

We use a algorithm that tracks down animals in the wildlife. The
detection algorithm is based on human face detection algorithm which detects
faces using Haar like features and Adaboost. Haar-like features are digital
image featuress used in object recognition. They
owe their name to their intuitive similarity with Haar wavelets and were used
in the first real-time face detector. This detection system for animals is based upon an
approach for human upright facial detection introduced by Viola and Jones. This
algorithm consists of four main steps:

1)Haar
features

2)Integral
image

3)Adaboost

4)Cascading

                 

The algorithm needs a lot of positive pictures and negative pictures to
train the classifier. For this, Haar features shown in above images are used.

Each feature is a single value obtained by subtracting sum of pixels under
white rectangle from sum of pixels under black rectangle. We apply each and every feature on
all the training images. For each feature, it finds the best threshold which
will classify to positive and negative. We
select the features with minimum error rate. Haar features are calculated all over the image
which will has many features per image. Summing up the entire image pixel and
then subtracting them to get a single value is not efficient in real time
applications. This can be reduced by using Ada boost classifier. Ada boost
reduces the redundant features. Here instead of summing up all the pixels the
integral image is used. One of the contributions of Viola
and Jones was to use summed area tables which they called  Integral images
.Thsi can be defined as two-dimensional looked up tables in the form of a matrix with the same size of the original
image. Adaboost classifies relevant features and irrelevant
features. After identifying relevant features and irrelevant features the
Adaboost assigns a weight to all of them. It constructs a strong classifier as
a linear combination of Weak classifiers.

 

One of the contributions of Viola and Jones was to
us summed area tables, which they called integral images. Integral images can be defined as
two-dimensional lookup tables in the form
of a matrix with the same size of the original image. Each element of the integral
image contains the sum of all pixels located on the up-left region of the
original image (in relation to the element’s position). This allows to compute
sum of rectangular areas in the image, at any position or scale, using only
four lookups:

                                          sum=I(C)+I(A)-I(B)-I(D)

 

where points {displaystyle A,B,C,D}A,B,C,D belong to the integral
image {displaystyle I}I.

Each Haar-like feature may need more than four
lookups, depending on how it was defined. Viola and Jones’s 2-rectangle
features need six lookups, 3-rectangle features need eight lookups, and
4-rectangle features need nine lookups.

 

The cascade classifier consists
of a list of stages, where each stage consists of a list of weak learners. The
system detects objects in question by moving a window over the image. Each
stage of the classifier labels the specific region defined by the current
location of the window as either positive or negative – positive meaning that
an object was found or negative means that the specified object was not found in
the image. If the labelling yields a negative result, then the classification
of this specific region is hereby complete and the location of the window is
moved to the next location. If the labelling gives a positive result, then the
region moves of to the next stage of classification. The classifier yields a
final verdict of positive, when all the stages, including the last one, yield a
result, saying that the object is found in the image. A true positive means
that the object in question is indeed in the image and the classifier labels it
as such – a positive result. A false positive means that the labelling process
falsely determines, that the object is located in the image, although it is
not. A false negative occurs when the classifier is unable to detect the actual
object from the image and a true negative means that a non-object was correctly
classifier as not being the object in question. In order to work well, each
stage of the cascade must have a low false negative rate, because if the actual
object is classified as a non-object, then the classification of that branch
stops, with no way to correct the mistake made. However, each stage can have a
relatively high false positive rate, because even if the nth stage classifies
the non-object as actually being the object, then this mistake can be fixed in
n+1-th and subsequent stages of the classifier.

 

 

                                                           Stages of the cascade classifier

 

 

 

This strong classifier is used to
create a cascading sheet which consists of all the mathematical calculations
required to detect the targeted animals from the given training dataset. This
cascading sheet is in a XML format which is used by opencv to detect animals in
real time. By this algorithm we can detect the species of the animal by the
trained dataset eliminating physical human power. This algorithm detects the
colour and shape of the targeted animal. This does not give a perfect detection
rate but this could be improved by providing images that are taken of the
subject in different scenarios which is not present in the training dataset.

This helps
to detect the targeted animal by capturing frames from the camera module when
the IR sensor is disrupted.

 

 

 

 

Deers are detected using the
trained data through

OpenCv and Python

 

 

 

 

 

 

 

 

 

 

 

 

 

2)K-nearest neighbors algorithm
for classification of animals:

                     The K-nearest neighbors algorithm is a versatile classifier that
is often used as a benchmark for more complex classifiers such as Artificial
Neural Networks and Support Vector Machines. KNN can be more powerful
classifier and can be used in a variety of applications such as economic
forecasting, data compression and genetics.

                              It comes
under supervised learning of algorithms. This means that we are given a
labelled dataset consiting of training observations (x,y)(x,y) and would like
to capture the relationship between xx and yy. More formally, our goal is to
learn a function h:X?Yh:X?Y so that given an
unseen observation xx, h(x)h(x) can confidently predict the corresponding
output yy. This consist of two learning algorithms namely:

1)Non-parametric

2)Instance
based

·             
Non-parametric
means it makes no explicit assumptions about the functional form of h, avoiding
the dangers of mismodeling the underlying distribution of the data. For
example, suppose our data is highly non-Gaussian but the learning model we
choose assumes a Gaussian form. In that case, our algorithm would make
extremely poor predictions.

·             
Instance-based
learning means that our algorithm doesn’t explicitly learn a model. Instead, it
chooses to memorize the training instances which are subsequently used as
“knowledge” for the prediction phase. Concretely, this means that only when a
query to our database is made (i.e. when we ask it to predict a label given an
input), will the algorithm use the training instances to spit out an answer.

 

                                                                        Euclidean
Distance Formula

 

The K-nearest neighbour forms a majority between the K most similar
instances to a given “unseen” observation. Similarity is defined according to a
distance metric between two data points.This algorithm uses Euclidean
distance formula to calculate the nearest neighbors around our target. The K
value should be larger to classify the object more effectively.The algorithm for computing the
K-nearest neighbors is as follows:

·             
First determine the parameter K where K is the nearest number of
neighbors

·             
Calculate the distance between the query-instance and all the training
samples. For distance estimation, Euclidean distance method is used.

·             
Sort the distance for all the training samples and determine the nearest
neighbor based on the K-th minimum distance.

·             
Get all the categories of the training data for the sorted value which
falls under K.

·             
Use the majority of nearest neighbors as the prediction value

 

                                                                                                     

 

                                                                                                                                                KNN
classification plot

 

 

 

 

 

This algorithm is used to classify our targeted animal to a species.

This can help to classify a animal depending upon its features such as its
color,hair,size,etc. Generally the Haar algorithm can only detect the shape and
colour of the targeted object. A wild cat with leopard spots can be detected as
a leopard. To overcome this problem we will be K-nearest neighbors algorithm
for classification of animals. This cascade classifier consists of the
classified classes of the required animals to detect the species.

 

 

 

 

 

Controller:

 

A controller is nothing but the user interface between the user and the
module. The role of the controller is to access the module and control it
remotely. The modules controller provides many functionalities to improve the
interface and help the user. A list of animals are given in a tabular form so
that the module could detect the only specified animals. This is done through
server-client approach. The instructions are passed down to the module when
specific animals are selected from the given one. It does not only send the
information but also receives information from the RPI module. Various data is
sent to and fro from the controller and the module. The controller has
functionality to broadcast live videos from the module to monitor the targeted
animals actions too. This creates a modular system that could be accessed and
controlled remotely.

The functionalities of the controller include:

1.          
Displaying various options to the user

2.          
Alerts users when the target is detected or if there
is a fire.

3.          
Displaying the live video broadcast

4.          
Data Visualization

5.          
Video Storage

6.          
Controlling the module

7.          
Status of the module

The Controller is developed with the help of python using tkinter for
the interface. This is a toolkit for Python which helps in GUI programming.

This is the most commonly used for developing programmable interfaces for the
user. This also uses many packages such as sockets,smtp,etc for connecting and
controlling the module. Creating the tkinter GUI application involes the
following steps:

1.          
Import Tkinter module

2.          
Create the required window for GUI

3.          
Add the required widgets to the application

4.          
Assign main event loop when a action triggers event

 

A  message is sent from the module
to the controller when the system detects a activity and alerts the user. The
user then could live stream and store activity recorded through the video
stored and broadcasted. The data obtained from the various algorithms is
collected and calculated to know the information about the animals in that
area. The data visualization is done through plotting graphs on the controller
by the program. The status of module can be displayed to  the user by the controller. The RPI module
acts as a server and the controller acts as a client in order to control the
module and to protect the user machine from external attacks when the module is
compromised.