joshvm commited on
Commit
4c1d611
1 Parent(s): ce860a3

update readme and plots

Browse files
Files changed (3) hide show
  1. README.md +185 -0
  2. segm_AP50.png +0 -0
  3. total_loss.png +0 -0
README.md ADDED
@@ -0,0 +1,185 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ library_name: transformers
3
+ tags:
4
+ - instance-segmentation
5
+ - vision
6
+ - ecology
7
+ datasets:
8
+ - restor/tcd
9
+ pipeline_tag: image-segmentation
10
+ widget:
11
+ - src: samples/610160855a90f10006fd303e_10_00418.tif
12
+ example_title: Urban scene
13
+ license: cc
14
+ metrics:
15
+ - map50
16
+ ---
17
+
18
+ # Model Card for Restor's Mask-RCNN-based TCD models
19
+
20
+ This is an instance segmentation model that can delineate tree cover in high resolution (10 cm/px) aerial images.
21
+
22
+ This repository is for `tcd-mask-rcnn-r50`
23
+
24
+ ## Model Details
25
+
26
+ ### Model Description
27
+
28
+ This instance segmentation model was trained on global aerial imagery and is able to accurately delineate tree cover in similar images. The model does can detect individual trees, but only in open canopy imagery. It cannot detect individual trees in dense forest where most trees are touching. The main use case for this model is monitoring early stage restoration projects pre canopy-closure.
29
+
30
+ - **Developed by:** [Restor](https://restor.eco) / [ETH Zurich](https://ethz.ch)
31
+ - **Funded by:** This project was made possible via a (Google.org impact grant)[https://blog.google/outreach-initiatives/sustainability/restor-helps-anyone-be-part-ecological-restoration/]
32
+ - **Model type:** Instance segmentation (2-class)
33
+ - **License:** This model was trained on CC BY-NC imagery and we release under the same license.
34
+ - **Finetuned from model:** Mask-RCNN
35
+
36
+ [Mask-RCNN](https://arxiv.org/abs/1703.06870) is a reference instance segmentation architecture that remains popular, although there are several newer architectures that offer compelling performance.
37
+
38
+ ### Model Sources
39
+
40
+ - **Repository:** https://github.com/restor-foundation/tcd
41
+ - **Paper:** We will release a preprint shortly.
42
+
43
+ ## Uses
44
+
45
+ The primary use-case for this model is asessing canopy cover from aerial images (i.e. percentage of study area that is covered by tree canopy). Since the model can detect individual trees, it can also be used to assess crown size and morphology.
46
+
47
+ ### Direct Use
48
+
49
+ This model is suitable for inference on a single image tile. For performing predictions on large orthomosaics, a higher level framework is required to manage tiling source imagery and stitching predictions. Our repository provides a comprehensive reference implementation of such a pipeline and has been tested on extremely large images (country-scale).
50
+
51
+ The model will give you predictions for an entire image. In most cases users will want to predict cover for a specific region of the image, for example a study plot or some other geographic boundary. If you predict tree cover in an image you should perform some kind of region-of-interest analysis on the results. Our linked pipeline repository supports shapefile-based region analysis.
52
+
53
+ ### Out-of-Scope Use
54
+
55
+ While we trained the model on globally diverse imagery, some ecological biomes are under-represented in the training dataset and performance may vary. We therefore encourage users to experiment with their own imagery before using the model for any sort of mission-critical use.
56
+
57
+ The model was trained on imagery at a resolution of 10 cm/px. You may be able to get good predictions at other geospatial resolutions, but the results may not be reliable. In particular the model is essentially looking for "things that look like trees" and this is highly resolution dependent. If you want to routinely predict images at a higher or lower resolution, you should fine-tune this model on your own or a resampled version of the training dataset.
58
+
59
+ This model does not predict all trees. Our dataset contains two labels: individual trees and groups of trees. The model cannot delineate all trees in situations where tree crowns are touching. However, it is still usable for coverage estimation if you include the `canopy` class.
60
+
61
+ The model does not predict biomass, canopy height or other derived information. It only predicts the likelihood that a polygonal region represents a tree or group of trees.
62
+
63
+ As-is, the model is not suitable for carbon credit estimation.
64
+
65
+ ## Bias, Risks, and Limitations
66
+
67
+ As mentioned above, this model is targeted towards individual tree crown delineation where the canopy has not closed. This is useful, for example, for time-series analysis of newly planted conservation/restoration projects where repeat imagery is available. You should not use this model for tree counting applications in closed canopy forest.
68
+
69
+ A limitation of this model is false positives over objects that look like, or could be confused as, trees. For example large bushes, shrubs or ground cover that looks like tree canopy.
70
+
71
+ The model does not make species predictions.
72
+
73
+ The dataset used to train this model was annotated by non-experts. We believe that this is a reasonable trade-off given the size of the dataset and the results on independent test data, as well as empirical evaluation during operational use at Restor on partner data. However, there are almost certainly incorrect labels in the dataset and this may translate into incorrect predictions or other biases in model output. We have observed that the models tend to "disagree" with training data in a way that is probably correct (i.e. the aggregate statistics of the labels are good) and we are working to re-evaluate all training data to remove spurious labels.
74
+
75
+ We provide cross-validation results to give a robust estimate of prediction performance, as well as results on independent imagery (i.e. images the model has never seen) so users can make their own assessments. We do not provide any guarantees on accuracy and users should perform their own independent testing for any kind of "mission critical" or production use.
76
+
77
+ There is no substitute for trying the model on your own data and performing your own evaluation; we strongly encourage experimentation!
78
+
79
+ ## How to Get Started with the Model
80
+
81
+ You can see a brief example of inference in [this Colab notebook](https://colab.research.google.com/drive/1N_rWko6jzGji3j_ayDR7ngT5lf4P8at_).
82
+
83
+ For end-to-end usage, we direct users to our prediction and training [pipeline](https://github.com/restor-foundation/tcd) which also supports tiled prediction over arbitrarily large images, reporting outputs, etc.
84
+
85
+ ## Training Details
86
+
87
+ ### Training Data
88
+
89
+ The training dataset may be found [here](https://huggingface.co/datasets/restor/tcd), where you can find more details about the collection and annotation procedure. Our image labels are largely released under a CC-BY 4.0 license, with smaller subsets of CC BY-NC and CC BY-SA imagery.
90
+
91
+ ### Training Procedure
92
+
93
+ We used a 5-fold cross-validation process to adjust hyperparameters during training, before training on the "full" training set and evaluating on a holdout set of images. The model in the main branch of this repository should be considered the release version.
94
+
95
+ We used [Pytorch Lightning](https://lightning.ai/) as our training framework with hyperparameters listed below. The training procedure is straightforward and should be familiar to anyone with experience training deep neural networks.
96
+
97
+ A typical training command using our pipeline for this model:
98
+
99
+ ```bash
100
+ tcd-train instnace mask-rcnn-r50 data.output= ... data.root=/mnt/data/tcd/dataset/holdout data.tile_size=1024
101
+ ```
102
+
103
+ #### Usage
104
+
105
+ The weights are 'standard' Detectron2 format and can be loaded with the architecture config: `COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_3x`.
106
+
107
+ We recommend using our pipeline for prediction:
108
+
109
+ ```bash
110
+ tcd-predict restor/tcd-mask-rcnn-r50 <path-to-image> <path-to-output>
111
+ ```
112
+
113
+ #### Training Hyperparameters
114
+
115
+ - Image size: 1024 px square
116
+ - Learning rate: initially 1e-3
117
+ - Learning rate schedule: 0.1x at 80% and 90% of training
118
+ - Augmentation: random crop to 1024x1024, arbitrary rotation, flips, colour adjustments
119
+ - Number of epochs: 75 during cross-validation to ensure convergence; 50 for final models
120
+ - Normalisation: Imagenet statistics
121
+
122
+ #### Speeds, Sizes, Times
123
+
124
+ You should be able to evaluate the model on a CPU (even up to mit-b5) however you will need a lot of available RAM if you try to infer large tile sizes. In general we find that 1024 px inputs are as large as you want to go, given the fixed size of the output segmentation masks (i.e. it is probably better to perform inference in batched mode at 1024x1024 px than try to predict a single 2048x2048 px image).
125
+
126
+ All models were trained on a single GPU with 24 GB VRAM (NVIDIA RTX3090) attached to a 32-core machine with 64GB RAM. All but the largest models can be trained in under a day on a machine of this specification. The smallest models take under half a day, while the largest models take just over a day to train.
127
+
128
+ Feedback we've received from users (in the field) is that landowners are often interested in seeing the results of aerial surveys, but data bandwidth is often a prohibiting factor in remote areas. One of our goals was to support this kind of in-field usage, so that users who fly a survey can process results offline and in a reasonable amount of time (i.e. on the order of an hour).
129
+
130
+ ## Evaluation
131
+
132
+ We report evaluation results on the OAM-TCD holdout split.
133
+
134
+ ### Testing Data
135
+
136
+ The training dataset may be found [here](https://huggingface.co/datasets/restor/tcd).
137
+
138
+ This model (`main` branch) was trained on all `train` images and tested on the `test` (holdout) images.
139
+
140
+ ![Training loss](total_loss.png)
141
+
142
+ ### Metrics
143
+
144
+ We report mAP50 on the holdout dataset, as well as results on a 5-fold cross validation split. Cross validtion is visualised as min/max error bars on the plots below.
145
+
146
+ ### Results
147
+
148
+ ![mAP50](segm_AP50.png)
149
+
150
+ ## Environmental Impact
151
+
152
+ This estimate is the maximum (in terms of training time) for the SegFormer family of models presented here. Smaller models, such as `mit-b0` train in less than half a day.
153
+
154
+ - **Hardware Type:** NVIDIA RTX3090
155
+ - **Hours used:** < 36
156
+ - **Carbon Emitted:** 5.44 kg CO2 equivalent per model
157
+
158
+ Carbon emissions were be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
159
+
160
+ This estimate does not take into account time require for experimentation, failed training runs, etc. For example since we used cross-validation, each model actually required approximately 6x this estimate - one run for each fold, plus the final run.
161
+
162
+ Efficient inference on CPU is possible for field work, at the expense of inference latency. A typical single-battery drone flight can be processed in minutes.
163
+
164
+ ## Citation
165
+
166
+ We will provide a preprint version of our paper shortly. In the mean time, please cite as:
167
+
168
+ **BibTeX:**
169
+
170
+ ```latex
171
+ @unpublished{restortcd,
172
+ author = "Veitch-Michaelis, Josh and Cottam, Andrew and Schweizer, Daniella Schweizer and Broadbent, Eben N. and Dao, David and Zhang, Ce and Almeyda Zambrano, Angelica and Max, Simeon",
173
+ title = "OAM-TCD: A globally diverse dataset of high-resolution tree cover maps",
174
+ note = "In prep.",
175
+ month = "06",
176
+ year = "2024"
177
+ }
178
+ ```
179
+
180
+ ## Model Card Authors
181
+ Josh Veitch-Michaelis, 2024; on behalf of the dataset authors.
182
+
183
+ ## Model Card Contact
184
+
185
+ Please contact josh [at] restor.eco for questions or further information.
segm_AP50.png ADDED
total_loss.png ADDED