Showing posts with label issues. Show all posts
Showing posts with label issues. Show all posts

Monday, 13 April 2015

People are objects

Well I am back and I have been working hard on my dissertation. I have gotten the people detected to be stored as objects after a bit of an issue. Never having done much Python before this dissertation and no object orientated Python at that, I can up on a few issues. My first was treating it like Java and putting global variables at the top of the class file. This I later found out that these were shared by all the objects, so when modifying one object global variable I modified them all. This was resolved by initializing them in the __init__ which is the first method that is run when the object is created. This involved me putting self.var_name = value. The self lets it know that that variable belongs to only that instance of the object. This link really helped me, especially 9.3.5.

The second issue was checking all the objects to see if they were a new person or the same person object and just needed location updating. This was partially resolved by checking the location of the new detections and comparing them to the location of the people objects. This will later incorporate the Kalman filter, and will target in a set direction making it a more accurate verifier.

As can be seen here the Kalman filter is not starting at the centre of the people which needs to be worked on. This will make initial tracking more accurate rather than having to wait for it to align.

The blue Xs are the start location of the Kalman filter



My next lot of tasks to do is to add in the mean shift and cam shift to improve the tracking. This will help determine if there is still a person at a location as well as helping determine if new detections are accurate. As well as this I need to track the location of people exiting the scene. If they are disappearing along the edge of the scene then it can be assumed that they wandered off screen. If they disappear on screen or are not detected then you can increase the likely hood of something such as a door existing at that location. The same can be assumed if reappearing at the same location.

Another possibility that could be happening is that there is an obstacle obscuring the view of the person for an extended period of time.

Thursday, 26 March 2015

Kalman filter pain


So over the past weeks I have been having some issues trying to get the Kalman filter to work to predict location of the people in the scene. This is going to be used to determine if they are in scene but occluded so still need to count them.

Several problems I was having involved everywhere I looked the tutorials told me to use something which wasn't in the OpenCV version I had or wasn't recognised. As such I was upgraded OpenCV to 2.4.11 rather than my current
version, 2.4.10.

Upgrading OpenCV was more of an issue than expected and had a few issues with the building. My first issue was I ran out of space on my laptop.

Turns out issue I was having was with using cv2 not cv which I just thought the way the examples were named. So after importing cv2.cv as cv I managed to get the Kalman filter working. Now I can start using it to determine where people are heading. First I need to get it so it stays on one person as HoG(Histogram of orientated gradients) sometimes picks a different person to find first.

 As well as trying to get the Kalman filter working I also did some tests to determine best moving average background subtraction to use. As well as this I calculated the time for completion on a set of 795 images, my PETs 2009 s2l1 data set. Results can be seen in the graphs below.



Compared moving average bg subtraction with photo shopped image using technique from here





I am still working on trying to get a outline of a person for my ROI(Region of interest) rather than a tight box to reduce the errors that are thrown. I am currently very close to getting this working but needs a few more tweaks and should be good.

A bit of house cleaning was in order as I had a few Python files in my directory that needed removing. It still needs a bit of a clean but it is much easier to navigate now.


 When everything is implemented properly then I can start work on different combinations of detection and see which combinations are the most accurate and the fastest. I can try this on other data sets as well to see how well they preform under different circumstances.

With the features implemented I can also catch up on my tests for them. As well as cleaning up my code with more comments and better layout.

Hopefully the next lot of stuff to do after Kalman filter will be a little less frustrating.