goglbridge.blogg.se

Vector code example
Vector code example







  1. #Vector code example update
  2. #Vector code example pro
  3. #Vector code example code

OpenROI(ROIfile) Extract examples and class values outExamples = ENVIExtractExamplesFromRaster(raster, rois) Normalize the data normalizedExamples = ENVIApplyGainOffsetToExamples( $ outExamples, $ OUTPUT_OFFSET=offset, $ OUTPUT_GAIN=gain) Print, 'Gain: ',gain Print, 'Offset: ',offset Shuffle the examples to create a random distribution shuffledExamples = ENVIShuffleExamples(normalizedExamples) Split the examples into training and evaluation sets splitExamples = ENVISplitExamples(shuffledExamples, $ SPLIT_FRACTION= 0.8) Define the SVM classifier inputs classifier = ENVISVMClassifier( $ NATTRIBUTES=outExamples.NATTRIBUTES, $ NCLASSES=outExamples.NCLASSES, $ CLASS_NAMES=outExamples.CLASS_NAMES) Define the trainer inputs trainer = ENVIIterativeTrainer( $ CONVERGENCE_CRITERION= 0.0001, $ MAXIMUM_ITERATIONS= 1) Train the classifier ENVITrainClassifier, trainer, classifier, splitExamples, $ LOSS_PROFILE=lossProfile Save the trained classifier to disk classifierURI = 'TrainedSVMClassifier.epo' classifier. OpenRaster(file) Open training data ROIs ROIfile = 'TrainingDataROIs.xml' rois = e.

#Vector code example pro

PRO SVMClassificationUsingObjects COMPILE_OPT IDL2 Start the application e = ENVI() Open an attribute raster to classify file = 'AttributeImage.dat' raster = e.

  • Save the file as SVMClassificationUsingObjects.pro.
  • classifierURI = 'TrainedSVMClassifier.epo'.
  • #Vector code example update

    Update the following line to include the full path where you will save the trained classifier:.Update the following lines to include the full path where you saved the sample data:.

    #Vector code example code

    Copy and paste the code into the IDL Editor.

    vector code example

    Get the sample data files from our ENVI Tutorials web page or from the ENVI Resource DVD in the classification directory.Prints a confusion matrix and accuracy metrics from the trained classifier.įollow these steps to run the code example:.Uses an iterative trainer to train a SVM supervised classifier.Splits the examples into training and evaluation sets.Shuffles the examples to create a random distribution of data.Normalizes the examples to a common range of data values.Extracts an ENVIExamples object from an attribute image and training data ROIs.This code example performs an end-to-end SVM classification using ENVI API objects.









    Vector code example