I am creating a neural network that trains to recognize numbers in images using Neuroph. I wanted to make my neural network better by providing different variations of the input original image. As an example “70.jpg”, I wanted to providing blur image of 70, unclear image of 70…etc and train the neural network. I am using Neuroph and any suggestion to achieve my requirement ?
1 Answers
If you simply want to alter an image that you already have I would suggest using java (I assume you are using that since it is what Neuroph is built with). There are a couple of different routes you could go, but first load the image into a pixel matrix (Java - get pixel array from image). Once you have the pixels in a matrix structure you have a couple different techniques you can apply:
Blurring - segment the matrix into groups of 4/9/16 pixel squares. Calculate the average RGB value for a group of pixels and replace all values with the average. This process will "blurr" the image by decreasing its effective resolution (Since it removes information that was stored in each pixel).
Here you would average every x with avg(x) (same for w/y/z). [x1][x2][y1][y2] [x3][x4][y3][y4] [w1][w2][z1][z2] [w3][w4][z3][z4] Resulting in: [x][x][y][y] [x][x][y][y] [w][w][z][z] [w][w][z][z]
Shading - Provide a constant filter on the image by altering the RGB values of each pixel by the same amount, or create a gradient by increasing the value as you move through the image.
Go Crazy - There are a lot of ways you could with this since you have full control over the image (Each row of pixels could be shifted over one to create a skewed image!). So just add some variation to ensure your DNN has the ability to catch any variance.
Hope that helps.