So the past couple of weeks has been super busy so here goes it.
The first big thing that happened was me and a good friend went to seafood festival in Aberaeron. I got to try a load of lovly seafood and sing, singing in the rain, in the rain. As well as this I got to try oysters for the first time with chilli sauce. They taste nice but I could not quite decide if I liked the texture or not, so I had another. Overall I think I like them, after got some delicious mint cake.
On the job front I have a job in Leicester as a Web developer. It is going well and getting on ok, only done first day though. Will have to wait and see how it goes in the long term.
Also I officially graduated in a lovely and warm gown then got my expensive bit of paper(Degree). Already missing Aberystwyth, considering trying to become a lecturer there but we will see on that front. See picture below.
YouTube videos should be back on schedule now and hopefully more live streams, so stay tuned :).
Twitter - https://twitter.com/MentalMarriott
Twitch - http://en-gb.twitch.tv/mentalmarriott
Youtube - https://www.youtube.com/user/GamingMarriott
Facebook - https://www.facebook.com/mentalmarriott
A nice little blog about my general life and thought/ideas I feel like rambling on about.
Showing posts with label aber. Show all posts
Showing posts with label aber. Show all posts
Wednesday, 15 July 2015
Monday, 22 June 2015
Results....SOON!
So the time is almost upon us Aber people. Those who are graduating will be getting results this Thursday, that includes me. Can not lie I am a little nervous but I think it should be ok, can not see why I would not get a 2:1. Really hope I don't get a 2:2 as I said I would go graduation in a tutu otherwise but chances of that are really unlikely (touch wood).
My time at uni really is coming to an end as the first flat mate has moved out and the other one to be gone by the end of the week. I hopefully will not be too far behind as I hope to get a job sorted as soon as possible. Speaking of I have a few phone interviews and a couple face to face meetings to get through so hopefully some of them will prove fruitful.
As well as looking for work and preparing to move I have also been playing some 7 days to die with flat mate which you should be able to see on my channel soon (link below). I have also watch an excellent new Netflix season called sense8, really good and recommend checking it out. As well as checking out Daredevil tv series if you have not already checked that out and Dark matter. Dark matter is a little Firefly esk but so far not that level of awesome, it has the potential.
Finally yesterday was fathers day so I hope you all (who can) wished your father a happy day if not there is still time, a few days late won't matter :).
Twitter - https://twitter.com/MentalMarriott
Youtube - https://www.youtube.com/user/GamingMarriott
Facebook - https://www.facebook.com/mentalmarriott
Twitch - http://en-gb.twitch.tv/mentalmarriott
My time at uni really is coming to an end as the first flat mate has moved out and the other one to be gone by the end of the week. I hopefully will not be too far behind as I hope to get a job sorted as soon as possible. Speaking of I have a few phone interviews and a couple face to face meetings to get through so hopefully some of them will prove fruitful.
As well as looking for work and preparing to move I have also been playing some 7 days to die with flat mate which you should be able to see on my channel soon (link below). I have also watch an excellent new Netflix season called sense8, really good and recommend checking it out. As well as checking out Daredevil tv series if you have not already checked that out and Dark matter. Dark matter is a little Firefly esk but so far not that level of awesome, it has the potential.
Finally yesterday was fathers day so I hope you all (who can) wished your father a happy day if not there is still time, a few days late won't matter :).
Twitter - https://twitter.com/MentalMarriott
Youtube - https://www.youtube.com/user/GamingMarriott
Facebook - https://www.facebook.com/mentalmarriott
Twitch - http://en-gb.twitch.tv/mentalmarriott
Labels:
7 days to die,
aber,
daredevil,
dark matter,
fathers day,
firefly,
google+,
grduating,
interview,
job,
Netflix,
sense8,
twitter,
youtube
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.
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.
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.
Labels:
aber,
aberystwyth,
cam shift,
class,
diss,
dissertaion,
issues,
java,
kalman filter,
kalman2d,
mean shift,
obj,
objects,
opencv,
Python,
tracking
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.
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.
![]() |
| 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
Labels:
2015,
aber,
aberystwyth,
background subtraction,
diss,
dissertation,
Hannah Dee,
histogram of orientated gradients,
HoG,
kalman filter,
Lloret de Mar,
mean shift,
opencv,
PETS 2009,
Python,
sportsvest,
tracker
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.
Thursday, 19 March 2015
Points, assumptions and more graphs!
Ok so it has been a busy week so here comes a list of what I have been up to with my dissertation. Don't worry there are pictures.
First thing I got working was MoG(Mixture of Gaussian) background subtraction using this page on OpenCV. This is to allow me to detect movement within the image that can help determine the likeliness of a person existing at that point. I have also implemented moving average background subtraction from this helpful site. I will be creating a test to try different values for moving average background subtraction to see which one is the best to use.
I have also implemented Cam shift which is starts off by doing a mean shift but then updates the size of the window and calculates the best rotation of a fitting ellipse to it. Then re applies the mean shift with the new scaled search window and previous window position. This is then repeated until the desired accuracy is met. (Paraphrased from here).
I am dealing with the problem of people being obscured by using a Kalman filter to determine the direction and velocity of people. From this I can determine if they are going to end up off screen or if they are still with in the scene but obscured. The issue may arise if there is an exit on screen that the person can disappear through. This issue can be dealt with by assuming that if the person isn't detected with in a number of frames then they are likely no longer in the scene. I won't be modelling the scene as that is a whole other project.
I have also made some more wonderful graphs to show the number of correct detections that each setting for the HoG detector provides. These can be seen below
My code is getting a little messier than I would like it to be. For this reason I will be going over my code and modularising it and doing some more testing for the new code I have done.
I am working on a points based system that will give points to the more accurate detections that are all consistent. This will use mean shift, cam shift and hog detectors to build up a more accurate person detector. I will create an array of ROIs(regions of interest) for each person depending on the score they get to build up what to look for.
I have encountered some problems along the way. Some of these include contours from background subtraction overlapping with other HoG boundaries meaning false positive when looking for movement in a HoG detection. Another issue is a 'non convex optimisation problem' with trying to search through the most accurate window stride for HoG detector. This is trying to avoid searching through all the possible combinations by going in the direction of the best detector settings in chunks.
An interesting point that was raised in a dissertation meeting was, should you count people that are occluded. If a person was counting number of people in a scene and a person was occluded that person would not be counted. There may be times when you want to know if a person is still in a scene even when obscured. An example would be when a place is limited to a certain number of people but they will be blocked by certain elements. In this case keeping track of number of people is important.
In the case of my dissertation I will be keeping track of all people that are judged to still be with in the scene.
First thing I got working was MoG(Mixture of Gaussian) background subtraction using this page on OpenCV. This is to allow me to detect movement within the image that can help determine the likeliness of a person existing at that point. I have also implemented moving average background subtraction from this helpful site. I will be creating a test to try different values for moving average background subtraction to see which one is the best to use.
I have also implemented Cam shift which is starts off by doing a mean shift but then updates the size of the window and calculates the best rotation of a fitting ellipse to it. Then re applies the mean shift with the new scaled search window and previous window position. This is then repeated until the desired accuracy is met. (Paraphrased from here).
I am dealing with the problem of people being obscured by using a Kalman filter to determine the direction and velocity of people. From this I can determine if they are going to end up off screen or if they are still with in the scene but obscured. The issue may arise if there is an exit on screen that the person can disappear through. This issue can be dealt with by assuming that if the person isn't detected with in a number of frames then they are likely no longer in the scene. I won't be modelling the scene as that is a whole other project.
I have also made some more wonderful graphs to show the number of correct detections that each setting for the HoG detector provides. These can be seen below
![]() |
| Patterns include: Multiples of 4 having 0 detections and multiples of 6 having highest number of detections. |
![]() | |
| Steady drop of accuracy after scale setting of 1.01 |
![]() |
| This peaks at 3 but may go back up for higher numbers |
My code is getting a little messier than I would like it to be. For this reason I will be going over my code and modularising it and doing some more testing for the new code I have done.
I am working on a points based system that will give points to the more accurate detections that are all consistent. This will use mean shift, cam shift and hog detectors to build up a more accurate person detector. I will create an array of ROIs(regions of interest) for each person depending on the score they get to build up what to look for.
I have encountered some problems along the way. Some of these include contours from background subtraction overlapping with other HoG boundaries meaning false positive when looking for movement in a HoG detection. Another issue is a 'non convex optimisation problem' with trying to search through the most accurate window stride for HoG detector. This is trying to avoid searching through all the possible combinations by going in the direction of the best detector settings in chunks.
An interesting point that was raised in a dissertation meeting was, should you count people that are occluded. If a person was counting number of people in a scene and a person was occluded that person would not be counted. There may be times when you want to know if a person is still in a scene even when obscured. An example would be when a place is limited to a certain number of people but they will be blocked by certain elements. In this case keeping track of number of people is important.
In the case of my dissertation I will be keeping track of all people that are judged to still be with in the scene.
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 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.
![]() |
| 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.
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.
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 :)
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 |
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 |
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.
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.
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.
Wednesday, 18 February 2015
Faces, Bodies and Rectangles
I have finally got Viola-Jones implemented in OpenCV in Python evern if the faces it detects on the PETS 2009 data sets are not very accurate. As I am sure grass does not have a face. I will work on fine tuning it and maybe even combining it with HoG(histogram of orientated gradients) person detection.
Thats another thing I have implemented, using some of OpenCVs example code but tweaked to be a little more modular. HoG person detector can now pick up people in images with a reasonable degree of accuracy. Both this, Viola-Jones and any future implementations will be checked against the ground truth for the set of images. This will give me an idea of how accurate the implementations are when values are changed or my own combinations/implementations are used.
I have also written tests for my files that I have made such as img_handler.py, viola_jones.py and hogDetector.py using pytest. This allows me to test all the methods to make sure they do what they are meant to and will not break when passing certain data. This makes them good for regression tests or if I ever need to change something in them. There are some parts which I have not tested as they require user input. I am currently looking it to simulating this to be able to test them.
The only ground truth file I have come across for PETS 2009 is one from this site for scenario S2.L1. This comes in a .xml file so I will be looking at parsing this to get the relevant data for comparison. I am also looking at other data sets to test more. As well as this I am looking into creating my own small test data set of around 6 people, a plan of what will be acted is currently being drafted up.
I have encountered a few problems over the past few days one of which being OpenCV on Ubuntu 14.04... again. I think due to a recent install of some software I damaged the OpenCV install that I had previously done. After following the steps from this website again it was up and running. As well as this the HoG detector was not picking up al people but after a few tweaks with some settings to do with it I am now picking up most of the samples with a few false positives. As well as making it more accurate in certain aspects it has also increased the time taken to process images. Viola-Jones needs some tweaking with its settings as it is detecting faces where there are definitely not faces, such as the grass.
I have also altered the file I was using to manually step through the images to do it automatically and put the results from both Viola-Jones and HoG detector. These are then saved and will be turned it to a video which will be linked on this site when up and running. It will have a voice over explaining what is going on and what each rectangle is .
My next tasks if I manage to get that all done as well as a few improvements to files is to work on optical flow tracking. This will require me to compare positions of people in a previous image to current image and map their movement over time. This will be done in a different colour that will hopefully get darker the faster they appear to be moving. When I have that working I will post a video on YouTube and some images on here.
So that's it for this week, got a lot to crack on with hopefully won't be too bad and hopefully OpenCV won't mess up again.
Thats another thing I have implemented, using some of OpenCVs example code but tweaked to be a little more modular. HoG person detector can now pick up people in images with a reasonable degree of accuracy. Both this, Viola-Jones and any future implementations will be checked against the ground truth for the set of images. This will give me an idea of how accurate the implementations are when values are changed or my own combinations/implementations are used.
![]() |
| HoG detection green boxes, Viola-Jones in blue boxes |
I have also written tests for my files that I have made such as img_handler.py, viola_jones.py and hogDetector.py using pytest. This allows me to test all the methods to make sure they do what they are meant to and will not break when passing certain data. This makes them good for regression tests or if I ever need to change something in them. There are some parts which I have not tested as they require user input. I am currently looking it to simulating this to be able to test them.
![]() |
| Showing my tests completing successfully |
The only ground truth file I have come across for PETS 2009 is one from this site for scenario S2.L1. This comes in a .xml file so I will be looking at parsing this to get the relevant data for comparison. I am also looking at other data sets to test more. As well as this I am looking into creating my own small test data set of around 6 people, a plan of what will be acted is currently being drafted up.
I have encountered a few problems over the past few days one of which being OpenCV on Ubuntu 14.04... again. I think due to a recent install of some software I damaged the OpenCV install that I had previously done. After following the steps from this website again it was up and running. As well as this the HoG detector was not picking up al people but after a few tweaks with some settings to do with it I am now picking up most of the samples with a few false positives. As well as making it more accurate in certain aspects it has also increased the time taken to process images. Viola-Jones needs some tweaking with its settings as it is detecting faces where there are definitely not faces, such as the grass.
I have also altered the file I was using to manually step through the images to do it automatically and put the results from both Viola-Jones and HoG detector. These are then saved and will be turned it to a video which will be linked on this site when up and running. It will have a voice over explaining what is going on and what each rectangle is .
My next tasks if I manage to get that all done as well as a few improvements to files is to work on optical flow tracking. This will require me to compare positions of people in a previous image to current image and map their movement over time. This will be done in a different colour that will hopefully get darker the faster they appear to be moving. When I have that working I will post a video on YouTube and some images on here.
So that's it for this week, got a lot to crack on with hopefully won't be too bad and hopefully OpenCV won't mess up again.
Wednesday, 11 February 2015
That'ssss some very nice Python code there...
Well it has been a busy week of work on my dissertation and so with out messing around lets dive straight into what I have been up to.
Firstly I have handed in my project specification in on Friday and got feedback on The following Tuesday. The feedback was very helpful and helped clear up some thing such as focusing me more on target rather than trying to solve everything. As a result of this feedback my goals are even more clear now and they are to work on counting people in a crowd and determining if the crowd is calm or not. Other areas for improvement include my bibliography which did not have all the relevant information on some of the references.
As well as this I have been carrying on my reading and spent a long time trying to get OpenCV installed for Python on Ubuntu 14.04. I got shown a nice way of installing OpenCV via pip which is a nice way of installing stuff for Python. It installed but when I tried to run any test code with windows it was throwing dependency issues. So I looked around and found this nice tutorial which helped resolve some of my issues but still had an issue with gtk. This answer managed to fix the issue and I was up and running. I have also been learning a lot about Python such as how to be modular and returning tuples, example code below.
def tuple_return_function():
return ("10", "20")
def function_name();
tuple1, tuple2 = tuple_return_function()
print("Tuple1 is " + tuple1 + " Tuple2 is " + tuple2)
# Outputs: 'Tuple1 is 10 Tuple2 is 20'
Once I was up and running I got to work trying different OpenCV implemented methods using this site. As such I got some nice SIFT and SURF and a interactive foreground extraction using GrabCut algorithm. For SIFT and SURF I also made it loop so it only found a specific number of points so wouldn't detect everything. These helped me understand the basic functionality such as loading in images, copying them and converting them to grey and other basic stuff. You can see some examples below.
I have also started working on some code that will be used in the final system. Currently I have a Python file that is used for reading in image files from a directory as well as a basic implementation of Viola-Jones. Once I am happy with my implementation I will then begin writing tests for both the reading in image files and the Viola-Jones. I will be starting on implementing histograms of oriented gradients for human detection next after the tests are implemented.
I am having some issues with the Viola-Jones implementation for detecting faces in a crowd and it isn't that the faces are obstructed. It seems to be that the faces are too far away to be picked up. I am having a look at this and seeing if I can tweak some settings.
Firstly I have handed in my project specification in on Friday and got feedback on The following Tuesday. The feedback was very helpful and helped clear up some thing such as focusing me more on target rather than trying to solve everything. As a result of this feedback my goals are even more clear now and they are to work on counting people in a crowd and determining if the crowd is calm or not. Other areas for improvement include my bibliography which did not have all the relevant information on some of the references.
As well as this I have been carrying on my reading and spent a long time trying to get OpenCV installed for Python on Ubuntu 14.04. I got shown a nice way of installing OpenCV via pip which is a nice way of installing stuff for Python. It installed but when I tried to run any test code with windows it was throwing dependency issues. So I looked around and found this nice tutorial which helped resolve some of my issues but still had an issue with gtk. This answer managed to fix the issue and I was up and running. I have also been learning a lot about Python such as how to be modular and returning tuples, example code below.
def tuple_return_function():
return ("10", "20")
def function_name();
tuple1, tuple2 = tuple_return_function()
print("Tuple1 is " + tuple1 + " Tuple2 is " + tuple2)
# Outputs: 'Tuple1 is 10 Tuple2 is 20'
Once I was up and running I got to work trying different OpenCV implemented methods using this site. As such I got some nice SIFT and SURF and a interactive foreground extraction using GrabCut algorithm. For SIFT and SURF I also made it loop so it only found a specific number of points so wouldn't detect everything. These helped me understand the basic functionality such as loading in images, copying them and converting them to grey and other basic stuff. You can see some examples below.
![]() |
| SURF - Before and after |
![]() |
| GrabCut - Before and after |
![]() |
| SIFT - Before and after |
I have also started working on some code that will be used in the final system. Currently I have a Python file that is used for reading in image files from a directory as well as a basic implementation of Viola-Jones. Once I am happy with my implementation I will then begin writing tests for both the reading in image files and the Viola-Jones. I will be starting on implementing histograms of oriented gradients for human detection next after the tests are implemented.
I am having some issues with the Viola-Jones implementation for detecting faces in a crowd and it isn't that the faces are obstructed. It seems to be that the faces are too far away to be picked up. I am having a look at this and seeing if I can tweak some settings.
Labels:
aber,
aberystwyth,
dependencies,
diss,
dissertation,
HoG,
install,
opencv,
Python,
tuple,
Ubuntu,
university,
viola-jones
Sunday, 1 February 2015
I predict a riot
So finally decided on what my dissertation is going to focus on and, drum roll please, it is crowd behaviour. Specifically trying to count out when a crowd is likely to form, how many people are in a crowd, why they are they are in a crowd and dispersal patterns of the crowd. As well as this I will have to take into account the ethics of analysing people in crowds.
The main goals of this is to be able to determine at minimum number/groups of people in crowds. From this I can try to ascertain the situation and evaluate possible outcomes. It would be nice to be able to accurately count the people in a crowd however there are issues with trying to count people close together. If they are too close then an issue arises with counting many people as one person, as well as this the faces may not all be visible or clear enough to use facial recognition or just obstructed. There has been research into counting people in crowds or mapping high density crowds but I have not come across anything that is accurate and versatile between scenarios. The research linked for 'counting people in crowds' has a high success rate of more than 96% but the data set is only three videos. With regards to the link provided in the 'mapping high density crowds' they track motion against a certain threshold and if not over the threshold then it is considered static. This raises the issue of people who are not moving fast enough which can happen in over crowded areas would be considered background. On the other hand things, such as large animals, that move at the threshold could be used in the generation of the map thus making it not accurate. Being able to determine when a crowd is about to form would help determine things such as when a riot or a big event is about to happen( discussed in more detail later).
Below is an image of where people counting could be useful to make sure there is no over crowding. As well as this it could be used to determine best flow of traffic or if something abnormal is happening. *
Within crowds there are specific behaviours that can looked out for to help identify individual people or to try and work out what is going on in the scene. When walking down the street and another person is heading towards you the closer they get the more you move to the side to pass them as explained here. When people are coming from different angles but heading in the same direction they tend to merge in to a single flow of traffic. There is however, no specific detailed definition of a crowd but is defined as 'a large number of people gathered together in a disorganized or unruly way'. A few definitions do exist and share common specifics such as 'conceptualising a crowd as a sizeable number of people gathered at a specific location for a measurable time period, with common goals and displaying common behaviours' which is a extract from this online pdf. This document also goes into more detail about what is expected from a crowd. There is however issues with things such as determining when a group of people are considered a crowd, such as number of people and time spent together/at a location. For these reasons a set definition of a crowd must be made to allow a system to appropriately determine if there is a crowd or if a crowd is likely to form. As well as defining a crowd, definitions of crowds in different situations from data sets will allow the system to more clearly work out what is going on.
The accuracy of this is likely to be incrementally lower as the crowds get bigger as it will be harder to count people and monitoring the flow will become process heavy. As such focusing on each part such as the counting will allow more targeted results with hopefully higher accuracy. This could be useful though for predicting violence in crowds in which some work has been done here or even counting people in areas to avoid overcrowding and injuries.
Below image shows how the faces are not always showing on cameras, this makes it more difficult to count people using facial recognition. *
Now comes the fun part, ethics and what is ok to use, after all we will be looking at humans and their behaviour.The first thing we need to make sure is that the people who are on the video are ok to have themselves used for research purposes and their privacy is protected. Some questions need to be asked such as ones raised in this papers abstract. Questions such as 'Under what conditions should video be presented and to which audiences'. Videos that are used should have the consent of the people in it and should only be used for the purposes they are made for. As well as this there should be no attempt to try and identify persons within the videos unless that is the reason for the videos and you have express permission from all persons involved.
This is just a little overview of the parts of what needs to be discussed and will be discussed in more detail over the coming weeks.
The main goals of this is to be able to determine at minimum number/groups of people in crowds. From this I can try to ascertain the situation and evaluate possible outcomes. It would be nice to be able to accurately count the people in a crowd however there are issues with trying to count people close together. If they are too close then an issue arises with counting many people as one person, as well as this the faces may not all be visible or clear enough to use facial recognition or just obstructed. There has been research into counting people in crowds or mapping high density crowds but I have not come across anything that is accurate and versatile between scenarios. The research linked for 'counting people in crowds' has a high success rate of more than 96% but the data set is only three videos. With regards to the link provided in the 'mapping high density crowds' they track motion against a certain threshold and if not over the threshold then it is considered static. This raises the issue of people who are not moving fast enough which can happen in over crowded areas would be considered background. On the other hand things, such as large animals, that move at the threshold could be used in the generation of the map thus making it not accurate. Being able to determine when a crowd is about to form would help determine things such as when a riot or a big event is about to happen( discussed in more detail later).
Below is an image of where people counting could be useful to make sure there is no over crowding. As well as this it could be used to determine best flow of traffic or if something abnormal is happening. *
Within crowds there are specific behaviours that can looked out for to help identify individual people or to try and work out what is going on in the scene. When walking down the street and another person is heading towards you the closer they get the more you move to the side to pass them as explained here. When people are coming from different angles but heading in the same direction they tend to merge in to a single flow of traffic. There is however, no specific detailed definition of a crowd but is defined as 'a large number of people gathered together in a disorganized or unruly way'. A few definitions do exist and share common specifics such as 'conceptualising a crowd as a sizeable number of people gathered at a specific location for a measurable time period, with common goals and displaying common behaviours' which is a extract from this online pdf. This document also goes into more detail about what is expected from a crowd. There is however issues with things such as determining when a group of people are considered a crowd, such as number of people and time spent together/at a location. For these reasons a set definition of a crowd must be made to allow a system to appropriately determine if there is a crowd or if a crowd is likely to form. As well as defining a crowd, definitions of crowds in different situations from data sets will allow the system to more clearly work out what is going on.
The accuracy of this is likely to be incrementally lower as the crowds get bigger as it will be harder to count people and monitoring the flow will become process heavy. As such focusing on each part such as the counting will allow more targeted results with hopefully higher accuracy. This could be useful though for predicting violence in crowds in which some work has been done here or even counting people in areas to avoid overcrowding and injuries.
Below image shows how the faces are not always showing on cameras, this makes it more difficult to count people using facial recognition. *
Now comes the fun part, ethics and what is ok to use, after all we will be looking at humans and their behaviour.The first thing we need to make sure is that the people who are on the video are ok to have themselves used for research purposes and their privacy is protected. Some questions need to be asked such as ones raised in this papers abstract. Questions such as 'Under what conditions should video be presented and to which audiences'. Videos that are used should have the consent of the people in it and should only be used for the purposes they are made for. As well as this there should be no attempt to try and identify persons within the videos unless that is the reason for the videos and you have express permission from all persons involved.
This is just a little overview of the parts of what needs to be discussed and will be discussed in more detail over the coming weeks.
Labels:
aber,
aberystwyth,
analysis,
behaviour,
crowd,
diss,
dissertaion,
ethics,
predict
Sunday, 26 October 2014
Busy Bee
Well everything is going well at university. I am keeping busy with work, sports and social.
Dance sport: I am getting better at dancing now which is good as I have put myself down for competition in Warwick in November. I am very nervous and I need to go shopping for some dance shoes and clothing. I have a brilliant partner who puts up which my foibles and every one in the society is awesome and mad and I love them all :). I do fit in well with them. So stay tuned to see my results.
Fencing: On Saturday I took part in the novice fencing competition with five others. During the day I didn't lose a match, to which I was shocked, but the final is on Tuesday. I am nervous about it as everyone else will be there for training but I will give it my best and hope I win.
Football: Football is going well had our first proper match today which didn't go brilliantly. Hopefully our next match will go a little better. Definitely a good way to wake up though.
Uni: Got a few assignments handed out that are proving to be fun and a few more to be handed out. Got one on WebGL creating a model solar system and one to write a report on agile and another on vision.
Social: Well after a few comments on a post in our computer science page on Facebook I have become the social representative for computer science. So looks like I will be organising the socials for a while, which I am not to fussed about. Hopefully, more people will turn up.
SSCC(Staff Student Consultative Committee): I have also joined SSCC which means I will be a representative for my subject and year. So people who want to raise issues then I can report them back to people higher up who can sort them out and improve things or help out at the time if possible.
Dance sport: I am getting better at dancing now which is good as I have put myself down for competition in Warwick in November. I am very nervous and I need to go shopping for some dance shoes and clothing. I have a brilliant partner who puts up which my foibles and every one in the society is awesome and mad and I love them all :). I do fit in well with them. So stay tuned to see my results.
Fencing: On Saturday I took part in the novice fencing competition with five others. During the day I didn't lose a match, to which I was shocked, but the final is on Tuesday. I am nervous about it as everyone else will be there for training but I will give it my best and hope I win.
Football: Football is going well had our first proper match today which didn't go brilliantly. Hopefully our next match will go a little better. Definitely a good way to wake up though.
Uni: Got a few assignments handed out that are proving to be fun and a few more to be handed out. Got one on WebGL creating a model solar system and one to write a report on agile and another on vision.
Social: Well after a few comments on a post in our computer science page on Facebook I have become the social representative for computer science. So looks like I will be organising the socials for a while, which I am not to fussed about. Hopefully, more people will turn up.
SSCC(Staff Student Consultative Committee): I have also joined SSCC which means I will be a representative for my subject and year. So people who want to raise issues then I can report them back to people higher up who can sort them out and improve things or help out at the time if possible.
Labels:
aber,
aberystwyth,
ballroom,
buildthedamn,
competition,
dance,
fencing,
football,
social,
sscc,
uni,
university
Wednesday, 16 July 2014
Goodbyes, Travel and Beach
So been a very busy weekend with travels and fun. However, before the weekend got under way though, there was a few goodbyes to fellow colleagues who had finished their placement and will be going back to university soon. It is been a lot more quieter around the work place as well. Hopefully we will stay in contact and if we are both lucky we might see each other back at work as a graduate.
After the goodbyes it was off to home back in the midlands to see parents. This required a fun 4 hour train journey after which it was fair to say I was glad to be home. I then grabbed something to eat and headed out with parents to the pub. At the local had a few nice pints of bass and had a good catch up then headed home for a good rest. My body clock however was still on work schedule so woke up around 8am and had a bath which I had missed, I still wash just via a shower :P.
After a relaxing bath and a bit of lunch I set off on my second part of my travels to Wales, back to my university. I was heading here to see what my new accommodation for final year is like. This was a 7 hour train journey during with I did nod off a little a couple of times. When I got in it was a short trek to my new place which I can say is lovely, with an amazing garden/patio.
Here I met our 4th flatmate who is a PHD student who is very nice but only here for 3 months. After stocking up on a few essentials we met up with a few friends for a drink and a catch up. While out we watched bits of the Brazil Vs Holland game, which I am glad Holland won. On the Sunday it was a relaxing day sorting out some stuff for my room. I built a flat pack desk while flatmates watched frozen. Later on we watched the world cup final and it was a tense match but I am glad Germany won. After that we headed out for a midnight bonfire on the beach where had another good catch up with friends and a nice talk with a stranger who decided to join out bonfire.
In the morning it was get up get ready and go. This time a nice 7 hour trek on train back down south. People were arriving as well as this was the week of graduations, some of whom were friends of mine who didn't do an industrial year. After I got back I had dinner then relaxed as the next day I was in work.
Back to work I went after a terrible nights sleep but it was a good day as got £64 from the sweepstakes for Germany winning the world cup which was nice. With some of my winnings I brought some cake for work colleagues.
All in all a busy few days :)
After the goodbyes it was off to home back in the midlands to see parents. This required a fun 4 hour train journey after which it was fair to say I was glad to be home. I then grabbed something to eat and headed out with parents to the pub. At the local had a few nice pints of bass and had a good catch up then headed home for a good rest. My body clock however was still on work schedule so woke up around 8am and had a bath which I had missed, I still wash just via a shower :P.
After a relaxing bath and a bit of lunch I set off on my second part of my travels to Wales, back to my university. I was heading here to see what my new accommodation for final year is like. This was a 7 hour train journey during with I did nod off a little a couple of times. When I got in it was a short trek to my new place which I can say is lovely, with an amazing garden/patio.
Here I met our 4th flatmate who is a PHD student who is very nice but only here for 3 months. After stocking up on a few essentials we met up with a few friends for a drink and a catch up. While out we watched bits of the Brazil Vs Holland game, which I am glad Holland won. On the Sunday it was a relaxing day sorting out some stuff for my room. I built a flat pack desk while flatmates watched frozen. Later on we watched the world cup final and it was a tense match but I am glad Germany won. After that we headed out for a midnight bonfire on the beach where had another good catch up with friends and a nice talk with a stranger who decided to join out bonfire.
In the morning it was get up get ready and go. This time a nice 7 hour trek on train back down south. People were arriving as well as this was the week of graduations, some of whom were friends of mine who didn't do an industrial year. After I got back I had dinner then relaxed as the next day I was in work.
Back to work I went after a terrible nights sleep but it was a good day as got £64 from the sweepstakes for Germany winning the world cup which was nice. With some of my winnings I brought some cake for work colleagues.
All in all a busy few days :)
Tuesday, 24 June 2014
Introductions
Well this is my first post(On my new blog, all the posts before this were imported) so I think I should introduce myself a bit. My name is Chris and I am 24, won't give you too much on me, stops you tracking me down :P
A little bit about myself. I am quite crazy and very talkative, tall at around 6' 2", love to have a laugh and travel. I don't play games that much as I am not brilliant but I have been doing more since restarting my YouTube channel. I love watching TV and Films and could talk about them forever.
I am currently on my industrial year down south which will becoming to an end soon, this makes me sad. I have learnt loads while down here and hopefully can come back as a Graduate. I have met some wonderful people here who I hope to remain friends with for a long while and hopefully see them again at some point in the future.
In a couple months time I shall be heading to my parents hope for a brief stop and relaxation and then it will be back off to university for my final year. I go university in Aberystwyth, which if you are not familiar with, is a lovely coastal town in Wales(Lovely when not being destroyed by waves, no seriously check the past news reports). My time there has been fantastic and amazing, the people I have met there will be friends for life, some of whom I would even go as far as to call my family. When I get back I will be living with two other friends who do computer science, which is what I do by the way. I am not looking forward to the large amount of work that needs to be done but I am looking forward to being home.
Before I go I shall leave you with some handy links :)
YouTube - Ignore the first few videos, the channel is still going under changes and I am getting used to some video editing settings.
Twitter - Feel free to follow or message me on here and I will also try and get back to you if you ask a question. If you have any topics you wish for me to talk about please don't hesitate to ask.
A little bit about myself. I am quite crazy and very talkative, tall at around 6' 2", love to have a laugh and travel. I don't play games that much as I am not brilliant but I have been doing more since restarting my YouTube channel. I love watching TV and Films and could talk about them forever.
I am currently on my industrial year down south which will becoming to an end soon, this makes me sad. I have learnt loads while down here and hopefully can come back as a Graduate. I have met some wonderful people here who I hope to remain friends with for a long while and hopefully see them again at some point in the future.
In a couple months time I shall be heading to my parents hope for a brief stop and relaxation and then it will be back off to university for my final year. I go university in Aberystwyth, which if you are not familiar with, is a lovely coastal town in Wales(Lovely when not being destroyed by waves, no seriously check the past news reports). My time there has been fantastic and amazing, the people I have met there will be friends for life, some of whom I would even go as far as to call my family. When I get back I will be living with two other friends who do computer science, which is what I do by the way. I am not looking forward to the large amount of work that needs to be done but I am looking forward to being home.
Before I go I shall leave you with some handy links :)
YouTube - Ignore the first few videos, the channel is still going under changes and I am getting used to some video editing settings.
Twitter - Feel free to follow or message me on here and I will also try and get back to you if you ask a question. If you have any topics you wish for me to talk about please don't hesitate to ask.
Labels:
aber,
aberystwyth,
blog,
crazy,
films,
games,
industrial year,
marriott,
talkative,
tv,
twitter,
uni,
university,
youtube
Subscribe to:
Posts (Atom)





















