Showing posts with label moving average. Show all posts
Showing posts with label moving average. Show all posts

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.



Monday, 23 February 2015

Video and XML fun

This is only going to be a short over view of what I was up to over the weekend as there was a bit of time limitation with what I was up to. As I will now explain.

So over the weekend I was working on getting video up of PETS 2009 with HoG(Histogram of oriented gradients), moving average of HoG and ground truth. My first issue came when I noticed that the ground truth I was using was not accurate and missing out counting people that were in the scene. As I had trouble finding other ground truths for S2L1 scene and other scenes I created my own xml ground truth generator. This goes through the images one by one and the user can then enter the number of people in the scene. This then creates an xml document with the ground truth the user enters for the scene. This makes creating ground truth for future scenes that I can not find ground truths for a lot easier. I can then check through this and compare to the results of HoG and the moving average.

Once this was implemented then I had to generate a video displaying this information. This originally took a long time of close to an hour for 794 images which was was too long. I then reduced the number of frames to take down to 120 this meant it was a lot quicker. Then I had to turn the images into a video, originally I tried turning them straight into a .mp4 but took to long and crashed laptop several times. To overcome this I converted them to a .gif and then turned the .gif into a .mp4. This was still time consuming but more stable. I did this using the following commands.


convert -delay 30 -loop 0 *.jpg result.gif - using this source

ffmpeg -f gif -i infile.gif outfile.mp4 - using this source

Once I got them done I joined them together using the following command.

MP4Box -cat s2f.mp4 -cat s2ff.mp4 -cat s6f.mp4 -cat s6ff.mp4 -new all.mp4
 - That I found here


Now the video was done I uploaded to YouTube with a brief description. The video can be found here.

I am now looking at implementing blob tracking on the videos then move onto dealing with occlusions which will help me more accurately count people in a crowd. First I need to create some tests for the stuff I have.