Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

import option 'train neural network' #89

Merged
merged 3 commits into from
Jan 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 25 additions & 1 deletion grass-gis-addons/m.import.rvr/m.import.rvr.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<h2>DESCRIPTION</h2>

<em>m.import.rvr</em> imports data for the processing of <b>buildings analysis</b>,
<b>green roofs</b> and/or <b>trees analysis</b>.
<b>green roofs</b>, <b>trees analysis</b> and/or ><b>neural network</b>.

The module takes as options the paths to the input directories and files.
With the flag <b>-c</b> the module checks only if all required input options
Expand Down Expand Up @@ -35,12 +35,21 @@ <h2>DESCRIPTION</h2>
<li><b>trees analysis</b>
<ul>
<li>True digital orthophotos (TOP): GTIFF files from given directory <b>top_dir</b> imported and resampled to 0.2 m</li>
<li>Reference buildings: imported from given vector file <b>reference_buildings_file</b> or from openNRW if <b>-b</b> is set</li>
<li>Digital surface model (DSM): LAZ files from given directory <b>dsm_dir</b> imported and resampled to 0.2 m</li>
<li>Digital terrain model (DTM): from given raster file <b>dtm_file</b>, or tiles from a directory with XYZ files, or if not set from openNRW imported and resampled to 0.2 m </li>
<li>Normalized Difference Vegetation Index (NDVI): calculated on the basis of <b>TOP</b> and scaled to 0 to 255</li>
<li>Normalized Digital Surface Model (nDSM): calculated on the basis of <b>DSM</b> and <b>DTM</b></li>
</ul>
</li>
<li><b>neural network</b>
<ul>
<li>True digital orthophotos (TOP): GTIFF files from given directory <b>top_dir</b> imported and resampled to 0.2 m</li>
<li>Digital surface model (DSM): LAZ files from given directory <b>dsm_dir</b> imported and resampled to 0.2 m</li>
<li>Digital terrain model (DTM): from given raster file <b>dtm_file</b>, or tiles from a directory with XYZ files, or if not set from openNRW imported and resampled to 0.2 m </li>
<li>Normalized Digital Surface Model (nDSM): calculated on the basis of <b>DSM</b> and <b>DTM</b></li>
</ul>
</li>
</ul>

<h2>REQUIREMENTS</h2>
Expand Down Expand Up @@ -102,6 +111,21 @@ <h3>Import data for trees analysis for Herne 2020</h3>
dtm_file=${DATAFOLDER}/DGM/2020_Herne_DGM10_100m_Puffer.tif
</pre></div>

<h3>Import data for neural network label traindata for Sonsbeck 2020</h3>

<div class="code"><pre>
CITY=Sonsbeck
YEAR=2020
BEFLIEGUNG="08-05"
DATA_DIR="/media/mundialis_daten/projekte/rvr_grassgis-addon-wartung/Testdaten"
CITY_DIR="${DATA_DIR}/${CITY}"
m.import.rvr type="neural network" \
area=/media/mundialis_daten/projekte/rvr_grassgis-addon-wartung/Testdaten/Sonsbeck/study_area_4x4km_Sonsbeck.gpkg \
dtm_file="${CITY_DIR}/${YEAR}/${BEFLIEGUNG}/DGM1/TIFF_corrected/MOSAIC/DGM1_${CITY}_${YEAR}_corrected.tif" \
dsm_dir="${CITY_DIR}/${YEAR}/${BEFLIEGUNG}/2_5D" \
top_dir="${CITY_DIR}/${YEAR}/${BEFLIEGUNG}/TOP"
</pre></div>


<h2>SEE ALSO</h2>

Expand Down
24 changes: 16 additions & 8 deletions grass-gis-addons/m.import.rvr/m.import.rvr.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,14 @@
#############################################################################

# %Module
# % description: Import data for the processing of buildings analysis, green roofs detection and/or trees analysis.
# % description: Import data for the processing of buildings analysis, green roofs detection, trees analysis and/or neural network.
# % keyword: raster
# % keyword: vector
# % keyword: import
# % keyword: trees analysis
# % keyword: buildings analysis
# % keyword: green roofs
# % keyword: neural network
# %end

# %option
Expand All @@ -33,7 +34,7 @@
# % required: yes
# % multiple: yes
# % label: Type of processing for which the data should be imported
# % options: buildings analysis,green roofs,trees analysis
# % options: buildings analysis,green roofs,trees analysis,neural network
# % guisection: General input
# %end

Expand All @@ -48,7 +49,7 @@
# % key: dsm_dir
# % multiple: no
# % label: Directory where the digital surface model (DSM) is stored as laz files
# % description: Required for the processing types buildings analysis, green roofs detection and trees analysis
# % description: Required for the processing types buildings analysis, green roofs detection, trees analysis and neural network
# % guisection: General input
# %end

Expand All @@ -66,7 +67,7 @@
# % required: no
# % multiple: no
# % label: Directory where XYZ files of the digital terrain model (DTM) are stored (leave empty to automatically download DTM from Open.NRW)
# % description: Required for the processing types buildings analysis, green roofs detection and trees analysis
# % description: Required for the processing types buildings analysis, green roofs detection, trees analysis and neural network
# % guisection: General input
# %end

Expand All @@ -75,7 +76,7 @@
# % required: no
# % multiple: no
# % label: Raster file (e.g. TIF) of the digital terrain model (DTM) (leave empty to automatically download DTM from Open.NRW)
# % description: Required for the processing types buildings analysis, green roofs detection and trees analysis
# % description: Required for the processing types buildings analysis, green roofs detection, trees analysis and neural network
# % guisection: General input
# %end

Expand Down Expand Up @@ -166,7 +167,7 @@
# % required: no
# % multiple: no
# % label: Directory where the true digital orthophots (TOPs) are stored as GeoTiffs
# % description: Required for the processing of trees analysis
# % description: Required for the processing of trees analysis and neural network
# % guisection: Input trees analysis
# %end

Expand Down Expand Up @@ -284,6 +285,13 @@
"dtm": ([0.2], "ndsm", False, "dtm_file", "rasterORxyz"),
"ndsm": ([0.2], "output", True, "", "ndsm"),
},
"neural network": {
# raster
"top": ([0.2], "output,ndvi", True, "top_dir", "rasterdir"),
"dsm": ([0.2], "ndsm", True, "dsm_dir", "lazdir"),
"dtm": ([0.2], "ndsm", False, "dtm_file", "rasterORxyz"),
"ndsm": ([0.2], "output", True, "", "ndsm"),
},
}


Expand Down Expand Up @@ -592,8 +600,8 @@ def check_data(ptype, data, val):
"""Checks if all required data are set and the data files or folder
exists.
Args:
ptype (str): processing type (buildings analysis, green roofs or
trees analysis)
ptype (str): processing type (buildings analysis, green roofs,
trees analysis or neural network)
data (str): Name or type of the data
val (tuple): Tuple with values of the data: (resolution, purpose,
required, needed input information, import
Expand Down
Loading