19. Neural Filter II19.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
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.
The Neural Filter II matching will be done in several steps:
Let us look at each phase.
- Initialization
- Converting Images to Records if you have not done so in the BioFilter II
- Training
- Template Matching
Initialization
Initialization sets the ImageFinder parameters.TrainingWhen 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 InputNeural Filter II training requires the same input files as the BioFilter II. Training uses the data collected in advance to teach the Neural Filter II how to match. Training requires two files, d1.txt and match2.txt:
Template Matching
- D1.txt is the record file, which contains many records. Each image is converted into several records. A record represents features of a section of an image in a feature space.
- Match2.txt is a list of matching pairs. This file will teach the ImageFinder who will match with whom.
Both the BioFilter II and Neural Filter II will do the template matching.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:
- D1.txt is the record file, which contains many records. Each image is converted into several records. A record represents features of a section of an image in a feature space.
- Match2.txt is a list of matching pairs. This file will teach the ImageFinder who will match with whom.
BioFilter 2/Scan Images � File Input
BioFilter 2/Scan Images � Directory InputYou 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:
- Click the �Search Dir� button and select \9961400239.
- Click �BioFilter 2/Scan Images � Directory Input� to convert images into template records.
Edge Filters: Sobel 1We have prepared the d1.txt for you. Open biofilter2_d1.txt and save it to d1.txt.
Threshold Filters: Dark Background 128
Clean Up Filter: Small
BioFilter: CL
BioFilter II: CL1The 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:
- Click �Example/Neural Filter 2/Setting� to open the parameters;
- Click �Batch/Load� command to load parameters. At this point, the Neural Filter II is also trained.
- Click the �File Input� button and open �biofilter2_ex1_input.txt; you will see:
9961400239\9961400239 1001.jpg
9961400239\9961400239 1002.jpg- Click �BioFilter 2/Scan Images � File Input� to convert images into template records.
- Click �Neural Filter 2/1:N Match (First vs. Rest)� to make a 1:N Match.
C:\�\9961400239\9961400239 1001Like 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:
0 0
0 1
Match!
0 2
Match!
�
3 9
Match!
Image Match!The results are:
- Click �Neural Filter 2/N:N Match� to make a N:N Match.
C:\�\9961400239 1001This results show 9961400239 1001 matches 9961400239 1002, and 9961400239 1002 matches 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!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
- Click �Example/BioFilter 2/Label Match Setting� to open the parameters;
- Click �Batch/Load� command to load parameters. At this point, the BioFilter II is also trained.
- Click the �File Input� button and open �biofilter2_ex2_input.txt; you will see:
biofilter2_bad10/l01016key.jpgThe results are:
- Click �BioFilter 2/Scan Images � File Input� to convert images into template records.
- Click �BioFilter 2/1:N Match (First vs. Rest)� to make a 1:N Match.
C:\�\biofilter2_good10/l01016keyThis result is different from the BioFilter II result of the last chapter, which is:
�
1 3
No Match!
..
2 2
No Match!
2 3
No Match!
�
3 3
No Match!
�
4 3
No Match!
Image Does Not Match!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 ArchitectureIn 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:
BioFilterThe 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.
Neural Filter II.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 1 (1:N)�;
- Click �Batch/Run�.
Click �Example/NeuralFilter 2/Label example 2 (N:N)�;The operation for the third example is:
Click �Batch/Run�.Click �Example/NeuralFilter 2/Label example 3 (1:N)�;The results of these runs should match earlier results.
Click �Batch/Run�.
Return