Object Counting and RNN

0
90

Object Detection and Tracking

In this tutorial you will learn how to build a “people counter” with OpenCV and Python. Using OpenCV, we’ll count the number of people who are heading “Down” or “Up” in real-time.

In order to build our people counting applications, we’ll need a number of different Python libraries, including:

There are some fundamental differences between Object tracking and object detection. We can detect any number of objects in a given frame. These objects can be labelled as the classes given for classification but tracking that object is a different task.

Tracking of an object include these things:

  • Object tracker will be given (x,y) coordinates of every object.
  • Tracker will allocate unique ID to that object.
  • Then track the Object as it moves. It can be done by predicting the next location of an object using its attribute.

Combination of Detection and Tracking

Now simply you can do these two things combine. You first detect Objects and give the location array of all objects. Using these Locations and classes detected by detection tracker part of program can predict the next location of the object.

Object detection can be done using Haar-cascades. I have used MobileNetSSD Object Detection algorithm to detect objects.

Object Tracking algorithms which are popular like MedianFlow, MOSSE, GOTURN, kernalized correlation filters can be used.

Steps need to be followed for Object counting:

  1. We take the object bounding boxes obtained from object detection algorithms and compute centroids of all objects.
  2. If any new Object comes in the new frame of same class then we must compute euclidean distance between new locations to detect if the object is itself moving or some new objects detected.
  3. If new object is detected then register new ID of new object.

Recurrent Neural Networks

Recurrent Neural Networks (RNN) are the type of neural network which is having an additional thing associated with it. That additional thing is Feedback. In RNNs every neuron is given some feedback from the memory element. These memory element is filled with previous experience. Let us understand it in brief.

NOTE: This method can be used in Object tracking as it takes feedback also.

Image result for rnn

Diagram shown above is the simple view of RNN. Loop type arrow is a feedback to neural network from past experience.

FEED FORWARD RNNs

Now, the question is How we can train these Models. It can be trained in feed forward style. We know that in feed forward neural network every input is given some weights. Similarly, here, feedback is stored in some memory element and then with some weights feedback is also feeded to the neural network with some weights.

BACK PROPAGATION IN RNNs

Similarly, to feedforward neural networks, we have to improve the weights of neural network for better results. When we back propagate we improve weights of input as well as feedback.

Related image
Simple Recurrent Neural Network with memory element

Above RNN network is having input nodes which will be given inputs and some recurrent nodes having memory of previous experience. These whole data is feed to RNN with some weights and then through back propagation we can have better values of weights.

Conclusion

RNN are widely using application and giving better results. Some of the uses of RNN are Tracking of object, Speech Recognition, Machine Translation.