Tree Disk Pith Detection
![PyPI - Version](https://img.shields.io/pypi/v/tree-disk-pith)
A Python package for analyzing tree rings in cross-sectional images. Originally forked from hmarichal93/apd.
Installation
pip install tree-disk-pith
Usage
Python API
import treediskpith
treediskpith.configure(
input_image="input/tree-disk4.png",
model_path="models/apd_dl.h5",
save_results=True,
)
(
img_in,
img_pre,
pith,
) = treediskpith.run()
Command Line Interface (CLI)
Basic usage:
tree-disk-pith --input_image ./input/tree-disk3.png
Advanced usage with custom parameters:
tree-disk-pith \
--input_image input/tree-disk3.png \
--output_dir custom_output/ \
--new_shape 640 \
--save_results \
--debug
CLI Arguments
Argument | Type | Required | Default | Description |
---|
--input_image | str | Yes | - | Input image file path |
--output_dir | str | Yes | - | Output directory path |
--model_path | str | No | - | Path to the weights file (required if using apd_dl method) |
--new_shape | int | No | 0 | New shape for resizing the input image. If 0, no resizing is done |
--debug | flag | No | False | Enable debug mode to save intermediate images and outputs |
--save_results | flag | No | False | Save intermediate images, labelme and config file |
Development
Setting up Development Environment
- Create and activate virtual environment:
poetry config virtualenvs.in-project true
poetry env use python
poetry install
eval $(poetry env activate)
- Running tests:
pytest
- fetch dataset
python fetch_dataset.py
- Download pretrained model
python fetch_pretrained_model.py