Skip To Content ArcGIS for Developers Sign In Dashboard

Train Deep Learning Model

Description

Train Deep Learning Model

The TrainDeepLearningModel task is used to train a deep learning model using the output from the Export Training Data for Deep Learning tool. It generates the deep learning model package (*.dlpk) and adds it to your enterprise portal.

License:
As of 10.5, you must license your ArcGIS Server as an ArcGIS Image Server to use this resource.

Request parameters

ParameterDetails
in_folder

(Required)

This is the input location for the training sample data. It can be the path of output location on the file share raster data store or a shared file system path. The training sample data folder needs to be the output of Export Training Data For Deep Learning tool, containing images and labels folders, as well as the JSON model definition file written out together by the tool.

File share raster store path examples:

in_folder=/rasterStores/yourRasterStoreFolderName/trainingSampleData

in_folder=/fileShares/yourFileShareFolderName/trainingSampleData

File share path example:

in_folder=\\serverName\deepLearning\trainingSampleData

output_name

(Required)

The output trained .dlpk name. If the .dlpk item already exists, the portal item ID can be given to the service tool. The output path of the .dlpk file that is generated will be used to update the existing .dlpk item. The output .dlpk file is stored and shared on the hosting server and uploaded to your portal.

output_name={"name": "trainedModel"}
output_name={"name": "trainedModel", "folderId":"dfwerfbd3ec25584d0d8f4"}

model_type

(Required)

The model type to use for training the deep learning model.

Syntax: A JSON object describes the raster type. The supported value keywords are as follows:

  • SSD—The Single Shot Detector (SSD) is used for object detection.
  • UNET—U-Net is used for pixel classification.
  • FEATURE_CLASSIFIER—The Feature Classifier is used for object classification.
  • PSPNET—The Pyramid Scene Parsing Network (PSPNET) is used for pixel classification.
  • RETINANET—The RetinaNet is used for object detection.
  • MASKRCNN—The MarkRCNN is used for object detection.

Example

model_type=SSD

arguments

(Optional)

The name of the value pairs of arguments and their values that can be customized by the clients.

Example

arguments={"name1": "value1", "name2": "value2"}

batch_size

(Optional)

The number of training samples to be processed for training at one time. If the server has a powerful GPU, this number can be increased to 16, 36, 64, and so on.

Example

batch_size=4

max_epochs

(Optional)

The maximum number of epochs for training the model. One epoch means the whole training dataset will be passed forward and backward through the deep neural network once.

Example

max_epochs=20

learning_rate

(Optional)

The rate at which the weights are updated during the training. It is a small positive value in the range between 0.0 and 1.0. If the learning rate is set to 0, it will extract the optimal learning rate from the learning curve during the training process.

Example

learning_rate=0

backbone_model

(Optional)

Specifies the preconfigured neural network to be used as an architecture for training the new model. Supported values include the following:

  • RESNET34—Residual network with 34 layers
  • RESNET50—Residual network with 50 layers

Example

backbone_model=RESNET34

validation_percent

(Optional)

The percentage of training sample data that will be used for validating the model.

Example

validation_percent=10

pretrained_model

(Optional)

The pretrained model to be used for fine tuning the new model. It is a .dlpk portal item.

Example

pretrained_model={"itemId": "8cfbd3ec25584d0d8fed23b8ff7c43b"}

stop_training

(Optional)

Specifies whether early stopping will be implemented.

  • true—The model training will stop when the model is no longer improving, regardless of the maximum epochs specified. This is the default.
  • false—The model training will continue until the maximum epochs is reached.

Example

stop_training=false

context

(Optional)

Environment settings that affect task execution. This task has the following settings:

  • Extent (extent)—A bounding box that defines the analysis area.
  • Cell Size (cellSize)—The output raster will have the resolution specified by cell size.
  • Processor Type (processorType)—The specified processor (CPU or GPU) will be used for the analysis.

Example

context={"cellSize": "20", "processorType": "GPU"}

f

The response format. The default response format is html.

Values: html | json

Example usage

The following is a sample request URL for TrainDeepLearningModel:

https://services.myserver.com/arcgis/rest/services/System/RasterAnalysisTools/GPServer/TrainDeepLearningModel

Response

When you submit a request, the task assigns a unique job ID for the transaction.

Syntax:

{ "jobId": "<unique job identifier>", "jobStatus": "<job status>" }

After the initial request is submitted, you can use the jobId to periodically check the status of the job and messages as described in Checking job status. Once the job has successfully completed, use the jobId to retrieve the results. To track the status, you can make a request of the following form:

https://<rasterAnalysisTools-url>/TrainDeepLearningModel/jobs/<jobId>

When the status of the job request is esriJobSucceeded, you can access the results of the analysis by making a request of the following form:

https://<rasterAnalysisTools-url>/TrainDeepLearningModel/jobs/<jobId>/results/outObjects

JSON Response example

The response returns the .dlpk portal item, which has properties for title, type, filename, file, id, and folderId.

{
  "title": "dlpk_name",
  "type": "Deep Learning Package",
  "multipart": True,
  "tags": "imagery" 
  "typeKeywords": "Deep Learning, Raster"
  "filename": "dlpk_name",
  "file": "\\servername\rasterstore\mytrainedmodel.dlpk",
  "id": "f121390b85ef419790479fc75b493efd",
  "folderId": "dfwerfbd3ec25584d0d8f4"
}