Detecting differences in images using neural network approach - neural-network

What would be best way to detect difference between 2 images, one image is taken at beginning of process and the other at the end, goal is to detect if there is any difference in the images.
Based on my research neural networks seems good for this type of problem, but I don't have experience using them, I am not sure should this problem be treated as classification or anomaly detection? Also if you have any useful literature/GitHub projects/papers to share I would be thankful.

Related

Find image within image (template matching?)

I need to find the location of an image that the user provides within an image that I provide.
It is safe to assume at the time of the analysis that the user provided image is certain to be contained within the image to be compared with.
I’ve looked through and even have some experience with Core ML and Vision image classification however I am struggling to convince myself that it is the correct way to approach this problem. I feel like the way “feature values” is handled in Vision it is almost the reverse of what I’m looking for.
My question: Is there a feature of Core ML or Vision that tackles this particular problem head on?
Other information that may be needed;
It is not safe to assume that images provided are pixel to pixel perfect due to possible resolution differences.
They may also be provided in any shape although possible to crop to a standardised shape before analysis.
Rotation will also need to be accounted for.
There would not be cases where the image is in the image twice.
Take a look at some of the feature detection and matching algorithms.
For example, you could use SIFT (scale-invariant feature transform algorithm) with RANSAC (Random sample consensus algorithm) to do exactly what you described.
If you are using OpenCV there are plenty of such algorithms which you can easily use. (FAST, Shi-Tomasi, etc.)
I think you need something like this expale in OpenCV

crowd tracking with opencv

I am working on a crowd controlled soundsystem for a music festival. Music would be controlled by individuals and the crowd as a whole, more or less 500 people.
While searching for crowd tracking techniques, I stumbled upon this one http://www.mikelrodriguez.com/crowd-analysis/#density; Matlab code and dataset are enclosed. Are you aware of similar techniques, maybe simpler, based eg on blob detection? Do you have an idea about how well this one would perform in a real-time scenario? Is there a known way to do this with eg OpenCV?
One of my former colleagues implemented something similar (controlling a few motors according to crowd movement) using optical flow. You can analyze the frames of video from a camera, calculate optical flow between frames, and use the values to estimate the crowd movement.
OpenCV has support to perform the above tasks, and comes with good code samples. A desktop should be able to do this in real-time (you might have to tweak with image resolution).
I am not exactly sure how to interface between a C++ program and a sound system. Pure Data (PD) is an alternative, but it might not have much support for motion analysis.

Which features can i use for handwritten OCR other than a downsampled binary grid of the image?

Hi I have been searching though research papers on what features would be good for me to use in my handwritten OCR classifying neural network. I am a beginner so I have been just taking the image of the handwritten character, made a bounding box around it, and then resize it into a 15x20 binary image. So this means i have an input layer of 300 features. From the papers i have found on google (most of which are quite old) the methods really vary. My accuracy is not bad with just a binary grid of the image, but I was wondering if anyone had other features I could use to boost my accuracy. Or even just pointing me in the right direction. I would really appreciate it!
Thanks,
Zach
I haven't read any actual papers on this topic, but my advice would be to get creative. Use anything you could think of that might help the classifier identify numbers.
My first thought would be to try and identify "lines" in the image, maybe via a modified "sliding window" algorithm (sliding/rotating line?), or to try and identify a "line of best fit" to the image (to help the classifier respond to changes in italicism or writing style). Really though, if you're using a neural network, it should be picking up on these sorts of things without your manual help (that's the whole point of them!)
I would focus first on the structure and topology of your net to try and improve performance, and worry about additional features only if you cannot get satisfactory performance some other way. Also you could try improving the features you already have, make sure the character is centered in the image, maybe try an algorithm to skew italicised characters to make them vertical?
In my experience these sorts of things don't often help, but you could get lucky and run into one that improves your net :)

Neural Networks for Pattern Recognition

Hey guys, Am wondering if anybody can help me with a starting point for the design of a Neural Network system that can recognize visual patterns, e.g. checked, and strippes. I have knowledge of the theory, but little practical knowledge. And net searches are give me an information overload. Can anybody recommend a good book or tutorial that is more focus on the practical side.
Thank you!
Are you only trying to recognize patterns such as checkerboards and stripes? Do you have to use a neural network system?
Basically, you want to define a bunch of simple features on the board and use them as input to the learning system. It can often be easier to define a lot of binary features and feed them into a single-layer network (what can become essentially linear regression).
Look at how neural networks were used for learning to play backgammon (http://www.research.ibm.com/massive/tdl.html), as this will help give you a sense of the types of features that make learning with a neural network work well.
As suggested above, you probably want to reduce your image a set of features. A corner detector (perhaps the Harris method) could be used to determine features in the checkerboard pattern. Likewise, an edge detector (perhaps Canny) could be used in the stripes case. As mentioned above, the Hough transform is a good line detection method.
MATLAB's image processing toolbox contains these methods, so you might try those for rapid prototyping. OpenCV is an open-source computer vision library that also provides these tools (and many others).

How to use neural networks to solve "soft" solutions?

I'm considering using a neural network to power my enemies in a space shooter game i'm building and i'm wondering; how do you train neural networks when there is no one definitive good set of outputs for the network?
I'm studying neural networks at the moment, and they seem quite useless without well defined input and output encodings, and they don't scale at all to complexity (see http://en.wikipedia.org/wiki/VC_dimension). that's why neural network research has had so little application since the initial hype more than 20-30 years ago while semantic/state based AI took over everyone's interests because of it's success in real world applications.
A so a good place to start might be to figure out how to numerically represent the state of the game as inputs for the neural net.
The next thing would be to figure out what kind of output would correspond to actions in the game.
think about the structure of neural network to use. To get interesting complex behavior from neural networks, the network almost has to be recurrent. You'll need a recurrent network because they have 'memory', but beyond that you don't have much else to go on. However, recurrent networks with any complex structure is really hard to train to behave.
The areas where neural networks have been successful tend to be classification (image, audio, grammar, etc) and limited success in statistical prediction (what word would we expect to come after this word, what will the stock price be tomorrow?)
In short, it's probably better for you to use Neural nets for a small portion of the game rather as the core enemy AI.
You can check out AI Dynamic game difficulty balancing for various AI techniques and references.
(IMO, you can implement enemy behaviors, like "surround the enemy", which will be really cool, without delving into advanced AI concepts)
Edit: since you're making a space shooter game and you want some kind of AI for your enemies, I believe you'll find interesting this link: Steering Behaviors For Autonomous Characters
Have you considered that it's easily possible to modify an FSM in response to stimulus? It is just a table of numbers after all, you can hold it in memory somewhere and change the numbers as you go. I wrote about it a bit in one of my blog fuelled deleriums, and it oddly got picked up by some Game AI news site. Then the guy who built a Ms. Pacman AI that could beat humans and got on the real news left a comment on my blog with a link to even more useful information
here's my blog post with my incoherant ramblings about some idea I had about using markov chains to continually adapt to a game environment, and perhaps overlay and combine something that the computer has learned about how the player reacts to game situations.
http://bustingseams.blogspot.com/2008/03/funny-obsessive-ideas.html
and here's the link to the awesome resource about reinforcement learning that mr. smarty mcpacman posted for me.
http://www.cs.ualberta.ca/%7Esutton/book/ebook/the-book.html
here's another cool link
http://aigamedev.com/open/architecture/online-adaptation-game-opponent/
These are not neural net approaches, but they do adapt and continually learn, and are probably better suited to games than neural networks.
I'll refer you to two of Matthew Buckland's books.
Programming Game AI by example
AI Techniques for Game Programming
The second book goes into back-propagation ANN, which is what most people mean when they
talk about NN anyway.
That said, I think the first book is more useful if you want to create meaningful game AI. There's a nice, meaty section on using FSM successfully (and yes, it's easy to trip yourself up with a FSM).