19.   Neural Filter II
19.1   Overview
19.2   Training
19.3   1:N and N:N Matching Examples
19.4   1:N  Examples
19.5   Two-Layer Neural Net Architecture



19.   Neural Filter II

The BioFilter II will find about 80% of the unmatched images and the Neural Filter II will find an additional 19%, leaving only about 1% of the unmatched images for the ABM Filter II.

This chapter will demonstrate how Neural Filter II works using the same examples of the last chapter. Again, the problem is to compare the newly capture images with several previously stored images. These images are basically identical with some minor differences. The data is entered via an input file or input directory. The first image is the newly captured and the rest are previously stored images. These images are converted into templates in the last chapter. The matching is based on these templates.

Figure 19.1   NeuralFilter2 Menu.

Operating Neural Filter II is exactly the same as the BioFilter II. The Neural Filter II is more accurate than the BioFilter II.

19.1   Overview

The Neural Filter II matching will be done in several steps:

Let us look at each phase.

Initialization

Initialization sets the ImageFinder parameters.

When Converting Images to Records if you have not done so in the BioFilter II, use these two commands:

BioFilter 2/Scan Images � File Input
BioFilter 2/Scan Images � Directory Input

Training Template Matching
Both the BioFilter II and Neural Filter II will do the template matching.


19.2   Training

Training teaches the Neural Filter II what to look for. Each filter is trained differently.

If you have done the BioFilter II training in the last chapter, all you have to do is to click �NeuralFilter 2\Train (match2.txt required)� to train the Neural Filter II.

Both the BioFilter II training and Neural Filter II training, require two files, d1.txt and match2.txt:

These two files for training are fixed; you cannot change the names of these two files. You obtain d1.txt automatically, as you run the following commands:

BioFilter 2/Scan Images � File Input
BioFilter 2/Scan Images � Directory Input

You have to prepare match2.txt for each problem, which has the same format as match.txt. Please read the last chapter to see the format of this file.

The data used for training consists of 50 matching pairs. The data is in \Biofilter2_good. You must prepare d1.txt in piecemeal for 2 reasons:

(1) The BioFilter II will use the first image in the input file or a directory to determine the region of interest. Because the images are different in size, you have to convert each image separately.

(2) It will take a long time to convert images into BioFilter II templates if many images are used, because the BioFilter II keeps all images in RAM.

For example, to generate d1.txt for images in folder �.\9961400239\�,

All examples in this chapter use the same setting. You can click �Example/Neural Filter 2/Setting� to open the parameters and then, click �Batch/Load� command to load. If you want to work manually, here are the parameters:
Edge Filters: Sobel 1
Threshold Filters: Dark Background 128
Clean Up Filter: Small
BioFilter: CL
BioFilter II: CL1
We have prepared the d1.txt for you. Open biofilter2_d1.txt and save it to d1.txt.

The second training file is match2.txt, which specifies who should match with whom. This file is already prepared for you. Go to the ImageFinder folder. (The default folder is C:\program files\Attrasoft\ImageFinder 6.0\�and open the file, biofilter2_match2.txt. Save it to match2.txt (overwrite the existing file). Now the training file is prepared.

To train the Neural Filter II, click �Neural Filter 2/Train (match2.txt required)�. Now the Neural Filter II is trained for the Label Recognition problem. You can save the trained results by clicking �Batch/Save�.

19.3   1:N and N:N Matching Examples

1:N Matching compares the first image in the template file, d1.txt, with the rest of the images in the file; the d1.txt, in turn, is generated by the input file or input directory.

The examples here are the same as the last chapter. The images used in the examples can be seen from the last chapter.

The data used in this example will be in biofilter2_ex1_input.txt. Operations for 1:N Matching:

The results look like this:
C:\�\9961400239\9961400239 1001
0 0
0 1
Match!
0 2
Match!

3 9
Match!
Image Match!
Like the BioFilter II, the Neural Filter II divides the images into smaller sections. In this example, the sections are 00, 01, � 39. Here section (0,0) is the upper left corner. The output shows the matching result in each section.  The above example shows the �newly captured image�, 9961400239\9961400239 1001.jpg, matches the �previously stored image�, 9961400239\9961400239 1002.jpg, in all sections. We now continue the example: The results are:
C:\�\9961400239 1001
0 0
Match!
0 1
Match!
0 2
Match!

3 9
Match!
Image Match!

C:\�\9961400239 1002
0 0
Match!
0 1
Match!
0 2
Match!

3 9
Match!
Image Match!

This results show 9961400239 1001 matches 9961400239 1002, and 9961400239 1002 matches 9961400239 1001.

19.4   1:N  Matching Examples

In this section, we will present an example, which does 'Not Match'. The input file is biofilter2_ex2_input.txt. The operations are:

biofilter2_good10/l01016key.jpg
biofilter2_bad10/l01016key.jpg The results are:
C:\�\biofilter2_good10/l01016key

1 3
No Match!
..
2 2
No Match!
2 3
No Match!

3 3
No Match!

4 3
No Match!
Image Does Not Match!
This result is different from the BioFilter II result of the last chapter, which is:
C:\�\biofilter2_good10/l01016key
0 0
Match!

1 3
No Match!

3 3
No Match!

6 0
No Match!

Image Does Not Match!


19.5   Two-Layer Neural Net Architecture

In the last two sections, we presented a Matching example and a Non-Matching example, using the Neural Filter II alone. The examples in section use the two-layered Neural Network Architecture:

BioFilter
Neural Filter II.
The objective is to compare two basically identical images, and identify the minor differences. Two different images do not fall into this category. The BioFilter will serve to get rid off different images and the Neural Filter II will identify the minor differences.

The three examples used in this section are 1:N Match, N:N Match in section 3, and 1:N Match in section 4. This process will take many steps; the batch job is perfect for this type of work.

The operation for the first example is:

Two files will be opened: b1.txt is the result of the BioFilter and e1.txt is the results of Neural Filter II. The operation for the second example is:
Click �Example/NeuralFilter 2/Label example 2 (N:N)�;
Click �Batch/Run�.
The operation for the third example is:
Click �Example/NeuralFilter 2/Label example 3 (1:N)�;
Click �Batch/Run�.
The results of these runs should match earlier results.
Return