Available with Spatial Analyst license.
Summary
Uses a remote sensing image to convert labeled vector or raster data into deep learning training datasets. The output is a folder of image chips, and a folder of metadata files in the specified format.
Usage
This tool will create training datasets to support third party deep learning applications, such as Google TensorFlow or Microsoft CNTK.
Use your existing classification training sample data, or GIS feature class data such as a building footprint layer, to generate image chips containing the class sample from your source image. Image chips are often 256 pixel rows by 256 pixel columns, unless the training sample size is larger.
Deep learning class training samples are based on small subimages containing the feature or class of interest, called an image chip.
Syntax
ExportTrainingDataForDeepLearning (in_raster, out_folder, in_class_data, image_chip_format, {tile_size_x}, {tile_size_y}, {stride_x}, {stride_y}, {output_nofeature_tiles}, {metadata_format}, {start_index})
Parameter | Explanation | Data Type | |||||||||||||||||||||||||||
in_raster | Input source imagery, typically multispectral imagery. Examples of the type of input source imagery include multispectral satellite, drone, aerial or National Agriculture Imagery Program (NAIP) imagery. | Raster Dataset; Raster Layer | |||||||||||||||||||||||||||
out_folder | Specify a folder where the output image chips and metadata will be stored. | Directory | |||||||||||||||||||||||||||
in_class_data | Labeled data, either in vector or raster form. Vector inputs should follow a training sample format as generated by the ArcGIS Desktop Image Classification toolbar. Raster inputs should follow a classified raster format as generated by the Classify Raster tool. | Feature Dataset; Feature Layer; Raster Dataset; Raster Layer | |||||||||||||||||||||||||||
image_chip_format | The raster format for the image chip outputs.
| String | |||||||||||||||||||||||||||
tile_size_x (Optional) | The size of the image chips, for the X dimension. | Long | |||||||||||||||||||||||||||
tile_size_y (Optional) | The size of the image chips, for the Y dimension. | Long | |||||||||||||||||||||||||||
stride_x (Optional) | The distance to move in the X when creating the next image chip. When stride is equal to the tile size, there will be no overlap. When stride is equal to half of the tile size, there will be 50% overlap. | Long | |||||||||||||||||||||||||||
stride_y (Optional) | The distance to move in the Y when creating the next image chip. When stride is equal to the tile size, there will be no overlap. When stride is equal to half of the tile size, there will be 50% overlap. | Long | |||||||||||||||||||||||||||
output_nofeature_tiles (Optional) | Choose if the image chips with overlapped labeled data will be exported.
| Boolean | |||||||||||||||||||||||||||
metadata_format (Optional) | The format of the output metadata labels. There are 3 options for output metadata labels for the training data, KITTI Rectangles, PASCAL VOC rectangles and Classified Tiles (a class map). If your input training sample data is a feature class layer such as building layer or standard classification training sample file, use the KITTI or PASCAL VOC rectangle option. The output metadata is a .txt file or .xml file containing the training sample data contained in the minimum bounding rectangle. The name of the metadata file matches the input source image name. If your input training sample data is a class map, use the Classified Tiles as your output metadata format option.
The table below describes the 15 values in the KITTI metadata format. Only five of the possible fifteen values are used in the tool; the class name (in column 1), and the minimum bounding rectangle comprised of four image coordinate locations (columns 5-8). The minimum bounding rectangle encompasses the training chip used in the deep learning classifier.
For more information, see KITTI metadata format . An example of the PASCAL VOC is shown below.
For more information, see PASCAL Visual Object Classes. | String | |||||||||||||||||||||||||||
start_index (Optional) | Allows you to set the start index for the sequence of image chips. This lets you append more image chips to an existing sequence. The default value is 0. | Long |
Code sample
ExportTrainingDataForDeepLearning example 1 (Python window)
This example creates training samples for deep learning.
from arcpy.sa import *
ExportTrainingDataForDeepLearning("c:/test/image.tif", "c:/test/outfolder",
"c:/test/training.shp", "TIFF", "256",
"256", "128", "128", "NO", "KITTI_rectangles")
ExportTrainingDataForDeepLearning example 2 (stand-alone script)
This example creates training samples for deep learning.
# Import system modules and check out ArcGIS Spatial Analyst extension license
import arcpy
arcpy.CheckOutExtension("Spatial")
from arcpy.sa import *
# Set local variables
inRaster = "c:/test/image.tif"
out_folder = "c:/test/outfolder"
in_training = "c:/test/training.shp"
image_chip_format = "TIFF"
tile_size_x = "256"
tile_size_y = "256"
stride_x="128"
stride_y="128"
output_nofeature_tiles="NO"
metadata_format="KITTI_rectangles"
# Execute
ExportTrainingDataForDeepLearning(inRaster, out_folder, in_training,
image_chip_format,tile_size_x, tile_size_y,
stride_x, stride_y,output_nofeature_tiles,
metadata_format)
Environments
Licensing information
- ArcGIS Desktop Basic: Requires Spatial Analyst
- ArcGIS Desktop Standard: Requires Spatial Analyst
- ArcGIS Desktop Advanced: Requires Spatial Analyst