Skip to content

Iterative Next Boundary Detection for Instance Segmentation of Tree Rings in Microscopy Images of Shrub Cross Sections

License

Notifications You must be signed in to change notification settings

alexander-g/INBD

Repository files navigation

INBD

Iterative Next Boundary Detection for Instance Segmentation of Tree Rings in Microscopy Images of Shrub Cross Sections

CVPR 2023. Paper link


Example input image and detected tree rings


Setup:

Python version: 3.7. Other versions are known to cause issues.

#setup virtualenv
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt

#download dataset
python fetch_dataset.py

#download pretrained models
python fetch_pretrained_models.py

Or use GitHub Codespaces: Open in GitHub Codespaces


Inference

#single imagefile
python main.py inference checkpoints/INBD_EH/model.pt.zip dataset/EH/inputimages/EH_0033.jpg

#list of imagefiles
python main.py inference checkpoints/INBD_EH/model.pt.zip dataset/EH/test_inputimages.txt

adding pith pixel position as argument

In Pinus taeda L. species, U-Net model do not segment the pith pixel correctly. In such species, pith can be model as a single pixel (see paper).

#single imagefile
python main.py inference checkpoints/UruDendro/model.pt.zip dataset/UruDendro4_1504/T0_B1_N32_A.png --cy 766 --cx 709

Where --cy and --cx are the y and x coordinates of the pith pixel in the image. Model checkpoints/UruDendro/model.pt.zip was trained on the UruDendro dataset, which is a dataset of Pinus taeda L. tree rings (see dataset). Image dataset/UruDendro4_1504/T0_B1_N32_A.png is an example image from the UruDendro4 dataset (see dataset). resized to 1504x1504 pixels. Image can be downloaded from link.

To run in a list of files, the input file should contain the image paths and the pith pixel coordinates.

#list of imagefiles
python main.py inference checkpoints/UruDendro/model.pt.zip dataset/UruDendro4_1504/test_inputimages.csv

Where test_inputimages.csv is a CSV file with the following format:

Code, cx, cy
T0_B1_N32_A.png, 709, 766

Training:

#first, train the 3-class segmentation model
python main.py train segmentation           \
  dataset/EH/train_inputimages.txt          \
  dataset/EH/train_annotations.txt

#next, train the inbd network
python main.py train INBD \
  dataset/EH/train_inputimages.txt          \
  dataset/EH/train_annotations.txt          \
  --segmentationmodel=checkpoints/segmentationmodel/model.pt.zip   #adjust path

Dataset

We introduce a new publicly available dataset: MiSCS (Microscopic Shrub Cross Sections)

The dataset and annotations can be downloaded via python fetch_dataset.py or via the following links:

All images were acquired by Alba Anadon-Rosell. If you have ecology-related questions, please contact a.anadon at creaf.uab.cat

If you want to use this dataset for computer vision research, please cite the publication as below.

Citation

@inproceedings{INBD,
  title     = "{Iterative Next Boundary Detection for Instance Segmentation of Tree Rings in Microscopy Images of Shrub Cross Sections}",
  author    = {Alexander Gillert and Giulia Resente and Alba Anadon‐Rosell and Martin Wilmking and Uwe von Lukas},
  booktitle = {Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR)},
  month     = {June},
  year      = {2023},
  pages     = {14540-14548}
}

License

License for the source code: MPL-2.0

License for the dataset: CC BY-NC-SA 4.0

About

Iterative Next Boundary Detection for Instance Segmentation of Tree Rings in Microscopy Images of Shrub Cross Sections

Topics

Resources

License

Stars

Watchers

Forks

Contributors 2

  •  
  •