llrftrain(3)

LIBRARY ROUTINE
llrftrain - Trains on an image for the weights used in the Localized Receptive Field classifier.

LIBRARY CALL
#include "vinclude.h"
int
llrftrain (image, cc_img, var_img, cn_img, wt_img, converge, meu, border, max_iter, prt_mse, delta_mse, printdev)
struct  xvimage  *image,         /* input image */
                 *cc_img,        /* cluster center image */
                 *var_img,       /* cluster variance image */
                 *cn_img,        /* cluster number image */
                 **wt_img;       /* output LRF weight image */
float   converge,                /* convergence parameter */
        meu,                     /* weight update parameter */
        delta_mse;               /* MIN delta MSE value */
int     border,                  /* input image border width */
        max_iter,                /* MAX iterations to perform */
        prt_mse;                 /* interval to print MSE to stats file */
FILE   *printdev;

INPUT

image
    the input image used for training.

cc_img
    the cluster center image specifying the cluster centers.

var_img
    the cluster variance image specifying the variances.

cn_img
    the cluster number image specifying which vector/pixel belongs to which cluster.

converge
    the convergence parameter.

meu the weight update parameter.

border
    the border width in pixels of the input image.

max_iter
    the maximum number of iterations until termination.

prt_mse
    the iteration interval for printing the MSE to the stats file.

delta_mse
    the minimum change in the MSE between iterations, for termination.

OUTPUT

wt_img
    the resulting weight image after training.

printdev
    the file containing the training statistics.

This routine was written with the help of and ideas from Dr. Don Hush, University of New Mexico, Dept. of EECE.

MODIFICATIONS

DESCRIPTION
lrftrain trains on an image for the weights used with the Localized Receptive Field classifier (see lrfclass). The Localized Receptive Field (LRF) is based on a single layer of self-organizing, "localized receptive field" units, followed by a single layer perceptron. The single layer of perceptron units use the LMS or Adaline learning rule to adjust the weights.

LRF network theory

The basic network model of the LRF consists of a two layer topology. The first layer of "receptive field" nodes are trained using a clustering algorithm, such as K-means, or some other algorithm which can determine the receptive field centers. Each node in the first layer computes a receptive field response function, which should approach zero as the distance from the center of the receptive field is increased. The second layer of the LRF model sums the weighted outputs of the first layer, which produces the output or response of the network. A supervised LMS rule is used to train the weights of the second layer nodes.

The response function of the LRF network is formulated as follows:
             f(x) = SUM(Ti * Ri(x)) where,
      Ri(x) = Q( ||x - xi|| / Wi )
      x - is a real valued vector in the input space,
      Ri - is the ith receptive field response function,
      Q - is a radially symmetric functio with a single
            maximum at the origin, decreasing to zero at
            large radii,
      xi - is the center of the ith receptive field,
      Wi - is the width of the ith receptive field,
      Ti - is the weight associated with each receptive field.

The receptive field response functions ( Ri(x) ), should be formulated such that they decrease rapidly with increasing radii. This ensures that the response functions provide highly localized representations of the input space. The response function used here is modeled after the gaussian, and uses the trace of the covariance matrix to set the widths of the receptive field centers.

The weights for the output layer are found using the LMS learning rule. The weights are adjusted at each iteration to minimize the total error, which is based on the difference between the network output and the desired result.

Prior to using the LRF algorithm, it is necessary to run "vkmeans" on the input training image to fix the cluster centers, followed by a supervised classification of the clustered image, which assigns a desired class to each cluster center. NOTE that the image resulting from the supervised classification MUST be appended to the "cluster center" image before running the LRF. This is necessary since it makes the appropriate desired class assignments to the cluster centers for the training phase of the LRF.

The number of receptive field response nodes in the first layer of the LRF is determined by the number of cluster centers in the "cluster center" image. The number of output classes, and hence the number of output nodes in the second (ie. last) layer, is determined by the number of desired classes that was specified in the "supervised" classification phase of the clustering. This information is contained in the last band of the cluster center image. The number of weights in the network is determined by the number of receptive field response nodes and the number of output nodes. That is,
  #Wts = (#rf_response_nodes * #output_nodes) + #output_nodes

Input Arguments

The following arguments must be specified in the following order when calling this lib routine:

image
    is the original input image, which may be a multi-band image containing all of the feature bands used in the classification. This image MUST be of data storage type FLOAT.

cc_img
    is the "cluster center" image, which specifies the cluster center locations in the feature space. This image MUST contain the desired class information, obtained from the supervised classification step, as the last band in the image. Therefore this image will contain one more band than the input image. This image MUST be of data storage type FLOAT.

var_img
    is the "cluster variance" image, which specifies the variances of the data associated with each cluster center. This image should contain the same number of data bands as the input image. This image MUST be of data storage type FLOAT.

cn_img
    is the "cluster number" image, which specifies which vector or pixel belongs to what cluster. This image will be a single band image of the same dimensions as the input image. This image MUST be of data storage type INTEGER.

converge
    is a float value that specifies the convergence value for the algorithm. When the current MSE value reaches the specified convergence value, the algorithm will terminate. This can be any float value greater than or equal to zero.

meu is a float value that specifies the weight update parameter for the learning algorithm. This value can be adjusted from 0 to 1. NOTE: this parameter may have a significant affect on the rate of learning, and it may have to be adjusted several times to get a feel for the optimum learning rate.

border
    is an integer that specifies the border width, in pixels, encompassing the desired region of the image to be classified. This region is ignored during the classification process.

max_iter
    is an integer that specifies the maximum number of iterations that the algorithm will run before terminating. It can be any integer value greater than zero.

prt_mse
    is an integer specifying the iteration interval used to print the mean squared error (MSE) to the output statistics file. If this value is left at zero (the default), only the MSE of the first iteration is written to the file. Any other integer will cause the value of the MSE to be written to the statistics file at the iteration interval specified.

delta_mse
    is a float value that specifies the minimum change in the MSE value from one iteration to the next. This parameter may be used to terminate the algorithm when the change in the MSE is zero or very small, but the MSE has not yet reached the specified convergence value (-cv). This may occurr when the learning has reached a "plateau" or "bench" and is no longer learning.

Output Arguments

wt_img
    contains the resulting "weights" for the LRF network after training on the input data. The number of data bands in this image will be equal to the number of (nodes + 1) in the LRF network. The number of columns in each band will be equal to the number of desired/output classes for the LRF network. This image will be stored as data storage type FLOAT.

printdev
    is a file specified by the printdev argument that contains the statistics for the training phase of the LRF.

This routine was written with the help of and ideas from Dr. Don Hush, University of New Mexico, Dept. of EECE.

SEE ALSO
lrftrain(1), intro(3), vipl(3), verror(3), vutils(3) llrfclass(3)

RESTRICTIONS
All input images except the "cluster number" image (cn_img) MUST be of data storage type FLOAT. The "cluster number" image (cn_img) MUST be of data storage type INTEGER. The output "weight" image (wt_img) is of data storage type FLOAT.

AUTHOR
Tom Sauer and Charlie Gage

COPYRIGHT
Copyright 1991, University of New Mexico. All rights reserved.