newind27
newind27

Reputation: 21

Encog Neural Network for Classifying Images : Training

I'm having problem training a neural network for image classification. Basing it on the performance of the NN, it doesn't seem to be learning.

I basically run the given program in encog-examples (ImageNeuralNetwork) to classify a set of images. The following is the sample program output

Training set created
Added input image:./faces/at33_straight_neutral_open.png; identity: shadesNone
Added input image:./faces/night/night_up_happy_sunglasses_4.png; identity: shades
...<more files here>...
Added input image:./faces/cheyer/cheyer_up_neutral_open_4.png; identity: shadesNone
Downsampling images...
Created network: [BasicNetwork: Layers=3]
Training Beginning... Output patterns=2
Beginning training...
Iteration #1 Error:199.591952% elapsed time = 00:00:00 time left = 00:01:00
Iteration #2 Error:196.384178% elapsed time = 00:00:00 time left = 00:01:00
Iteration #3 Error:160.422574% elapsed time = 00:00:00 time left = 00:01:00
...
Iteration #16 Error:99.733657% elapsed time = 00:00:00 time left = 00:01:00
...
Iteration #202 Error:99.489796% elapsed time = 00:00:04 time left = 00:01:00
...
Iteration #203 Error:199.605091% elapsed time = 00:00:04 time left = 00:01:00

As you can see, the NN oscillates from error close to 200% then to error close to 100%. In the first place, I'm not even sure if an error above 100% is possible, much less 200%.

Below is my input file containing the commands and parameters to the NN :

CreateTraining: width:16,height:15,type:Brightness
Input: image:./faces/at33_straight_neutral_open.png, identity:shadesNone
Input: image:./faces/night/night_up_happy_sunglasses_4.png, identity:shades
Input: image:./faces/choon/choon_up_angry_open_4.png, identity:shadesNone
Input: image:./faces/cheyer/cheyer_left_angry_sunglasses_4.png, identity:shades
<more files...>
Network: hidden1:10, hidden2:10
Train: Mode:console, Minutes:1, StrategyError:0.25, StrategyCycles:100 
Whatis: image:./faces/tammo/tammo_right_sad_sunglasses_4.png
<more files...>

My initial guess was that either the actual images or the ideal values were not properly fed to the NN, but I checked the inputs (e.g. outputting the images and ideal values that I have read), and they were ok.

Now my hunch is that some directories (perhaps of the java library or where the input files are read) are not properly set. Below is my Eclipse Run Configuration:

  Classpath Tab
    Bootstrap Entries
      JRE System Library [jre7]
    User Entries
        encog-examples (default classpath)
          encog-examples
          encog-core-3.2.0-SNAPSHOT.jar \encog-examples\lib

Incidentally, I can't also properly run the Forest Cover example (which require an input file), while I can run the Lunar Lander and XOR examples (which don't require input files). This strengthens my assumption that my problem is directory-related.

Any help is much appreciated. Thanks.

Upvotes: 2

Views: 1032

Answers (2)

muppet
muppet

Reputation: 11

Ignore my post above, 3.2.0 works just fine.

I had same problem like newind27, network just seemed to not learn anything and error changing was going wild. After doing a bit more research I found that encog kinda hates pictures with too much white.

Solution that worked for me was reducing the brightness of pictures that were used for network learning. One way to do this (without destroying original image in the process) is using RescaleOp class with BufferedImage.

Other possible (not tested) solution could be changing the order of images that are being fed up to the network in learning process.

Upvotes: 1

muppet
muppet

Reputation: 1

seems to be bug with 3.2.0, had same problem try training network with 3.1.0, should fix it

Upvotes: 0

Related Questions