Disponible con licencia de Image Analyst.
Resumen
Entrena un modelo de aprendizaje profundo utilizando la salida de la herramienta Exportar datos de entrenamiento para aprendizaje profundo.
Uso
This tool trains a deep learning model using deep learning frameworks.
Para configurar su equipo para usar marcos de aprendizaje profundo en ArcGIS Pro, consulte Instalar marcos de aprendizaje profundo para ArcGIS.
This tool can also be used to fine-tune an existing trained model. For example, an existing model that has been trained for cars can be fine-tuned to train a model that identifies trucks.
To run this tool using GPU, set the Processor Type environment to GPU. If you have more than one GPU, specify the GPU ID environment instead.
The input training data for this tool must include the images and labels folders that are generated from the Export Training Data For Deep Learning tool.
Para obtener información sobre los requisitos para ejecutar esta herramienta y los problemas que pueden presentarse, consulte Preguntas frecuentes sobre el aprendizaje profundo.
Para obtener más información sobre el aprendizaje profundo, consulte Aprendizaje profundo en ArcGIS Pro.
Sintaxis
TrainDeepLearningModel(in_folder, out_folder, {max_epochs}, {model_type}, {batch_size}, {arguments}, {learning_rate}, {backbone_model}, {pretrained_model}, {validation_percentage}, {stop_training}, {freeze})
Parámetro | Explicación | Tipo de datos |
in_folder | The folder containing the image chips, labels, and statistics required to train the model. This is the output from the Export Training Data For Deep Learning tool. To train a model, the input images must be 8-bit rasters with three bands. | Folder |
out_folder | The output folder location that will store the trained model. | Folder |
max_epochs (Opcional) | The maximum number of epochs for which the model will be trained. A maximum epoch of one means the dataset will be passed forward and backward through the neural network one time. The default value is 20. | Long |
model_type (Opcional) | Specifies the model type to use to train the deep learning model.
| String |
batch_size (Opcional) | The number of training samples to be processed for training at one time. The default value is 2. If you have a powerful GPU, this number can be increased to 8, 16, 32, or 64. | Long |
arguments [arguments,...] (Opcional) | Los argumentos de función se definen en la clase de función ráster de Python. Aquí es donde enumera los argumentos y parámetros de aprendizaje profundo adicionales para experimentos y refinamiento, como un umbral de confianza para ajustar la sensibilidad. Los nombres de los argumentos se rellenan a partir de la lectura del módulo de Python. When you choose SSD as the model_type parameter value, the arguments parameter will be populated with the following arguments:
When you choose any of the pixel classification models such as PSPNET, UNET, or DEEPLAB as the model_type parameter value, the arguments parameter will be populated with the following arguments:
When you choose RETINANET as the model_type parameter value, the arguments parameter will be populated with the following arguments:
All model types support the chip_size argument, which is the chip size of the tiles in the training samples. The image chip size is extracted from the .emd file from the folder specified in the in_folder parameter. | Value Table |
learning_rate (Opcional) | The rate at which existing information will be overwritten with newly acquired information throughout the training process. If no value is specified, the optimal learning rate will be extracted from the learning curve during the training process. | Double |
backbone_model (Opcional) | Specifies the preconfigured neural network to be used as an architecture for training the new model. This method is known as Transfer Learning.
| String |
pretrained_model (Opcional) | The pretrained model to be used for fine-tune training the new model. The input is an Esri Model Definition file (.emd) or a deep learning package file (.dlpk). A pretrained model with similar classes can be fine-tuned to fit the new model. The pretrained model must have been trained with the same model type and backbone model that will be used to train the new model. | File |
validation_percentage (Opcional) | The percentage of training samples that will be used for validating the model. The default value is 10. | Double |
stop_training (Opcional) | Specifies whether early stopping will be implemented.
| Boolean |
freeze (Opcional) | Specifies whether the backbone layers in the pretrained model will be frozen, so that the weights and biases remain as originally designed.
| Boolean |
Salida derivada
Nombre | Explicación | Tipo de datos |
out_model_file | The output trained model file. | File |
Muestra de código
This example trains a tree classification model using the U-Net approach.
# Import system modules
import arcpy
from arcpy.ia import *
# Check out the ArcGIS Image Analyst extension license
arcpy.CheckOutExtension("ImageAnalyst")
# Execute
TrainDeepLearningModel(r"C:\DeepLearning\TrainingData\Roads_FC",
r"C:\DeepLearning\Models\Fire", 40, "UNET", 16, "# #", None,
"RESNET34", None, 10, "STOP_TRAINING", "FREEZE_MODEL")
This example trains an object detection model using the SSD approach.
# Import system modules
import arcpy
from arcpy.ia import *
# Check out the ArcGIS Image Analyst extension license
arcpy.CheckOutExtension("ImageAnalyst")
#Define input parameters
in_folder = "C:\\DeepLearning\\TrainingData\\Cars"
out_folder = "C:\\Models\\Cars"
max_epochs = 100
model_type = "SSD"
batch_size = 2
arg = "grids '[4, 2, 1]';zooms '[0.7, 1.0, 1.3]';ratios '[[1, 1], [1, 0.5], [0.5, 1]]'"
learning_rate = 0.003
backbone_model = "RESNET34"
pretrained_model = "C:\\Models\\Pretrained\\vehicles.emd"
validation_percent = 10
stop_training = "STOP_TRAINING"
freeze = "FREEZE_MODEL"
# Execute
TrainDeepLearningModel(in_folder, out_folder, max_epochs, model_type,
batch_size, arg, learning_rate, backbone_model, pretrained_model,
validation_percent, stop_training, freeze)
Entornos
Información de licenciamiento
- Basic: Requiere Image Analyst
- Standard: Requiere Image Analyst
- Advanced: Requiere Image Analyst