Images will be encoded into three separate nodes when the neural network is created. Images can also be fragmented into parts in the Grid. Each part will be encoded separately.
This procedure is a step by step guide that produces a neural network using an image in the Grid.
For this exercise you will need a bitmap image file in which you can identify a component part. For example, a nose on a picture of a face, a car on a street, a tree in a garden, any distinctive object will do. The bitmap image will be entered into a new Grid where it will then be broken into fragments. The fragments will appear in a Grid Input column. An Output column will be created that will be associated with the fragments. The values in the associated column will be set to identify the fragment containing the component. The two columns will then be used to create a neural network.
Some of the steps in this procedure will be the same as those in the Getting Started topic but they will be repeated here.
Press the New toolbar button or use the File > New menu command to produce a new neural network,
An empty Grid with a vertical line, a horizontal line and an underline marker will appear. The marker shows the position where a Grid column and row will be produced.
Press the enter key and you will be asked "Create new Example row?" - answer Yes.
You will then be asked "Create new Input/Output column?" - answer Yes.
You have now created a training example with one input. The example has no name and no value.
Press the enter key again and you will open the Edit Grid dialog.
Type a word such as "picture" in the Value edit box. It is just a name to use for the image, it will be deleted later.
Click the Image radio button and press OK.
The Image File selection dialog will appear. Enter the location of your bitmap file or use Browse to locate it. Press OK when you have found your image.
The bitmap file will be selected, encoded and inserted into the Grid.
Double click the image in the Grid to open the Image dialog.
Press the Fragment button to open the first Fragment Image dialog. The bitmap file will already be in this dialog so just press OK to open the second dialog.
The entries in the second dialog are already set correctly so just press OK again.
The image will be fragmented into 16 parts and entered into the Grid. The first fragment will overwrite the original image which is no longer needed.
Press the right arrow key and then press enter.
You will be asked "Create new Input/Output column?" - answer Yes.
Press enter and you will open the EditGrid dialog again.
Click the Bool and Output radio buttons and press OK.
All the outputs need to be set to 'false' except the one that corresponds to the fragment containing the component part which is set to 'true'. It is possible to enter the values directly using the Edit Grid dialog but in this exercise we will use an association between the two columns. This will allow the Output column values to be edited while viewing the Input column fragments.
Press the left arrow key to move back to the Grid column that contains the fragments.
Select Associate Images... from the Edit menu to open the Associate Images dialog.
Enter 1 in the Input/Output column edit box and press OK.
The Image Fragment dialog can be opened either by double clicking the image fragment in the Grid or moving to the fragment and pressing enter.
Open the dialog for each fragment in turn. If the fragment contains the component part that you have chosen to identify then enter 't' in the associated value edit box. If the fragment does not contain the component part enter 'f'.
Use the Action > New Network menu command to open the New Network dialog.
Check Grow layer number 1 and press OK.
If you get a "Generating new network will reset learning." warning message answer Yes.
Answer Yes to the message "Do you want to set the controls?".
Check Optimize for both Learning Rate and Momentum and then press OK.
Answer Yes if you get the "Optimizing controls will reset learning." warning message.
The controls will be set and the neural network will be ready to learn the image fragments and associations that you have entered into the Grid.
Answer Yes to the message "Do you want it to start learning?".
The learning process should run to completion and stop automatically but it can be stopped by pressing the Stop toolbar button or using the Action > Stop menu command. If the learning process does not stop automatically then it is probably because the basic neural network that has been created cannot uniquely classify the fragment with your chosen component. The purpose of this exercise was only to introduce the use of images and fragments in the Grid and you have now used all the facilities. However, if you want to continue and make the neural network classify the component try using more hidden nodes. If that does not help, try two hidden layers. If it still does not work it may be that the component fragment you have chosen produces a similar value to other fragments when they are encoded.
Press the Query toolbar button or use the Query > Query menu command to open the Query dialog.
Press the Add Query button. Press OK in the Querying presets dialog. An example named "Query" will be generated and selected.
Select the Output and Start/Stop Cycle for a few seconds to check if the correct fragment is identified in the Inputs. The Output may be incorrect. It is usually possible to produce the correct Output by setting the Target Error to a lower value in the Controls dialog and then continuing Learning.
This method has been used successfully to identify the presence of cars on photographs of streets. The images were fragmented and then the associated bool value was set to true for each fragment that contained a whole side view of a car. After the network correctly identified the cars on three streets it could then identify similar car profiles on a number of other street photographs.