GRASS logo

NAME

m.neural_network.preparedata_part2 - Prepares tiled imagery and labelled data for training and application in a Neural Network (NN).

KEYWORDS

raster, vector, import, export, training, neural network, preparation

SYNOPSIS

m.neural_network.preparedata_part2
m.neural_network.preparedata_part2 --help
m.neural_network.preparedata_part2 tindex=name input_dir=name class_column=string class_values=integer[,integer,...] no_class_value=integer [reclassify_rules=name] [num_null_cells_label=integer] output=string [nprocs=integer] [--help] [--verbose] [--quiet] [--ui]

Flags:

--help
Print usage summary
--verbose
Verbose module output
--quiet
Quiet module output
--ui
Force launching GUI dialog

Parameters:

tindex=name [required]
tindex file for tiling.
must be created with m.neural_network.tindex
input_dir=name [required]
Name of the input directory with data prepared from part1 containing subfolders with imagery and optional ndom and/or labels per tile
Name of input directory
class_column=string [required]
Column of the label vector that holds the class number
Default: class_number
class_values=integer[,integer,...] [required]
Expected and output value for the class/es of interest
Default: 2
no_class_value=integer [required]
Expected and output value for the non class of interest areas
Can be understood as a "rest" class for a multiclass system and a "no-class" for a binary classification
Default: 1
reclassify_rules=name
If desired, file with rules for reclassification of input class values
Name of input file
num_null_cells_label=integer
Number of null cells in the rasterized label, which are accepted (will be filled with neighbouring classes).
This can be used to account for small acceptable gaps in the vector data, which would lead to null cells in the rasterized label.
Default: 0
output=string [required]
Name of the output directory
nprocs=integer
Number of threads for parallel computing
0: use OpenMP default; >0: use nprocs; <0: use MAX-nprocs
Default: 0

Table of contents

DESCRIPTION

m.neural_network.preparedata_part2 prepares imagery and optional elevation and/or labeled data for training or application of a neural network.

While
m.neural_network.preparedata_part1
initially provides a setup for labelling tiles of imagery,
m.neural_network.preparedata_part2 rasterizes the vector labels and
restructures the imagery data.

It uses the tindex created by m.neural_network.tindex to get information about application or training (and further training, validation, testing split) data

Notes

It is expected that all data lie in the directory structure and naming
format as created by
m.neural_network.preparedata_part1.
This data is provided to m.neural_network.preparedata_part2 via the
input_dir parameter.
m.neural_network.preparedata_part2 creates within given output-directory
following directories/data:

Always:
- singleband_vrts:: contains singleband .vrts for each imagery band of
each tile. They are stored here as a basis to create the tilewise
multiband .vrts.

If tileindex contains trainining data:
- train_images/ and val_images/ and optional test_images/:
contains tilewise multiband .vrt-files with all
imagery bands and optional a ndsm band to be used for training.
- train_masks/ and val_masks/ and optional test_masks/:
contains tilewise rasterized .tif label files to be used for training.

If tileindex contains application data:
- apply_images/:
contains tilewise multiband .vrt-files with all
imagery bands and optional an ndsm band to be used for application.

In order to save diskspace, all imagery is stored as .vrts, so the
original datasets (created by
m.neural_network.preparedata_part1)
should not be moved (or m.neural_network.preparedata_part2 should be
run again afterwards).

With the class_values and the no_class_value parameters, the user
defines the allowed range of values in the class_column of the
labelled data. In case an unexpected value is found, an error is thrown
which indicates the affected tile.

To ensure effective binary classification operators in case of two
output classes the first class in class_values is mapped to class 0.

If a tile is not completely covered either by class_values or
no_class_value, the not allocated areas will be filled with
no_class_value in the rasterized version.

EXAMPLES

Prepare training data

  m.neural_network.preparedata_part2 input_dir=/mnt/data/prepare_part1 tindex=/mnt/data/tindex.gpkg nprocs=6 class_column=class_number class_values=2 no_class_value=1 output=/mnt/data/prepare_part2

Prepare application data

  m.neural_network.preparedata_part2 input_dir=/mnt/data/prepare_part1 tindex=/mnt/data/tindex.gpkg nprocs=6 output=/mnt/data/prepare_part2

SEE ALSO

v.import,
g.region
r.mapcalc,
v.to.rast,

REQUIREMENTS

AUTHORS

Guido Riembauer, mundialis GmbH & Co. KG
Victoria-Leandra Brunn, mundialis GmbH & Co.
KG

SOURCE CODE

Available at: m.neural_network.preparedata_part2 source code (history)

Accessed: Sunday Nov 15 11:00:38 2026


Main index | Miscellaneous index | Topics index | Keywords index | Graphical index | Full index

© 2003-2026 GRASS Development Team, GRASS 8.5.1dev Reference Manual