NNCLASS

Neural-network classification


EnvironmentsPYTHON :: EASI :: MODELER
Quick linksDescription :: Parameters :: Parameter descriptions :: Details :: Examples :: Related

Back to top

Description


NNCLASS uses a back-propagation neural-network segment created by NNCREAT and trained by NNTRAIN to classify multispectral imagery.
Back to top

Parameters


nnclass(file, dbnns, dboc, probchan, mask, nullclas)

Name Type Caption Length Value range
FILE * str Input-file name 1 -    
DBNNS * List[int] Input neural-network segment 1 - 1  
DBOC * List[int] Output classification channel or channels 1 - 254  
PROBCHAN List[int] Output probability channel 0 - 254  
MASK List[int] Area mask 0 - 4  
NULLCLAS str Null Class (YES|NO) 0 - 3 YES | NO
Default: YES

* Required parameter
Back to top

Parameter descriptions

FILE

The name of the PCIDSK image file to process.

DBNNS

The neural-network segment (type 180) trained as a classifier by NNTRAIN.

NNCLASS processes the image channels listed in the neural-network segment as the input image data. If an untrained neural network with zero training iterations is specified, NNCLASS will not run.

DBOC

The output image channel or channels that receive the classification results. The first channel holds the most likely class, the second channel the second most likely class, and so on. Typically, however, only one output channel is specified.

Up to 254 channels can be handled and up to 48 values can be specified.

The number of output channels cannot exceed the number of output units (training site bitmaps) defined for the neural network.

At least one channel must be specified. Duplicate channels are not allowed.

PROBCHAN

The output channels in which to store estimated probabilities (values between 0.0 and 100.0) that a pixel belongs to the class to which it was assigned. For each specified output-classification channel (DBOC), you can specify a corresponding probability channel for PROBCHAN.

This function handles up to 254 channels and you can specify up to 48 integer values; however, the number of values you specify cannot exceed that of the output-classification channels (DBOC).

Duplicate channels cannot be defined for DBOC (OutputNN) and PROBCHAN (Probability).

The values generated represent a measure that approximates the true statistical probability. The value generated for a pixel is calculated as the activation value of the output unit for the selected class divided by the activation of all output units for that pixel.

The range of values varies according to the number of output classes: more output classes decrease the range. Higher values, generally, are produced for classes that are well trained; therefore, the probability values produced can be considered relative to the range of probability values produced.

If a second probability channel is specified, it contains the value of the second most active output unit divided by the activation of all output units for that pixel position, and so on.

This parameter is optional.

MASK

The window or bitmap that defines the area to be processed and classified.

If a single value is specified, it represents the channel number of the bitmap segment in the input file. Only the pixels of the bitmap are processed; the rest of the image remains unchanged.

If four values are specified, they define the x,y offsets and x,y dimensions of a rectangular window identifying the area to process. Xoffset, Yoffset define the upper-left starting pixel coordinates of the window. Xsize is the number of pixels that define the window width. Ysize is the number of lines that define the window height.

If no value is specified, the entire channel is processed.

This parameter is optional.

NULLCLAS

Specifies whether pixels can be assigned to the NULL class (value 0).

Available options are:
Back to top

Details

NNCLASS classifies multispectral imagery using a back-propagation neural network created by NNCREAT and trained by NNTRAIN.

The input PCIDSK image file (FILE) contains the image channels that receive the output-classification results (DBOC), the input neural-network segment (DBNNS) that defines the trained back-propagation neural network to use, and the input-image channels to process. In addition, output channels for storing the probabilities that each pixel belongs to a class (PROBCHAN) can also be specified.

The classification can be restricted to those pixels beneath a specified rectangular window or bitmap mask (MASK). If no mask is specified, each pixel in the image is classified.

The NULLCLAS (Null Class) parameter specifies whether to create a NULL class (YES) where none of the pixels belong to any output class, or whether to assign each pixel to one of the output classes (NO).

Before running NNCLASS, you must first run NNCREAT and NNTRAIN according to the descriptions in the corresponding Help topic for each.

Back to top

Examples

This example uses the neural network created by NNCREAT and trained by NNTRAIN.

The training bitmaps, input imagery, and output-class values used for the neural network are the same as those used for the maximum likelihood classification (MLC) example; therefore, the output from MLC and NNCLASS can be compared.

First, perform the classification using MLC (from the Multispectral Analysis component).

from pci.mlc import mlc

file	=	"irvine.pix"
maxl	=	"FULL"	# Full Maximum Likelihood mode
sigfile =	"" # signatures from file
dbs1	=	list(range(17, 24 + 1))	# eight signature segments
dboc	=	[7]	# output MLC theme map to channel 7
probchan=	[]	# default: no probability results
mask	=	[]	# default: process entire image
nullclas=	""	# default: allow for a NULL class

mlc( file, maxl, sigfile, dbs1, dboc, probchan, mask, nullclas )

Now, perform the classification using the back-propagation neural network.

from pci.nnclass import nnclass

file	=	"irvine.pix"
dbnns   = [] # replace this with the dbnns returned by nncreat()
dboc	=	[8]	# output the class most likely
probchan=	[9]	# probability of class most likely
mask	=	[]	# default: process entire image
nullclas=	""	# default: allow for a NULL class

nnclass( file, dbnns, dboc, probchan, mask, nullclas )

Compare the output from the maximum likelihood classification (MLC) with the neural-network classification. Use the pseudocolor table for the output classes to display the classification results.

© PCI Geomatics Enterprises, Inc.®, 2026. All rights reserved.