Showing posts with label 2015. Show all posts
Showing posts with label 2015. Show all posts

Friday, 27 March 2015

Kalman away

Well took long enough but I have a Kalman filter working. Thanks to help and code from my dissertation supervisor Hannah Dee. I have managed to tweak her code that uses Kalman2d which can be found here to fit in with my scenario. Example of what it is currently doing can be seen below.

Here shows the Kalman filter in action(the green line) however at this point it jumps between the two people in the box currently


I have added some basic checking for the HoG(Histogram of orientated gradients) and Kalman filter so that if a HoG is not detected the bounding box is drawn in the last place it was located. If it then re appears the Kalman filter then is updated with the new location. This is done by searching with a buffer with in the range of last HoG detection, this is assuming the person has not travelled far and there is no one else nearer.

The issues I am having with two people coming near to each other that the tracker swaps over is not an issue. The reason being as if two people come close to each other and one gets the tracker from the other then the other one will get their tracker. One way I can mitigate this is to start the search in the direction the person was travelling so that way the person is more likely to get their tracker back.

I am currently only tracking one person but now I have a goal I feel I can really push this through. My goal is to build a person object that will keep track of locations to help mitigate occlusions and count them. This will be using HoG detector as the initialiser, mean shift, Kalman filter and cam shift to help determine location helping keep a more accurate track of people. Background subtraction will be used as evidence to show that something is moving here chances are someone or something is here.

I am hoping to be able to determine in scene exits by determining if a number of person detectors go dead at the same location. If they are predicted to go off scene then that is a normal exit but can monitor exits to focus detectors more.



Any way this will be my last blog post for a while as I am off to sunny Lloret de Mar for my first vacation abroad with dance sport. Should be a good time sportsvest who are organising it have made it look like it is going to be an epic time. So speak in a week and a bit.

Lloret de Mar




Monday, 9 March 2015

The mean shift, the background subtraction and lots of time

Over the past week and a bit I have had to re create my HoG(Histogram of orientated gradients) as I discovered I had the wrong values in it. This is currently running and will hopefully finish soon as it has been running for two days now. As well as this I have implemented mean shift to track people over a number of frames and looked at background subtraction to increase accuracy of detectors.


The various combinations of HoG detector settings come to a rough total of 20000 different combinations. These include settings such as scale between 1 and 1.1, window stride between 0 and 9 and scaling between 0 and 32. This will then be used to determine the best and most accurate settings to use for the HoG detector increasing the overall performance. An issue I had was that they were not in the correct order so I had to write a quick script to go through the lines and sort them out. Below you can see the output from the 20000 lines of combinations and results of the HoG detector on 8 test images.

As it shows best values and how many were correct and what the total offset is for that setting
This value takes a while to process an image so it may be worth searching different combinations in between. As currently, for padding which takes two numbers, I use the same one twice. So padding(6,6) rather than padding(4,8), the same can be said for window stride. This could be faster or result in a more accurate detector. This will be ran at a later date.

As well as using HoG I am also using mean shift to track the movement of people. This will be helpful in counting people when they are occluded and then picking them back up when they come into focus. An example of current progress can be seen below.

Mean shift over 10 frames trying to track top and bottom
As you can see the boxes are not that accurate or tight round the people so the tracking is not as good as I would like it to be. To try and fix this and deal with false positives like the window at the top of the image I have been looking at background subtraction. This will allow me to ignore the parts that are not moving such as the window and focus on the more likely areas to contain people. It may just still be a cat.


To also keep track of people and make sure the mean shift does not go to far away from the people I will be re checking the area to find people are still there using the HoG detector. This will be less cpu intensive as we can assume that the people, if still are in frame, will be near by so no need to check the entire image.


More graph to follow when I get them working properly :)