Automatic recognition and calculation of softwood ray height based on tangential section images by using YOLOv5

Yong Guo, Weisheng Wang, Qizhao Lin, Hong Wang, Jinfang Weng, Wen‐Yin Chen

Abstract

To achieve rapid acquisition, identification, and measurement of average ray height in softwood, this study proposes a new automated method based on tangential section photographs. Digital images at 100x magnification were used to establish a dataset of rays and scales. Using the YOLOv5s architecture, the researchers developed a target recognition model that achieved 93.5% precision, 95.6% recall, and 96.7% mean average precision (mAP) on the validation set. A visual program was subsequently designed to automate ray height calculation, significantly lowering the technical barrier for wood identification professionals.

Introduction

Identifying wood species is a vital task in fields ranging from forensic investigations to the enforcement of international timber trade laws. Experts typically identify softwood by measuring the height of "rays"—radial ribbon-like cell structures. According to International Association of Wood Anatomists (IAWA) standards, at least 25 randomly selected rays must be measured to ensure statistical significance. Traditionally, this manual process is labor-intensive and susceptible to human selection bias. This paper presents an automated pipeline using deep learning to standardize and accelerate these measurements.

Methodology

The researchers developed a multi-stage automated workflow:

  1. Object Detection: The system utilizes YOLOv5s, a lightweight version of the popular object detection architecture, trained to identify wood rays and magnification scale bars.
  2. Preprocessing: Microscopic images are converted to grayscale to streamline input for the neural network.
  3. OCR Integration: To enable autonomous physical measurement, the system incorporates CNOCR to read text on the scale bar (e.g., "200 μm"), allowing the software to calculate the pixel-to-micron ratio without manual intervention.
  4. Height Calculation: A custom algorithm identifies complete rays, filters out those truncated by image borders, and calculates heights based on the detected scale.

Results and Discussion

The system was validated using a diverse dataset from the Chinese Academy of Forestry and Southwest Forestry University, covering multiple softwood families.

Model Performance

The YOLOv5s model demonstrated exceptional accuracy in identifying both anatomical features and reference scales. As shown in the performance table below, the model achieved a high [email protected] of 0.967, ensuring reliable data collection for species identification.

Performance metrics for the YOLOv5s model across different classes.

Model Selection: The "Goldilocks" Insight

A key finding of the study was the comparison between different YOLOv5 model sizes (n, s, m, l, and x). While larger models often provide better results in general benchmarks, YOLOv5s provided the best balance for wood anatomy, achieving the highest F1 score (0.945). This suggests that for specific biological structures, massive models may lead to diminishing returns or overfitting.

Comparison of different YOLOv5 model versions, highlighting the efficiency of YOLOv5s.

The efficiency of the system is further highlighted by its training speed; the model was trained in just 0.116 hours on an NVIDIA Tesla A100 GPU.

Conclusion

This automated system represents a significant step forward in wood anatomy, replacing tedious manual microscopy with a standardized digital process. By detecting every complete ray in an image, the system eliminates human bias and adheres strictly to scientific standards. Future developments will aim to extend this technology to hardwood species and implement image stitching techniques to further increase the data yield from individual slides.

Summary updated

Abstract

In order to achieve rapid acquisition, identification and measurement of the average ray height of softwood based on tangential section photographs, a new method is proposed. Firstly, labels the digital image of the softwood tangential section with the 100 magnification, that is, mark the rays and scales on the image, and establish the dataset; Secondly, the dataset is randomly divided into training set and validation set. YOLOv5s is used for model training to obtain the best target recognition model of rays and scale. The experimental results show that the model trained with YOLOv5s can achieve 93.5% accuracy, 95.6% recall and 96.7% average accuracy in the validation set; Thirdly, using the YOLOv5s trained model, a visual program for automatically calculating the ray height and obtaining the ray characteristics of softwood is designed, which lowered the threshold for wood identification workers to use such software.
BibTeX
@inproceedings{guo2023automatic,
  author = {Yong Guo and Weisheng Wang and Qizhao Lin and Hong Wang and Jinfang Weng and Wen‐Yin Chen},
  title = {{Automatic recognition and calculation of softwood ray height based on tangential section images by using YOLOv5}},
  booktitle = {Research},
  year = {2023},
  doi = {10.21203/rs.3.rs-2812903/v1},
}
Figure