Skip to content

Commit 22c66d4

Browse files
authored
Add 3dtrees forestmamba (#1898)
* Add ForestMamba Galaxy wrapper * test: run ForestMamba wrapper on mikro fixture * fix: use ForestMamba GHCR image * fix: use v6 ForestMamba config * fix: use v6 config with existing ForestMamba image * feat: add ForestMamba Galaxy wrapper naming * docs: update ForestMamba shed description * fix: address ForestMamba wrapper review * fix: use ForestMamba input element identifier directly * fix: inline ForestMamba input filename * test: assert ForestMamba no-GPU failure * fix: address ForestMamba wrapper review comments * fix: simplify ForestMamba wrapper help * fix: trim ForestMamba help text * fix: escape ForestMamba numba cache env var * fix: collect ForestMamba outputs from work dir * fix: validate ForestMamba dimension names * fix: use markdown headings in ForestMamba help
1 parent 6ba31ee commit 22c66d4

3 files changed

Lines changed: 112 additions & 0 deletions

File tree

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
name: 3dtrees_forestmamba
2+
owner: bgruening
3+
description: Forest instance segmentation with ForestMamba.
4+
homepage_url: https://github.com/3dTrees-earth/3Dtrees_ForestMamba
5+
long_description: |
6+
Performs forest instance and semantic segmentation on LAZ/LAS point clouds using the
7+
ForestMamba model.
8+
remote_repository_url: https://github.com/bgruening/galaxytools/tree/master/tools/3dtrees_forestmamba
9+
type: unrestricted
10+
categories:
11+
- "Geo Science"
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
<tool id="3dtrees_forestmamba" name="3Dtrees: ForestMamba" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="24.2">
2+
<description>
3+
Forest instance and semantic segmentation of point clouds using the ForestMamba model.
4+
</description>
5+
<macros>
6+
<token name="@TOOL_VERSION@">1.0.0</token>
7+
<token name="@VERSION_SUFFIX@">0</token>
8+
</macros>
9+
<requirements>
10+
<container type="docker">ghcr.io/3dtrees-earth/3dtrees_forestmamba:@TOOL_VERSION@</container>
11+
</requirements>
12+
<command detect_errors="exit_code"><![CDATA[
13+
mkdir -p output_dir work_dir &&
14+
ln -s '$input' 'input.${input.ext}' &&
15+
python -u /workspace/src/run.py
16+
--dataset-path 'input.${input.ext}'
17+
--output-dir output_dir
18+
--work-dir work_dir
19+
--repo-dir /workspace
20+
--checkpoint /workspace/work_dirs/forestmamba_chm_radius16_qp300_2many_v6/v6_epoch_1500_fix.pth
21+
--config-base /workspace/configs/ForAINetv2/forestmamba_chm_radius16_qp300_2many_v6.py
22+
--preprocess-workers \${GALAXY_SLOTS:-1}
23+
--chunk-size '$chunk_size'
24+
--semantic-dim '$semantic_dim'
25+
--instance-dim '$instance_dim'
26+
--score-dim '$score_dim'
27+
--bluepoint-iterations '$bluepoint_iterations'
28+
#if $bluepoint_score_threshold:
29+
--bluepoint-score-threshold '$bluepoint_score_threshold'
30+
#end if
31+
--bluepoint-second-pass-threshold '$bluepoint_second_pass_threshold'
32+
--spatial-match-tolerance '$spatial_match_tolerance'
33+
]]></command>
34+
<environment_variables>
35+
<environment_variable name="NUMBA_CACHE_DIR">\$_GALAXY_JOB_TMP_DIR</environment_variable>
36+
<environment_variable name="WANDB_MODE">disabled</environment_variable>
37+
</environment_variables>
38+
<inputs>
39+
<param name="input" type="data" format="laz,las" label="Input LAZ/LAS point cloud" help="Point cloud to segment with ForestMamba."/>
40+
<param argument="--bluepoint-iterations" type="integer" min="0" max="5" value="0" label="Bluepoint iterations" help="0 keeps standard one-pass inference. 2 enables the dense-forest first/second bluepoint pass."/>
41+
<param argument="--bluepoint-score-threshold" type="float" min="0" max="1" value="" optional="true" label="Bluepoint score threshold" help="Optional model score_th override for bluepoint rounds."/>
42+
<param argument="--bluepoint-second-pass-threshold" type="float" min="0" max="1" value="0.01" label="Second pass threshold" help="Run the second bluepoint pass only when more than this fraction of first-pass points are non-ground with raw instance_pred == -1. Default 0.01 = 1%."/>
43+
<param argument="--spatial-match-tolerance" type="float" min="0" value="0.01" label="Spatial match tolerance" help="Maximum coordinate distance used when matching bluepoint predictions back to the input points."/>
44+
<param argument="--chunk-size" type="integer" min="1" value="1000000" label="LAZ write chunk size" help="Number of points processed per streamed LAZ read/write chunk."/>
45+
<param argument="--semantic-dim" type="text" value="PredSemantic_FM" label="Semantic prediction dimension" help="Output extra dimension name for ForestMamba semantic predictions.">
46+
<validator type="regex" message="Only letters, numbers, and underscores are allowed">^[A-Za-z0-9_]+$</validator>
47+
</param>
48+
<param argument="--instance-dim" type="text" value="PredInstance_FM" label="Instance prediction dimension" help="Output extra dimension name for ForestMamba instance predictions.">
49+
<validator type="regex" message="Only letters, numbers, and underscores are allowed">^[A-Za-z0-9_]+$</validator>
50+
</param>
51+
<param argument="--score-dim" type="text" value="PredScore_FM" label="Score prediction dimension" help="Output extra dimension name for ForestMamba confidence scores.">
52+
<validator type="regex" message="Only letters, numbers, and underscores are allowed">^[A-Za-z0-9_]+$</validator>
53+
</param>
54+
</inputs>
55+
<outputs>
56+
<data name="output" format="laz" from_work_dir="output_dir/input_forestmamba.laz" label="${tool.name} on ${on_string}: Segmented point cloud"/>
57+
<data name="summary" format="json" from_work_dir="output_dir/summary.json" label="${tool.name}: summary"/>
58+
</outputs>
59+
<tests>
60+
<!-- GitHub CI has no GPU, so this test is expected to fail there. -->
61+
<test expect_failure="true">
62+
<param name="input" value="mikro" ftype="laz"/>
63+
<assert_stderr>
64+
<has_text text="RuntimeError: No CUDA GPUs are available"/>
65+
</assert_stderr>
66+
</test>
67+
</tests>
68+
<help format="markdown">
69+
## What it does
70+
71+
This tool runs ForestMamba on one LAS/LAZ point cloud and writes a segmented
72+
LAZ output with ForestMamba prediction dimensions.
73+
74+
## Parameters
75+
76+
- **Input LAZ/LAS point cloud**: the point cloud to segment.
77+
- **Bluepoint iterations**: `0` runs the normal one-pass prediction. `2` enables
78+
the dense-forest bluepoint flow: first pass, then an optional second pass on
79+
points that remained unassigned.
80+
- **Bluepoint score threshold**: optional model confidence threshold override
81+
for bluepoint runs. Leave empty to use the model/config default.
82+
- **Second pass threshold**: fraction of first-pass non-ground points with raw
83+
`instance_pred == -1` required before the second bluepoint pass runs. The
84+
default `0.01` means more than 1%.
85+
86+
## Outputs
87+
88+
- Segmented LAZ with `PredSemantic_FM`, `PredInstance_FM`, and `PredScore_FM`
89+
by default.
90+
- JSON summary of the wrapper run.
91+
92+
Valid ForestMamba instance IDs are preserved. Raw negative instance IDs are
93+
written as `0` in the final LAZ.
94+
</help>
95+
<creator>
96+
<organization name="3Dtrees-Team, University of Freiburg" url="https://github.com/3dTrees-earth"/>
97+
</creator>
98+
<citations>
99+
<citation type="doi">10.48550/arXiv.2606.01549</citation>
100+
</citations>
101+
</tool>
101 KB
Binary file not shown.

0 commit comments

Comments
 (0)