Question

I have an arbitrarily sized text file simulating the two dimensional output from something we'll call a radar. In this output I want to be able to recognize patterns that are already known. Let's call it target detection.

The targets could look like this, every X a lit pixel, meaning the radar detected something that could be part of the enemy, and every whitespace a turned off pixel.

sample figures

And the radar data comes in a form where 'disturbance' is introduced, that is, the figure won't have all its pixels turned on. So I'm thinking of having some kind of probability included in the detection as well.

I've never done anything similar to this and I'm looking for general advice. I'm trying different approaches and I'm sure I'll solve it somehow, but I would really like to have some guidelines, reading resources or similar regarding this kind of pattern matching since I think it's highly intriguing but haven't had the opportunity to solve a problem like this before.

Any ideas?

Was it helpful?

Solution

A perceptron takes the weighted linear combination of a set of inputs, and outputs either a 1 or 0, depending on whether the result is positive or negative. The AI, so to speak, is acheived by the weights and these determine the split in data. One side results in positive and the other side negative. This split can be thought of as a line on a graph. For instance if the weights gave a line y=x, the input x = 2, y = 4 would be positive and the input x = -1, y = 1 would be negative. The weights are trained by presenting the system with sets of positive and negative inputs and adjusting the weights until the outputs for the training sets matches the desired outputs.

The number of inputs are given by the number of pixels, each pixel has its own input and associated weight, therefore the weights are an array the same size as the image.

For your example you would need a set of images of the enemy targets some with expected noise. The desired outputs for these would be positive, so present all the images to the perceptron and check the output. If the output is not 1 you adjust the weights. Next show a non-enemy image and check the output for 0. If not adjust the weights. Continue showing the positive images and checking for an output of 1 and the negative images are checking for a 0, adjusting the weights until these are the outputs you get.

Initially the weights are set to small random numbers. If the actual output does not match the desired output, which it wont to begin with, adjust each weights by the equation:

w(t+1) = w(t) + a(d-y)x

So the new weight is the old weight plus alpha times the desired output minus the actual outcome multiplied by the input,(for that pixel)

Alpha can be changed as the training goes on. To begin with it is large so the convergence happens quickly. As time goes on its best to reduce the number to slow down the convergence so it's more accurate. Alpha, the learning rate should be 0

So in Java:

Create an array of weights and initialise these to small random numbers.

Create a set of input images and corresponding desired outputs.

Choose a random image and present it to the system. - Multiply the input by the weights, sum them and find the sign.

Check the output against the desire output. If they are the same choose another input image. If there is a difference adjust the weights by the equation then choose another input image.

Continue showing inputs until the total error is below a certain threshold.

When the system is trained an unseen image can be presented to the system. If it is an enemy target it will output a 1, if not a 0.

All the details can be found online, wiki pages, with much more explanations but hopefully it helps.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top