Classify Pixels Using Deep Learning (Raster Analysis)

Summary

Runs a trained deep learning model on an input image to produce a classified raster published as a hosted imagery layer in your portal.

Illustration

Classify Pixels Using Deep Learning tool illustration

Usage

  • The raster analysis (RA) server Python environment must be configured with the proper deep learning framework Python API such as Tensorflow, CNTK, or something similar.

  • With this tool running, your RA server calls a third-party deep learning Python API (such as TensorFlow or CNTK) and uses the specified Python raster function to process each raster tile.

  • The input model of this tool will only take a deep learning package (.dlpk) item from the portal.

  • After the input model is selected or specified, the tool will obtain the model arguments information from the RA server. The tool may fail to obtain such information if your input model is invalid or your RA server isn’t properly configured with the deep learning framework.

Syntax

arcpy.ra.ClassifyPixelsUsingDeepLearning(inputRaster, inputModel, outputName, {modelArguments}, {processingMode})
ParameterExplanationData Type
inputRaster

The input image to classify. It can be an image service URL, a raster layer, an image service, a map server layer, or an Internet tiled layer.

Raster Layer; Image Service; MapServer; Map Server Layer; Internet Tiled Layer; String
inputModel

The input is a URL of a deep learning package (.dlpk) item. It contains the path to the deep learning binary model file, the path to the Python raster function to be used, and other parameters such as preferred tile size or padding.

File
outputName

The name of the image service of the classified pixels.

String
modelArguments
[modelArguments,...]
(Optional)

The function arguments are defined in the Python raster function class referenced by the input model. This is where you list additional deep learning parameters and arguments for experiments and refinement, such as a confidence threshold for adjusting the sensitivity. The names of the arguments are populated by the tool from reading the Python module on the RA server.

Value Table
processingMode
(Optional)

Specifies how all raster items in a mosaic dataset or an image service will be processed. This parameter is applied when the input raster is a mosaic dataset or an image service.

  • PROCESS_AS_MOSAICKED_IMAGEAll raster items in the mosaic dataset or image service will be mosaicked together and processed. This is the default.
  • PROCESS_ITEMS_SEPARATELYAll raster items in the mosaic dataset or image service will be processed as separate images.
String

Derived Output

NameExplanationData Type
outRaster

The output raster dataset.

Raster Layer

Code sample

ClassifyPixelsUsingDeepLearning example 1 (Python window)

This example classifies a raster based on a custom pixel classification using deep learning in a raster analysis deployment and publishes the raster as a hosted imagery layer in your portal.

import arcpy

arcpy.ClassifyPixelsUsingDeepLearning_ra(
        "https://myserver/rest/services/landclassification/ImageServer",
        "https://myportal/sharing/rest/content/items/itemId",
"classifiedLand", "padding 0")
ClassifyPixelsUsingDeepLearning example 2 (stand-alone script)

This example classifies a raster based on a custom pixel classification using deep learning in a raster analysis deployment and publishes the raster as a hosted imagery layer in your portal.

#---------------------------------------------------------------------------
# Name: ClassifyPixelsUsingDeepLearning_example02.py
# Requirements: ArcGIS Image Server
# Import system modules
import arcpy
# Set local variables
inImage = "https://myserver/rest/services/ landclassification/ImageServer"
inModel = "https://myportal/sharing/rest/content/items/itemId"
outName = "classifiedLand"
modelArgs = "padding 0"
# Execute Classified Pixels Using raster analysis tool
arcpy.ClassifyPixelsUsingDeepLearning_ra(inImage, inModel, outName, modelArgs)

Licensing information

  • Basic: Requires ArcGIS Image Server
  • Standard: Requires ArcGIS Image Server
  • Advanced: Requires ArcGIS Image Server

Related topics