Skip to content

hmarichal93/deepcstrd

Repository files navigation

DeepCS-TRD, Deep Learning-based Cross-Section Tree Ring Detector

Accepted at International Conference on Image Analysis and Processing (ICIAP) 2025 Arxiv

DeepCS-TRD, a Deep Learning-based Cross-Section Tree Ring Detector in Macro images. It substitutes the edge detection step of CS-TRD by a deep-learning-based approach (U-Net), which allows the application of the method to different image domains: microscopy, scanner or smartphone acquired, and species (Pinus taeda, Gleditsia triachantos and Salix glauca). In addition, two publicly available annotated datasets are introduced to the community. The proposed method outperforms state-of-the-art approaches in macro images (Pinus taeda and Gleditsia triacanthos) while showing slightly lower performance in microscopy images of Salix glauca. To our knowledge, this is the first work that studies automatic tree ring detection for such different species and acquisition conditions. Dataset is available here.


Open in GitHub Codespaces

Build Badge

Download Badge

Run app

streamlit run app.py

Example input image and detected tree rings

Delineation of tree rings in the forest capturing images with a smartphone camera. Images from the Douglas fir dataset. Example input image and detected tree rings

More Examples


Pinus taeda Example input image and detected tree rings Example input image and detected tree rings
Gleditsia triacanthosExample input image and detected tree rings
Douglas fir (sawmill) Example input image and detected tree rings Example input image and detected tree rings Example input image and detected tree rings Example input image and detected tree rings

Local Setup:

Set conda environment

conda env create -f environment.yml
conda activate deep_cstrd
apt-get install git-lfs
git lfs pull
python setup.py install
pip install -r requirements.txt

Install dependencies

  1. CS-TRD
git clone https://github.com/hmarichal93/cstrd_ipol.git
cd cstrd_ipol/
python setup.py install
cd .. 
  1. UruDendro
git clone https://github.com/hmarichal93/uruDendro.git
cd uruDendro/
python setup.py install

Test

Results should appear in the output/F02c folder

python main.py inference

Usage

python main.py inference --input input/urudendro/F02c.png --cy 1264 --cx 1204  --output_dir ./output --root ./ --weights_path ./models/deep_cstrd/256_pinus_v1_1504.pth

Automatic pith detector

Go to the APD repository and follow the instructions to install the automatic pith detector.

Train

python main.py train --dataset_dir DATASET_PATH --logs_dir SAVE_DIR

Where DATASET_PATH is the path to the dataset folder containing the images and the annotations, and SAVE_DIR is the path to the directory where the models are going to be saved

Training can be monitored using tensorboard

tensorboard --logdir=SAVE_DIR
Example input image and detected tree rings

Annotation were made using the Labelme tool marking tree ring boundaries as polylines.

Evaluate

python main.py evaluate --dataset_dir DATASET_PATH --results_path RESULT_PATH

Where DATASET_PATH is the path to the dataset folder containing the images and the annotations, and RESULT_PATH is the path to the directory where the results are going to be saved.


About

[ICIAP 2025] DeepCS-TRD, a Deep Learning-based Cross-Section Tree Ring Detector

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published