Overview
|
Logs
|
GitHub
m.neural_network.train
NAME
m.neural_network.train - Trains a neural network for semantic segmentation including the steps for initial training and finetuning.
KEYWORDS
raster ,
training ,
finetuning ,
neural network ,
classification
SYNOPSIS
m.neural_network.train
m.neural_network.train --help
m.neural_network.train data_dir =name img_size =integer in_channels =integer [out_classes =integer ] [model_arch =string ] [encoder_name =string ] [encoder_weights =string ] [epochs =integer ] [batch_size =integer ] [input_model_path =string ] output_model_path =string output_train_metrics_path =string [--help ] [--verbose ] [--quiet ] [--ui ]
Flags:
--help
Print usage summary
--verbose
Verbose module output
--quiet
Quiet module output
--ui
Force launching GUI dialog
Parameters:
data_dir =name [required]
Name of the input data directory containing subfolders with training data
Name of input directory
img_size =integer [required]
Image size in pixels
Default: 512
in_channels =integer [required]
Number of channels used as input for classification: R-G-B-I-ndsm (default 5)
Default: 5
out_classes =integer
Number of classes for classification: tree/ no-tree (default 2)
Default: 2
model_arch =string
Model architecture for classification (default Unet)
Default: Unet
encoder_name =string
Encoder for the classification (default resnet34)
Default: resnet34
encoder_weights =string
Weights for encoder (default imagenet)
Default: imagenet
epochs =integer
Number of training epochs (default 50)
Default: 50
batch_size =integer
Number of tiles used per training unit (default 8)
Default: 8
input_model_path =string
Name of the input model directory for finetuning.
output_model_path =string [required]
Name of the output model directory.
output_train_metrics_path =string [required]
Name of the output directory containing the metrics of the training.
m.neural_network.train trains or fine-tunes a neural network using the
segmentation_models.pytorch
framework for semantic segmentation.
A new model can be trained by specifying the options
img_size , out_classes , model_arch ,
encoder_name , encoder_weights , in_channels .
A locally saved model can be further trained (fine-tuned) by giving the
path to the previously saved model. For more information about available
encoder-decoder combinations, see the smp documentation.
A larger batchsize is generally better for training, but
requires more GPU RAM. A bit of experimentation is needed to find a
batch size that still fits into the GPU RAM.
It is expected that all data lie in the directory structure and naming
format as created by
m.neural_network.preparedata_part1 .
m.neural_network.train data_dir=path/to/data/train/ output_model_path=path/to/model
v.import ,
g.region
r.mapcalc ,
v.to.rast ,
Victoria-Leandra Brunn,
mundialis GmbH & Co. KG
SOURCE CODE
Available at:
m.neural_network.train source code
(history )
Accessed: Monday Jul 27 12:26:22 2026
Overview
|
Logs
|
GitHub
m.neural_network.train
Main index |
Miscellaneous index |
Topics index |
Keywords index |
Graphical index |
Full index
© 2003-2026
GRASS Development Team ,
GRASS 8.5.1dev Reference Manual