Usage
Introduction
Our STD program has three different working modes:
- Demo mode
- This mode demonstrates how the STD algorithm works
with the default template patterns and a preset unknown
character pattern. Users do not need to provide any input in this mode.
- User mode - default template patterns
- This mode automatically loads the default template patterns
and requires the user to provide a bitmap file as the unknown character
pattern. The user also needs to manually start the algorithm.
- User mode - custom template patterns
- This mode requires the user to provide a set of template
patterns and an unknown character pattern. The user also
needs to manually start the algorithm.
The program is available for download here.
File Format
- Template patterns
- Each of the template pattern is a 100 by 100 24-bit bitmap
file with black strokes and white background. All the template patterns
must be placed under the same directory and have the file extension
".bmp" for the program to load successfully.
- Unknown character
- A unknown character has exactly the same format as a
template pattern. It is a 100 by 100 24-bit bitmap file with black
strokes and white background. The unknown character file does not
required to have the file extension ".bmp" since the user will specify
its full name. The unknown character file can be placed anywhere in the
system.
Running the Program
This program is written in matlab with graphical user interface.
To start the program, first switch the working directory of
matlab to the one that contains the "STDUI.fig" file and type STDUI and
press enter. The user should see the program main screen like the one
below.
Only the push buttons available at current step is enabled to avoid
confusion. Next we will explain how to run the three modes
step by step.
- Demo Mode
- Press the Demo button.
- The program automatically loads the default templates
from template directory and unknown pattern from unknown/A2.bmp
and start running the STD algorithm.
- The current training process is shown in 20 blocks in
the lower center and the number indicate the SOM network
corresponding to each template pattern. The features of unknown
patterns are plotted as red dots and the neurons for the
template patterns are plotted as blue dots. As time goes by,
there will be small green crosses adding to the graph. The
green crosses indicate the trace of the SOM training process; in other
words, it is the path the neurons move to match the unknown pattern.
- The upper center part displays the bar graph of scores at
each
iteration for all template patterns. The lower the score is the
more similar the template pattern to the unknown character because
the score is a distance measure between the two patterns. The listbox
on the right is a sorted list of the the bar graph.
- Once all iterations are done, the best matching result
is displayed in the lower left corner.
- User mode - default template
- Press the Use default template
button.
- The program loads the default template and indicates
the number of templates loaded in the text area in the lower left
corner.
- Fill in the path and file name of the unknown character
pattern in the text field below the Load Unknown
button and press the Load Unknown button. Both
relative and absolute path works.
- Press the Compare button. The
program should work as explained in the demo mode.
- User mode - custom template
- Fill in the directory path of the custom templates in
the text field below the Load custom template
button and press the Load custom template button.
- The program loads the custom template and indicates the
number of templates loaded in the text area in the lower left corner.
- Fill in the path and file name of the unknown character
pattern in the text field below the Load Unknown
button and press the Load Unknown button. Both
relative and absolute path works.
- Press the Compare button. The
program should work as explained in the demo mode.
Once the program finished running, the user can press the Reset
button to start a new trial.
Modify the Program Parameters
There are some adjustable parameter in the STD algorithm, such as
number of iterations, learning rate, neighborhood shrink factor and
input picture size. Those parameters are located in execSTD.m
which is the main algorithm body of this program. The default values
for each of the parameters are listed below. Feel free to change
them and observe what happens to the training process and result.
T = 100; % Maximum iterations
t = 0; % Current iteration
alpha = 0.1; % Learning rate
s = 1; % Current scaling factor of ellipse neighborhood
sfac = 0.9; % Shrink facotr of scaling factor
picw = 100; % Picture width
pich = 100; % Picture height