Giter VIP home page Giter VIP logo

treecountsegheight's Introduction

Tree Counting, Crown Segmentation and Height Prediction at Scale

This repo contains code for the paper Deep learning enables image-based tree counting, crown segmentation and height prediction at national scale

Trained models ready for deployment

Download models: ๐Ÿคž

https://drive.google.com/file/d/1ZNibrh6pa4-cjXLawua6L96fOKS3uwbn/view?usp=sharing

Model names:

trees - date - time - optimizer - lr - input bnads - input shape - no. training tiles - segmentation loss - density loss - boundary weight (for separate individual trees) - model . h5

Working with Google Earth Engine ๐Ÿ’ช

https://github.com/google/earthengine-community/blob/master/guides/linked/Earth_Engine_TensorFlow_tree_counting_model.ipynb

Tips for direct depolyment ๐Ÿ˜Ž

  • Standardize input image patches channel-wise -> ((image-mean)/std)

  • For large image, predict with overlap (stride < patch width), take max prediction where overlap

  • Upsample / Downsample to match the trained input resolution (20 cm)

  • Finetune with small local annotation data

Finetune / Train using local annotation data

Prepare your own training data ๐Ÿ™ˆ

Figure 0

Figure 0. Preparing your own tree crown annotation dataset. Delineate tree crowns inclusively within each selected annotating area.

Finetuning typically requires a small local annotation dataset (< 5 k tree crowns)

Check details in paper..

Code structure:

Preprocessing for tree crown segmentation and counting

python main0_preprocessing.py

--- ๐Ÿ”– set configs ---

config/Preprocessing.py


Train 1st model: Tree crown segmentation & density counting:

python main1_multitask_counting_segmentation.py

--- ๐Ÿ”– set configs ---

case1: same input spatial resolution: use config/UNetTraining.py

case2: inputs of different spatial resolution (only support 1/2 coarser resolution for now): use config/UNetTraining_multires.py

--- ๐Ÿ”– example data for demonstration ---

example input data in: example_extracted_data/

โš ๏ธ IMPORTANT: LISCENCE REQUIRED FOR FORMAL USE OF THE DATA!

--- โœจ major tunable hyperparameters ---

  • boundary weights: determine the penalty on crown boundaries for better individual separation

  • task_ratio: the ratio for weighting the two losses to balance the emphasis on both tasks during training, may differ from case to case

  • normalize: ratio to augment data by randomly normalizing image patches


Train 2nd model: Tree height estimation from aerial images:

python main2_height_prediction.py

--- ๐Ÿ”– set configs ---

config/UNetTraining_CHM.py


Test 1st model: segmentation & counting:

python step3_predict_segmentation_counting.py

--- ๐Ÿ”– set configs ---

config/Model_compare_multires.py

--- ๐ŸŽ Example prediction ---

See /example_extracted_data/

  • segmentation result: seg_41.tif

  • counting result: density_41.tif

โš ๏ธ Note that the model was trained using image patch no.41, and thus should not be tested using the same image in the test phrase. Here we simply demonstrate how to apply the model on a test image.


Large scale prediction

python step4_large_scale_inference_transfer_other_data.py

uploading...


Figure 1

Figure 1. Overview of the framework used to count individual trees and predict their crown area and height. a, Deep learning-based framework for individual tree counting, crown segmentation, and height prediction. Spatial locations of individual trees are incorporated in the tree density maps and the crown segmentation maps. The canopy height map (CHM) derived from LiDAR data provides pixel-wise height information, which, when available for a specific study area, can optionally be used as an additional input band for the individual tree counting and crown segmentation tasks. b, Data preparation and modeling for tree counting and crown segmentation. The manually delineated individual tree crowns are modeled as density maps for the counting task by extracting the polygon centroids. The gaps between adjacent crowns are highlighted for the separation of individual tree crowns during the training phase.

Figure 2

Figure 2. Example products from the proposed framework. a, Wall-to-wall tree count prediction for Denmark. b, Detailed examples showing the individual tree counting (second row), crown segmentation (third row), and height prediction (third row) from three major types of landscapes (deciduous forest, coniferous forest, and non-forest). c, Large-scale individual tree crown segmentation results colored by height predictions. Examples in b and c were sampled from the region indicated by the orange box in a.

treecountsegheight's People

Contributors

sizhuoli avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.