Mapping and Classification of Trees Outside Forests using Deep Learning
Organizations: Osnabrück University, Institute for Computer Science, Remote Sensing Osnabrück, Germany · Leibniz Institute for Agricultural Engineering and Bioeconomy, System Process Engineering, Germany · Osnabrück University, Institute of Cognitive Science, Artificial Intelligence, Germany · Osnabrück University, Joint Lab Artificial Intelligence and Data Science, Germany
Abstract
Trees Outside Forests (TOF) play an important role in agricultural landscapes by supporting biodiversity, sequestering carbon, and regulating microclimates. Yet, most studies have treated TOF as a single class or relied on rigid rule-based thresholds, limiting ecological interpretation and adaptability across regions. To address this, we evaluate deep learning for TOF classification using a newly generated dataset and high-resolution aerial imagery from four agricultural landscapes in Germany. Specifically, we compare convolutional neural networks (CNNs), vision transformers, and hybrid CNN-transformer models across six semantic segmentation architectures (ABCNet, LSKNet, FT-UNetFormer, DC-Swin, BANet, and U-Net) to map four categories of woody vegetation: Forest, Patch, Linear, and Tree, derived from previous studies and governmental products. Overall, the models achieved good classification accuracy across the four landscapes, with the FT-UNetFormer performing best (mean Intersection-over-Union 0.74; mean F1 score 0.84), underscoring the importance of spatial context understanding in TOF mapping and classification. Our results show good results for Forest and Linear class and reveal challenges particularly in classifying complex structures with high edge density, notably the Patch and Tree class. Our generalization experiments highlight the need for regionally diverse training data to ensure reliable large-scale mapping. The dataset and code are openly available at https://github.com/Moerizzy/TOFMapper
Figures & tables
| State | Acquisition | Tree | Forest | TOF | Patch | Linear | Tree |
| Date | Cover(%) | (%) | (%) | (%) | (%) | (%) | |
| BB | 19.07.2022 | 19.4 | 16.5 | 2.9 | 0.6 | 1.7 | 0.6 |
| NRW_N | 15.06.2022 | 13.1 | 7.4 | 5.7 | 1.5 | 2.9 | 1.3 |
| NRW_S | 11.08.2023 | 44.0 | 38.2 | 5.8 | 1.2 | 3.1 | 1.5 |
| SH | 14.06.2021 | 14.2 | 7.7 | 6.5 | 1.2 | 3.9 | 1.4 |
| Overall | – | 22.7 | 17.5 | 5.2 | 1.1 | 2.9 | 1.2 |
| Area (m²) | Width (m) | Elongation | ||||
| Class | Mean | Median | Mean | Median | Mean | Median |
| Forest | 103502.40 | 11435.58 | 188.54 | 111.98 | 2.03 | 1.76 |
| Patch | 981.93 | 556.70 | 30.87 | 24.79 | 1.78 | 1.70 |
| Linear | 1688.04 | 759.24 | 31.98 | 19.03 | 4.52 | 3.72 |
| Tree | 44.44 | 20.24 | 5.90 | 4.71 | 1.51 | 1.28 |
| Model | Parameters | Architecture |
| ABCNet | 13.6 M | Bilateral CNN with spatial and contextual paths ( Li et al., 2021 ) |
| BANet | 12.7 M | Parallel Transformer and CNN paths ( Wang et al., 2021 ) |
| DC-Swin | 66.9 M | Swin Transformer encoder with dense decoder ( Wang et al., 2022a ) |
| FT-UNetFormer | 96.0 M | Full Transformer with Swin encoder ( Wang et al., 2022b ) |
| LSKNet | 14.4 M | CNN with Large Selective Kernel modules ( Li et al., 2023b ) |
| U-Net | 44.6 M | Encoder-decoder CNN with skip connections ( Ronneberger et al., 2015 ) |
| Section | Hyper-parameter | Value / Setting |
| Hardware | GPUs | 4 × NVIDIA A100 (40 GB) |
| Iterations / epoch | 6 750 | |
| Augment | Photometric | Random brightness, contrast saturation, hue |
| Geometric | H/V flip, rotation (±15°) | |
| Regularisation | Coarse dropout | |
| Optimise | Optimiser | AdamW + Lookahead |
| Dataset | Training, Validation | Test |
| Combination 1 | SH, NRW_N, NRW_S | BB |
| Combination 2 | SH, BB, NRW_S | NRW_N |
| Combination 3 | SH, NRW_N, BB | NRW_S |
| Combination 4 | BB, NRW_N, NRW_S | SH |
| Mean | Forest | Patch | Linear | Tree | ||||||
| Model | mIoU | mF1 | IoU | F1 | IoU | F1 | IoU | F1 | IoU | F1 |
| ABCNet | 0.709 0.037 | 0.821 0.025 | 0.944 0.032 | 0.971 0.058 | 0.532 0.067 | 0.695 0.056 | 0.739 0.063 | 0.850 0.042 | 0.622 0.011 | 0.767 0.009 |
| BANet | 0.656 0.025 | 0.777 0.022 | 0.937 0.058 | 0.967 0.032 | 0.422 0.081 | 0.593 0.082 | 0.689 0.027 | 0.816 0.019 | 0.575 0.025 | 0.730 0.021 |
| DC-Swin | 0.714 0.019 | 0.824 0.018 | 0.949 0.037 | 0.974 0.020 | 0.570 0.075 | 0.726 0.065 | 0.751 0.017 | 0.858 0.011 | 0.586 0.023 | 0.727 0.019 |
| FT-UNetFormer | 0.739 0.016 | 0.843 0.012 | 0.952 0.045 | 0.975 0.024 | 0.606 0.055 | 0.754 0.044 | 0.774 0.020 | 0.872 0.013 | 0.626 0.019 | 0.770 0.015 |
| LSKNet | 0.697 0.016 | 0.812 0.013 | 0.943 0.047 | 0.971 0.026 | 0.545 0.058 | 0.705 0.052 | 0.718 0.030 | 0.836 0.020 | 0.582 0.016 | 0.736 0.013 |
| Ground Truth | Classification Results | ||||
| Background | Forest | Patch | Linear | Tree | |
| Background | 99.17 | 0.37 | 0.07 | 0.24 | 0.16 |
| Forest | 1.34 | 97.94 | 0.23 | 0.40 | 0.09 |
| Patch | 5.61 | 8.11 | 73.19 | 9.16 | 3.93 |
| Linear | 5.05 | 4.70 | 1.37 | 86.34 | 2.54 |
| Tree | 11.78 | 1.65 | 3.27 | 5.01 | 78.28 |
| Class | GT Area (ha) | Pred. Area (ha) | Bias (%) |
| Background | 1549.72 | 1548.02 | |
| Forest | 347.97 | 359.40 | |
| Patch | 22.95 | 15.30 | |
| Linear | 70.07 | 64.20 | |
| Tree | 17.16 | 20.95 |
| Metric | Class | SH | BB | NRW_N | NRW_S |
| IoU | Forest | 0.97 | 0.96 | 0.88 | 0.96 |
| Patch | 0.59 | 0.51 | 0.61 | 0.64 | |
| Linear | 0.79 | 0.80 | 0.77 | 0.75 | |
| Tree | 0.62 | 0.59 | 0.63 | 0.64 | |
| F1 | Forest | 0.99 | 0.98 | 0.93 | 0.98 |
| Patch | 0.74 | 0.68 | 0.76 | 0.78 |
| Class | SWF (ha) | Pred. (ha) | Pred. vs SWF | Intersection (ha) | IoU |
| Linear | 85.39 | 63.93 | 31.62 | ||
| Patch | 4.05 | 15.23 | 0.91 |
| Metric | Class | SH | BB | NRW_N | NRW_S |
| IoU | Forest | 0.94 (-0.03) | 0.91 (-0.05) | 0.86 (-0.02) | 0.89 (-0.07) |
| Patch | 0.36 (-0.23) | 0.38 (-0.13) | 0.48 (-0.13) | 0.47 (-0.17) | |
| Linear | 0.71 (-0.08) | 0.59 (-0.21) | 0.74 (-0.03) | 0.53 (-0.22) | |
| Tree | 0.44 (-0.18) | 0.46 (-0.13) | 0.52 (-0.11) | 0.47 (-0.17) | |
| F1 | Forest | 0.97 (-0.02) | 0.95 (-0.03) | 0.92 (-0.01) | 0.94 (-0.04) |
| Patch | 0.52 (-0.22) | 0.55 (-0.13) | 0.65 (-0.11) | 0.64 (-0.14) |
Appendix figures & tables4 assets
Supplementary material from the paper’s appendix.
Appendix
| Input | mIoU | mF1 | mPrecision | mRecall |
| RGB | 0.732 | 0.838 | 0.840 | 0.833 |
| RGB+NIR | 0.735 | 0.841 | 0.838 | 0.839 |
| RGB+nDSM | 0.764 | 0.863 | 0.857 | 0.866 |
| RGB+NIR+nDSM | 0.754 | 0.856 | 0.862 | 0.847 |
| Class | IoU | F1 | Precision | Recall |
| Forest | 0.904 ( ) | 0.949 ( ) | 0.977 ( ) | 0.922 ( ) |
| Patch | 0.623 ( ) | 0.774 ( ) | 0.727 ( ) | 0.825 ( ) |
| Linear | 0.779 ( ) | 0.875 ( ) | 0.922 ( ) | 0.830 ( ) |
| Tree | 0.674 ( ) | 0.816 ( ) | 0.785 ( ) | 0.850 ( ) |
| Mean | 0.750 ( ) | 0.856 ( ) | 0.851 ( ) | 0.863 ( ) |