Skip to content

Commit

Permalink
Jb/multi (#135)
Browse files Browse the repository at this point in the history
* Remove large files and edits to readmes

* readme

* Bump version 1.0.8
  • Loading branch information
PatBall1 authored Jan 17, 2024
1 parent 65cd2ce commit 50d03c1
Show file tree
Hide file tree
Showing 8 changed files with 45 additions and 24 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ Detectree2是一个基于Mask R-CNN的自动树冠检测与分割的Python包。
| :---: | :--- |

<br/><br/>
> [!WARNING]
> Due to an influx of new users we have been hitting bandwidth limits. This is primarily from the file size of the pre-trained models. If you are using these models please aim to save them locally and point to them when you need them rather than downloading them each time they are required. We will move to a more bandwidth friendly set up soon. In the meantime, if installing the package is failing please raise it as an issue or notify me directly on ball.jgc@gmail.com.
> [!NOTE]
> To save bandwidth trained models have been moved to [Zenodo](https://zenodo.org/records/10522461). Download models directly with `wget` or equivalent.

## Citation
Expand Down
9 changes: 5 additions & 4 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@
Detectree2
==========

`Detectree2 <https://github.com/PatBall1/detectree2>`_, based on the `Detectron2 <https://github.com/facebookresearch/detectron2>`_
Mask R-CNN architecture, locates trees in aerial images.
It has been designed to delineate trees in challenging dense tropical forests for a range of
ecological applications. Here is an example image of the predictions made by Detectree2.
`Detectree2 <https://github.com/PatBall1/detectree2>`_, based on the
`Detectron2 <https://github.com/facebookresearch/detectron2>`_ Mask R-CNN
architecture, locates trees in aerial images. It has been designed to delineate
trees in challenging dense tropical forests for a range of ecological
applications. Below is an example image of the predictions made by Detectree2.

.. .. image:: ../../report/figures/plot_13_285520_583300.jpg
.. :width: 400
Expand Down
19 changes: 14 additions & 5 deletions docs/source/tutorial.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
Tutorial
========

A tutorial for:
This tutorial goes through the steps of single class (tree) detection and
delineation. A guide to multiclass prediction (e.g. species mapping,
disease mapping) is coming soon. Example data that can be used in
this tutorial is available `here <https://zenodo.org/records/8136161>`_.

The key steps are:

1. Preparing data
2. Training models
Expand All @@ -19,8 +24,11 @@ To train a model you will need an orthomosaic (as ``<orthmosaic>.tif``) and
corresponding tree crown polgons that are readable by Geopandas
(e.g. ``<crowns_polygon>.gpkg``, ``<crowns_polygon>.shp``). For the best
results, manual crowns should be supplied as dense clusters rather than
sparsely scattered across in the landscape. See below for an example of the
required input crowns and image.
sparsely scattered across in the landscape. The method is designed to make
predictions across the entirety of the supplied tiles and assumes training
tiles are comprehensively labelled. If the network is shown scenes that are
incompletely labelled, it may replicate that in its predictions. See
below for an example of the required input crowns and image.

.. image:: ../../report/figures/Danum_example_data.png
:width: 400
Expand All @@ -29,7 +37,8 @@ required input crowns and image.

|
If you would just like to make predictions on an orthomosaic with a pre-trained
model from the ``model_garden``, skip to part 4 (Generating landscape predictions).
model from the ``model_garden``, skip to part 4 (Generating landscape
predictions).


Preparing data
Expand Down Expand Up @@ -233,7 +242,7 @@ especially useful if you only have limited training data available. To retrieve

.. code-block:: python
!wget https://github.com/PatBall1/detectree2/raw/master/model_garden/230103_randresize_full.pth
!wget https://zenodo.org/records/10522461/files/230103_randresize_full.pth
Then set up the configurations as before but with the trained model also supplied:

Expand Down
18 changes: 18 additions & 0 deletions docs/source/tutorial_multi.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
Tutorial (multiclass)
=====================

This tutorial goes through the steps of multiclass detection and
delineation (e.g. species mapping, disease mapping). A guide to single
class prediction is available
`here <https://patball1.github.io/detectree2/tutorial.html>`_. The multiclass
process is more complicated than single class prediction as the classes need to
be correctly encoded in the data.

The key steps are:

1. Preparing data
2. Training models
3. Evaluating model performance
4. Making landscape level predictions

THE REST OF THIS TUTORIAL IS UNDER CONSTRUCTION
3 changes: 0 additions & 3 deletions model_garden/220723_withParacouUAV.pth

This file was deleted.

3 changes: 0 additions & 3 deletions model_garden/230103_randresize_full.pth

This file was deleted.

10 changes: 6 additions & 4 deletions model_garden/README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
# Model garden

Welcome to the model garden. Here lives the pretrained models. Please feel free
to pick what is ripe for your tree crown delineation problem.
Welcome to the model garden. Here live the pretrained models (now hosted on
[Zenodo](https://zenodo.org/records/10522461)). Please feel free to pick what
is ripe for your tree crown delineation problem.

Download with e.g.

```
!wget https://github.com/PatBall1/detectree2/raw/master/model_garden/230103_randresize_full.pth
!wget https://zenodo.org/records/10522461/files/230103_randresize_full.pth
```

and load with:
Expand All @@ -19,14 +20,15 @@ cfg = setup_cfg(update_model=trained_model)
## 220723_withParacouUAV.pth

A model trained with a range of tropical data including aeroplane and UAV
mounted cameras.
mounted cameras. Sites: Paracou, Danum, Sepilok.

* Appropriate tile size ~ 100 m

## 230103_randresize_full.pth

An updated model trained across a range of tropical sites with better scale
transferability owing to random resize augmentation during training.
Sites: Paracou, Danum, Sepilok.

* Appropriate tile size ~ 100 m (with some tolerance)

Expand Down
3 changes: 0 additions & 3 deletions model_garden/urban_trees_Cambridge_20230630.pth

This file was deleted.

0 comments on commit 50d03c1

Please sign in to comment.