Monday, 23 November 2015

HOG+SVM for gun detection in CCTV images

I have made a small collection of training data (currently around 18 images images, in two sets of 9 of people with guns and people without guns) and have made a basic implementation which attempts to guess whether somebody has a gun using support vector machines based off of 128x128 CCTV camera stills of people either carrying a gun or not carrying a gun. The present implementation appears to overfit the data so I will attempt to resolve this; it always correctly classifies everything in the training set but usually errs to the side of false negatives when  classifying test data from casual observation.

Progress to be made on this:

Collect more images (ideally 50 with guns, and I can take the rest of the images from pre-existing person reid datasets like ViPER - edit: may need some images from scenes in which guns appear in case the detector becomes influenced by the lighting/other composition of the scene.)

Find out how to regularise(?)/prevent overfitting in the model I've come up with

Formalise the analysis stage.

The source code for this version of the program can be found here:

http://pastebin.com/nz5cQx3k

To be honest, you can get rid of that opencv dependency.

Sunday, 22 November 2015

An eye for guns

In my upcoming series of posts, I will be exploring ways to automatically detect armed attackers in CCTV feeds using Python and OpenCV. Of course I'm sure the motivation for this given the recent terrorist attacks in Paris, Mali and others is obvious. The scope of this is currently quite broad, so I will attempt to narrow it down to some key points:


  • Reliable detection of an AK-47/Kalashnikov rifle from a low quality video feed.
    •  The motivation for this should be self explanatory
  • Suspicious body language detection
    •     There is some reason to believe that body language can be indicative of unusual behaviour. Being able to detect this may lead to effective tracking of suspicious individuals before they are capable of executing an attack
  •  Suspicious dress behaviour
    •  The attackers in Paris dressed in dark clothing and attacked at night. This could prove challenging, however in combination with body language detection a useful detector could be produced.

Goal one:
AK-47 detection in a still image - this will hopefully lend itself to progress in a real-time video detection scheme. More specifically, this should be a gun currently being carried by somebody rather than just in some luggage. This may be extended to potential containers for an AK-47 as they must be transported somehow.

Literature dump: 
http://www.sciencedirect.com/science/article/pii/S1877050915014076

http://ieeexplore.ieee.org/xpl/login.jsp?tp=&arnumber=7253863&url=http%3A%2F%2Fieeexplore.ieee.org%2Fiel7%2F7227935%2F7253613%2F07253863.pdf%3Farnumber%3D7253863
http://cvgl.stanford.edu/teaching/cs231a_winter1415/prev/projects/CS231AGun.pdf

http://airccse.org/journal/ijcseit/papers/2212ijcseit16.pdf

http://staffnet.kingston.ac.uk/~ku33185/MEDUSA.html
... + more but lazy.

Edit: The MEDUSA project looks like a promising source of information, although appears like it may have been underfunded.

Youtube has a large collection of videos involving potential attackers and mock attacks which may contain highly useful training data for supervised learning based detectors.

Labelling data may prove difficult. I will have to evaluate whether it is worth doing it myself, generating the data (3D images can be effectively be used for object recognition in combination with domain adaptation techniques).

I would ultimately like to come up with some affordable way to disable firearms within a room - although my initial thoughts on this remind me of a children's TV show where the contestants would be covered in some kind of gunk - thinking about the way custard works - perhaps a more hardy non-newtonian fluid could be used to jam a rifle? 

Should I be successful in any of these topics, they shall of course be free and open to all so that hopefully these systems can be implemented to help prevent terrorist attacks in major cities and for those who are otherwise interested in learning about computer vision applications. A hefty research grant of course would not go amiss. 

Thursday, 3 September 2015

Google Docs voice recognition (as written with it)


 So this is kind of my first go with Google Docs  voice recognition system and thought I'll give it a try because I've been reading about it a lot [articularly on Facebook. So I thought it would be a good opportunity to write a probably reasonably low quality blog post. Let's talk a little bit about how voice recognition has been used in the past. so most recently with Google we would probably think of the okay Google search feature that has been included in Android phones since  about version 4. Now as I type this I notice that I am having to go back and correct thae reasonable amount of what I've been talking about  I also find myself speaking more slowly and clearly than I normally would in order to give the speech recognition a   reasonable chance. however in general the accuracy does seem to be reasonably high especially given that I think I have quite a blocked nose at the moment which simply cannot be helping the the accuracy of the recognition or least use of the recognition. Since I have to end my sentences manually using a key word which I am not allowed to use  at the moment it does break up the flow of the diction a little bit.

 it's also pisses the way by Walt and fax using the wrong microphone. I'm sorry.  Apparently my microphone was somewhat too quiet and Google was struggling with it a little bit, not that I can blame them. Now that I have adjusted my volume setting it seems to be picking up things much more readily and is a little more responsive in general. So what can I say about this it seems that all you have to do is some fairly common sense configuration but in the end it actually seems to be doing a fairly remarkable job, so remarkable in fact that I'm not going to stop talking simply because it's quite interesting to watch.  Woohoo. in fact that is not what I just said but I actually attempted to use my falsetto to sing to the voice recognition system and apparently it picked that up as a woohoo which I'm going to take to mean that that it was good because  woohoo.

In general what seems to be a fairly solid voice recognition system although there are some keywords which you can't seem to get around not being able to say and I don't know how you work around that. my recommendation would be that you just try it see how you find it see if it works  well with your setup and you know happy Google doc’ing.

Saturday, 29 August 2015

fw2.xyz - a descriptive url service

Let me introduce you to my most newly released little experiment, fw2.xyz 

Forward2Xyz is a service which allows you to build a url, for instance, such as fw2.xyz/the.megas.history.repeating.youtube.full.album (which I choose primarily because that band has been my most recent choice of work music) and have it magically direct you to the appropriate page. In many instances, it also successfully gets preview generation from sites such as Facebook.

Let's talk a little bit about the motivation for this - "why would I want this?" is always a good question to ask yourself. The scenario I have in my head is that a user wants to be able to share something that is reasonably commonly known (hence appears on google - which the site relies on) but cannot remember the exact URL.  Normally this would involve the user going on to find the URL using google, then copying and pasting that into whatever message box they were going to use.

With Foward2Xyz you simply type in some description of what you would like to type in directly into the URL (it will accept spaces, but most social media sites won't recognise the whole thing as a single link so periods or plus signs are recommended - periods are probably easier for most users as they don't require use of the shift key)

So what are the advantages, for a user, of something like this?

The URL is descriptive - it would be quite hard to Rick Roll somebody using a URL like this, for instance, unless you were seriously committed to SEO. Youtube on the other hand obscures the title of the video in their URLs opting for some non-human-readable key fw2.xyz/never.gonna.give.you.up

 It's very easy to type into a text input box and most social media sites will use it appropriately meaning these kinds of links are easy to share.

It's resistant to typos - this is the advantage of using Google's search for the back-end.

The resulting URL is sometimes even shorter than the actual URL of the page - although this definitely depends on how specific you need to be to get the right page.

But as with all things of this nature there are some disadvantages such as:

Non-persistence of URLs - these links are not necessarily reliable as they rely on Google search results. I think this caveat is not necessarily a huge problem as the use case is supposed to be for people sharing things on social media or IM meaning that the lifetime of the link is limited anyway.

You might not get the page you expected.

People may not trust the service (but you should definitely trust me. I'm from the Internet after all!)

Saturday, 11 April 2015

Top 5 Your Game Jokes

So there was a conversation going on between people on #gamedev on twitter with the most amazing type of joke - jokes insulting your game! These are Your Game Jokes. So without further delay here are my top 5 your game jokes.

5. Your game has such little gameplay, they started calling the YouTube videos "Let's Reads"


From @keadin

4. Your game's so bad, not even Anti-Virus programs thinks it's legitimate software.



3. Your game's so bad, you'd even make ET the Atari game wanna leave this plannet!



2. Your game's so bad it killed gravity!



1. Your game's so unbalanced, it needs orthopedic shoes just to avoid falling over.

From @keadin

Saturday, 4 April 2015

436Tap - addicting game released!

Test your concentration with 436Tap, a free casual Android game developed by yours truly from here!

This is of course a google play games free download! :)

https://play.google.com/store/apps/details?id=com.perceptrobyte.match436.game.android

Can you beat my high score?
Here's to this and hopefully more maths games or otherwise addictive mobile things!

I look forward to your feedback!

Just crushed the last couple of issues...

Just crushed the last couple of issues that were keeping me from releasing 436Tap!! - a resource leak and have made a couple of tweaks to the difficulty level. So I will be uploading the current build to the Play store! See you when it's fully published!