Showing posts with label MatPlotLib. Show all posts
Showing posts with label MatPlotLib. Show all posts

Tuesday, 10 March 2015

The ups and down of graphs!!!!

After having some issues I managed to get my graphs for the different settings for the HoG detector and this is what they look like.

This is the number of correct detections for a few HoG settings

This is the number of offsets from the Ground truth for a few HoG Settings   


This is only based upon a few frame so that it did not take forever to complete. The graphs as well only contain a select few HoG settings, otherwise it would be to busy and un readable.

I am currently working on trying to try different values between bigger numbers. This will allow me to try more combinations without trying all the combinations between.

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 :)

Thursday, 26 February 2015

Performance issues and graphs

Well things progressing if not a little slower than expected. Currently working on making some graphs and doing a mean shift for the HoG(Histogram of orientated gradients).

I have been creating some files to generate statistics for the different scenarios. The xml files generated have the frame number and HoG and moving average for that frame. This is so I have a file to go through to generate a graph from or use in the future for any data analysis. I also have a python file to generate the ground truth for images. This is done by popping up images and then the user enters the number of people in the frame and it creates an xml entry in the file given. At the moment it keeps the key codes in so they need to be changed to be the actual number of people in the frame.

With the xml statistics files that I have generated for variations on the same scene I am creating a graph against the ground truth to see which one performs better. I started doing this in PyGal but am now looking at MatPlotLib to see if any better. The graph in PyGal is a little claustrophobic see below for current graph from PyGal against graph from MatPlotLib.

PyGal graph



MatPlotLib graph

Looking at the graphs the MatPlotLib graph looks a little neater so will decide to go with that one. Also more graphs to follow.

The moving average of the HoG detector is good when the HoG detector is more stable with a high frame sample set. This is because the average does not deviate too much but when it has a large error it stays incorrect a lot longer. With the 2 frame sample set it adjusts more rapidly.

The next task to look at doing is trying variations of the HoG detector values on a set of images to determine the best settings to use. With the best HoG detector values set I can then re run the graph generators and see what the improvement is. Then I will implement a mean shift on the HoG detector to track people through the scene. This will give me some visuals on the movement of people with in the scene.

If I manage to get that far before my next meeting I will look at tweaking the HoG detector to get a closer box around the people detected to increase the accuracy of the mean shift.