# Spectral Identification -- Methods

The PCCV Project:
Benchmarking Vision Systems

Overview
Tutorials
Methodology
Case studies
Test datasets
Our image file format
HATE test harness

Other stuff

We have looked at a number of different approaches to the spectral identification problem. These can be partitioned neatly into linear:

and non-linear: methods.

## Correlation

Cross-correlation can be used to compare the similarity of two sets of data. Hence, it can be used for identifying spectra by comparing a `test' spectrum with each `template' spectrum in a library of (say) laboratory-measured spectra. The template that best matches the test (i.e., that with the highest correlation) then identifies the test spectrum.

The problem with this is that test spectra may be formed from combinations of template spectra. When this happens, its ability to identify the constituents is poor.

## Numerical optimization

It is possible to frame the spectral identification problem as matching a weighted sum of the template spectra to the test spectrum. The problem then becomes a matter of determining the values of the weights -- which means we can formulate the problem as an optimization one.

To investigate the use of conventional, numerical optimization techniques, we looked at NAG routine E04JAF. This is described as an "easy-to-use, quasi-Newton algorithm for finding the minimum of a function subject to fixed upper and lower bounds on the independent variables using function values only." It is intended for functions which are continuous and which have continuous first and second derivatives (although it will usually work even if the derivatives have occasional discontinuities). For further details see the NAG library documentation. An `error type', which was output following the completion of each run, gave an indication as to the accuracy of the given solution. An error type of zero is best and indicates a good solution.

For our spectra, it was found that the error types were consistently non-zero and in most cases were 2 or 3; hence the results could not be viewed as satisfactory. The run time is also relatively slow. These results are poorer than those given by SVD and equivalent neural networks (see below), where unaltered single test spectra were always detected and did not give any false alarms. It was also shown that the choice of initial guesses can be significant in the solution and run-time of the routine.

This work demonstrated that this routine is not suitable for the type of work under consideration.

## Singular-value decomposition

SVD was developed as a general least-squares fitting algorithm and has been found to be useful in a variety of applications. (See Forsythe's book and Numerical Recipes for detailed discussions of the algorithm.)

For both sets of mineral spectra, excellent results were obtained for both individual spectra and linear combinations of spectra in the absence of noise. We found it to be less impressive when the test spectrum is subject to additive Gaussian noise. Furthermore, a non-linear weighting near the edges of the spectrum (characteristic of some types of instruments) caused problems.

For the ozone dataset, we linearly interpolated intermediate temperatures from the measured spectra and used SVD in such a way as to produce an estimate of the temperature. (This is because the ozone temperature is an important factor in governing the rates of ozone-depleting reactions in the stratosphere.) Good results were obtained under all tests, even with additive Gaussian noise.

The principal aim of this work is to devise a scheme that is capable of automatic spectral identification against a large library of template spectra. We have found that, in practice, there are cases where the weights determined by SVD are very small or negative: what is happening is that SVD is fitting both the data and the noise. Hence, we have devised an iterative technique wherein these small or negative contributions are discarded. The results from this iterative scheme are typically much better than from a single application of SVD, especially in the robustness to additive Gaussian noise and the above-mentioned non-linear weighting near the edges of the spectrum. For example, in the non-iterative procedure, in total we examined 250 test cases with varying noise levels and in 115 of them the correct spectrum was not uniquely identified. Using the iterative process, this ambiguity was reduced to 18 cases. These exceptions occured in 16 cases when the correct spectrum was not identified as being present at the first application of SVD and two cases where identification was lost during the iteration.

Significantly, we also found that the chi-squared value associated with SVD can be used to indicate whether the correct spectrum was identified or not following iteration. Hence using the iterative procedure, we can greatly improve spectral identification and the chi-squared value can flag the incorrectly identified cases.

## Neural networks

Although neural networks have been in existence for some time, they are only now being employed for this type of work. The driving force behind the popularity of both neural networks and genetic algorithms was the development of better algorithms and the availability of greater computer power. The software used to carry out the neural network study was BPS, which originates from George Mason University, USA; we found it pretty easy to use.

Various neural networks were trained with spectra from the initial database. If test spectra are made up of combinations of template spectra (only combinations of 2 and 3 spectra were considered here) then the neural network should be trained with examples of combinations. We found that equally-weighted combinations sufficed in the training data.

We found good results with this dataset and identification could be achieved even in the presence of large amounts of noise. The effectiveness of identification is not greatly changed should the training and test data be normalized to compensate for gain and/or offset uncertainties; linear gain and offset effects do cause the neural networks problems. For test spectra comprising combinations of unequally-weighted spectra, the larger-weighted spectrum will give too large an output and the lower-weighted spectrum too low an output.

For the ozone database the trained neural network gave good results especially for noisy test examples.

For the larger database the problem came down to training time. We did train a neural network on the 160 spectra of the larger mineral database but it took approximately 88 days to train. This did not include any combinations. However, this neural network was very good at identifying single noisy test cases.

While it can take a long time to train a network; once trained, tests can be performed very quickly even on small machines that could be taken out in the field.

## Genetic algorithms

Genetic algorithms were postulated in the early 1970s but also have only come to the fore recently. The software used to carry out this genetic algorithm study was GENESIS, a software package frequently mentioned in the genetic algorithm literature. We found GENESIS easy to use and it provides default parameter settings which are said to be robust for a variety of applications.

Initially, with the seven-spectra database, we were very encouraged by the overall good results. However, we did find that while normalized test and/or template spectra can still be used for spectra identification by genetic algorithm, the analysis needs extra-careful consideration.

Unfortunately our enthusiasm was dashed when we considered the large mineral database. We found that it was only possible to discriminate between 20 mineral spectra. This may be sufficient for some applications though the associated run-time of 19 minutes for 20 spectra (on an SGI Indy) will be prohibitively large in many applications. The hope of being able to handle up to 160 spectra was not met. The problem, of course, may be with the genetic algorithm program GENESIS and cleverer programming and optimization techniques may improve matters. However, the improvement will need to be large.