ArcGIS Desktop

  • ArcGIS Pro
  • ArcMap

  • My Profile
  • Help
  • Sign Out
ArcGIS Desktop

ArcGIS Online

The mapping platform for your organization

ArcGIS Desktop

A complete professional GIS

ArcGIS Enterprise

GIS in your enterprise

ArcGIS Developers

Tools to build location-aware apps

ArcGIS Solutions

Free template maps and apps for your industry

ArcGIS Marketplace

Get apps and data for your organization

  • Documentation
  • Support
Esri
  • Sign In
user
  • My Profile
  • Sign Out

ArcMap

  • Home
  • Get Started
  • Map
  • Analyze
  • Manage Data
  • Tools
  • Extensions

Inspect Training Samples

Available with Spatial Analyst license.

  • Summary
  • Usage
  • Syntax
  • Code sample
  • Environments
  • Licensing information

Summary

Estimates the accuracy of individual training samples. The cross validation accuracy is computed using the previously generated classification training result in an .ecd file and the training samples. Outputs include a raster dataset containing the misclassified class values and a training sample dataset with the accuracy score for each training sample.

Usage

  • The tool uses the input raster, an additional input raster, and the .ecd classifier definition file to produce an on-the-fly classification layer. This classification layer is then used as reference and compared to all training sample polygons or points. Since an ideal training sample should contain only pixels of the class it represents, the accuracy is computed by comparing all the correctly classified pixels with all the incorrectly classified pixels for each training sample. The accuracy score (per polygon or point) is computed as number of correctly classified pixels/number of total pixels contained in each training sample.

  • The score for polygon training samples is a decimal value that ranges from 0 to 1, where a value closer to 1 means it is more accurate. The score for point training samples is either 0 for inaccurate or 1 for accurate.

  • The results can be used in the following ways to improve training samples defining classes:

    • Use the attribute table of the output training sample to sort the training features by accuracy and zoom to each feature.
    • Use the misclassified raster class map to view where classification confusion exists and what is causing it.
    • Using this information, you can make a decision to keep, remove, or edit the training features.

Syntax

InspectTrainingSamples(in_raster, in_training_features, in_classifier_definition, out_training_feature_class, out_misclassified_raster, {in_additional_raster})
ParameterExplanationData Type
in_raster

The input raster to be classified.

Mosaic Layer; Raster Layer; Image Service; String
in_training_features

A training sample feature class created in the Training Samples Manager pane.

Feature Layer; Raster Catalog Layer
in_classifier_definition

The .ecd output classifier file from any of the train classifier tools. The .ecd file is a JSON file that contains attribute information, statistics, or other information needed for the classifier.

File
out_training_feature_class

The output individual training samples saved as a feature class. The associated attribute table contains an addition field listing the accuracy score.

Feature Class
out_misclassified_raster

The output misclassified raster having NoData outside training samples. In training samples, correctly classified pixels are represented as NoData, and misclassified pixels are represented by their class value. The results is an index map of misclassified class values.

Raster Dataset
in_additional_raster
(Optional)

Incorporate ancillary raster datasets, such as a multispectral image or a DEM, to generate attributes and other required information for the classifier. This raster will be needed when calculating attributes such as mean or standard deviation. This parameter is optional.

Mosaic Layer; Raster Layer; Image Service; String

Code sample

InspectTrainingSamples example 1 (Python window)

This example inspects the suitability of training samples for classification.

### InspectTrainingSamples example 1 (Python window)
import arcpy
from arcpy.sa import *

in_img = "C:/Data/wv2.tif"
trn_samples1 = "C:/out/ts.shp"
ecd = "C:/Data/svm.ecd"
seg_in_img = "C:/Data/seg.tif"
trn_samples2 = "C:/out/ts2.shp"

out_misclassified_raster = InspectTrainingSamples(in_img, trn_samples, ecd,
                                                  trn_samples2, seg_in_img); 
out_misclassified_raster.save("C:/temp/misclassified.tif")
InspectTrainingSamples example 2 (stand-alone script)

This example inspects the suitability of training samples for classification.

### InspectTrainingSamples example 2 (stand-alone script)
import arcpy
from arcpy.sa import *

out_misclassified_raster = InspectTrainingSamples("C:/Data/wv2.tif", 
                                                  "C:/out/ts.shp", 
                                                  "C:/Data/svm.ecd", 
                                                  "C:/out/ts2.shp", 
                                                  "C:/Data/seg.tif"); 
out_misclassified_raster.save("C:/temp/misclassified.tif")

Environments

  • Compression
  • Current Workspace
  • Extent
  • Geographic Transformations
  • NoData
  • Output CONFIG Keyword
  • Output Coordinate System
  • Parallel Processing Factor
  • Pyramid
  • Resampling Method
  • Scratch Workspace
  • Snap Raster
  • Raster Statistics
  • Tile Size

Licensing information

  • Basic: Requires Spatial Analyst
  • Standard: Requires Spatial Analyst
  • Advanced: Requires Spatial Analyst

Related topics

  • An overview of the Segmentation and Classification toolset
  • What is image classification?
  • Train Maximum Likelihood Classifier
  • Train Random Trees Classifier
  • Train Support Vector Machine Classifier
  • Classify Raster
  • Generate Training Samples From Seed Points

ArcGIS Desktop

  • Home
  • Documentation
  • Support

ArcGIS

  • ArcGIS Online
  • ArcGIS Desktop
  • ArcGIS Enterprise
  • ArcGIS
  • ArcGIS Developer
  • ArcGIS Solutions
  • ArcGIS Marketplace

About Esri

  • About Us
  • Careers
  • Esri Blog
  • User Conference
  • Developer Summit
Esri
Tell us what you think.
Copyright © 2021 Esri. | Privacy | Legal