Abstract
The structure and features of resin ducts provide valuable information about environmental conditions accompanying the growth of trees in the genus Pinus. Therefore analysis of resin duct characteristics has been an increasingly common measurement in dendrochronology. However, the measurement is tedious and time-consuming since it requires thousands of ducts to be manually marked in an image of an enlarged wood surface. Although tools exist to automate some stages of this process, no tool exists to automatically recognize and analyze the resin ducts and standardize them with the tree rings they belong to. This study proposes a new fully automatic pipeline that quantifies the properties of resin ducts in terms of the tree ring area to which they belong. A convolutional neural network underlays the pipeline to detect resin ducts and tree-ring boundaries. Also, a region merging procedure is used to identify connected components corresponding to successive rings. Corresponding ducts and rings are next related to each other. The pipeline was tested on 74 wood images representing five Pinus species. Over 8000 tree-ring boundaries and almost 25,000 resin ducts were analyzed. The proposed method detects resin ducts with a sensitivity of 0.85 and precision of 0.76. The corresponding scores for tree-ring boundary detection are 0.92 and 0.99, respectively.
Similar content being viewed by others
Introduction
Resin ducts or canals are a feature of trees in the genus Pinus (and other genus including Larix, Picea, Psuedotsuga, and Shorea). Their structure and properties provide valuable information about environmental conditions in the corresponding years of tree growth. E.g., resin ducts have been shown to correlate with mortality from beetles and drought in some Pinus species in the USA1,2. Also, local climatic adaptations affect duct characteristics and the ability to deliver chemical and physical defenses through oleoresin3.
Although analysis of the resin ducts has been an increasingly common measurement in dendrochronology, this potential source of valuable information is difficult to obtain. The reason is that no tool automatically recognizes the resin canals and analyzes their properties in relation to the tree rings to which they belong. Thousands of ducts must be manually marked in an image of an enlarged wood surface to obtain reliable measurements. Time series of resin duct measurements are tedious and time-consuming to record using manual methods4. The measurement results may vary depending on the skills and perception of the operator.
To our best knowledge, no method exists that would automatically detect, measure and output a time series of resin ducts in wood images. Nevertheless, attempts to automate some parts of the detection and analysis of resin ducts have already been proposed. These are mainly semi-automated tools in macros coupled with ImageJ (or other software) that partially automate the analysis of resin duct properties. These approaches either require manual pre-selection of resin ducts or use simple image processing methods to detect the resin ducts. However, traditional image processing methods are often inadequate for reliably detecting candidate resin ducts and tree ring boundaries. The variability in the appearance of these structures, which can depend on factors such as tree species or environmental conditions, makes defining precise rules for feature detection using thresholding challenging. Furthermore, interference from other wood image features, such as bark, knots, or wood fibers, can further complicate feature detection using classical image processing algorithms, resulting in low detection accuracy, missed detections or false positives.
The earliest semi-automatic method for identifying resin canals and quantifying their properties through tree-ring-based statistical measures was proposed by Chen et al.5. The approach uses color-scanned images of the transverse surface of polished wood samples and incorporates color constraints and shape-based filtering for resin canal selection. The reported resin canal detection rate is low (68%), still requiring extensive visual inspection and manual correction of false or missing resin canals.
The approach proposed by Thomas and Collings6, which counts resin channels using images acquired with a commercial film scanner modified to operate with circularly polarised light, has similar drawbacks. Their image analysis procedure uses basic image processing (i.e., intensity thresholding followed by morphological processing) to detect candidate resin canals. Particles are then counted using experimentally selected thresholds for size and circularity to obtain basic statistics on resin canals.
The most recent study described by Hood et al.7 quantifies user-detected resin ducts via an R script that computes three unstandardized and two standardized resin duct metrics. The ducts must be manually approximated by an ellipse of size and shape that an operator in the ImageJ software adjusts. In addition, the authors recommend using CooRecorder to measure ring widths, CDendro to generate ring width chronologies, and COFECHA to check the accuracy of cross-dating. Although such a procedure makes it possible to relate the statistics of the resin ducts to the corresponding tree rings, it is cumbersome because it requires switching between several different types of software and the representation of measurement data. Standardization of terms and metrics via the tree ring properties has been suggested to further improve the addition of resin ducts4,8.
In parallel, the possibility of automating other tasks related to wood technology and wood image analysis has been explored over the past decade. Specifically, deep learning (DL) and convolutional neural networks (CNN) have revolutionized wood technology in recent years by providing exceptional capabilities for processing large amounts of data, identifying patterns, and making predictions9,10. The CNN models have mainly been trained to identify wood species automatically11. With a motivation to preserve endangered species, prevent illegal logging, and ensure the authenticity of wood products, DL solutions have been proposed to recognize wood species from images of wood surface11,12,13,14,15,16,17, standing trees species recognition from 3D point clouds of trees collected by light detection and ranging (LiDAR) or terrestrial laser scanning (TLS)18,19,20 and near-infrared (NIR) spectroscopy based tree species identification21,22. Convolutional neural networks have also been proposed to process remote sensing and aerial images in order to monitor forest infestation and health conditions or detect fires23,24,25,26,27,28. Deep learning has also entered automatic wood quality control and nondesctructive testing technology, where convolutional neural networks have been proposed to detect defects and anomalies in wood products, such as wood knots, dead knots, cracks, splits, or pest damages29,30,31,32,33,34,35,36,37, wood composites failure predication35, wood log tracing38 or categorizing the damaged wooden elements39.
Despite these advancements, the use of machine learning and CNNs in dendrological analyses is limited. Existing works have focused on the automation of pitch detection40,41 and delineating tree ring boundaries and measurements to improve the workflow in dendrochronological studies42,43,44,45,46,47,48,49. Therefore, this paper aims to explore the performance of CNNs in the resin duct detection task. Specifically, we propose and test a method that uses a CNN model to automate the detection of resin ducts in scans of tree ring samples and output measurements and metrics as a time series. Using a CNN for resin duct detection offers several advantages over traditional image processing methods, including learning complex features automatically, simultaneous detection of multiple features, and improved performance in challenging imaging conditions or when analyzing wood samples with diverse properties.
The contributions of this paper are as follows:
-
The first fully automatic method for detecting resin duct in wood core images is proposed. The method is underpinned by a convolutional neural network applied in a patch-based setup.
-
A tree ring segmentation approach is proposed, which comprises a convolutional neural network for tree ring boundary detection, watershed transform, and region merging to identify connected components corresponding to successive rings.
-
The above two methods are integrated into an image analysis pipeline that quantifies the properties of resin channels in terms of the tree ring to which they belong. This extends previous automated methods that only considered ring widths and allows standardization of resin duct measurements as proposed in Hood et al.4 and Vázquez-González et al.8
Materials
In this study, the wood core images and the corresponding image data were acquired through the procedure summarized in Fig. 1.
Five Pinus species were considered, i.e., Pinus palustris Mill. (PIPA2 or hereafter PIPA), Pinus virginiana Mill. (PIVI2 or hereafter PIVI), Pinus rigida Mill. (PIRI), Pinus taeda L. (PITA), Pinus pungens Lamb. (PIPU5 or hereafter PIPU). In total, 74 cores were collected. To obtain these samples, 54 trees were cored with a 5.15 mm increment borer at locations across the state of Maryland and one site in the state of Virginia in the USA. Multiple cores were obtained from the same tree in some cases, while at other times, single cores were obtained. Each core in this study was treated as a single separate sample because the wood features of interest are unique in each core. Particularly, wood samples were selected to vary in density and width of tree rings, appearance of resin ducts, and wood texture. Cores were prepared following a standard procedure50. Specifically, core samples were mounted and prepared using successively finer sandpaper from 120 to 800 grit using a belt sander to obtain a flat surface. The sanding process increased discernibility of tree ring boundaries and resin ducts. Cores were then scanned using a flatbed scanner at 2400 dots per inch. The spatial resolution of the images ranged from 244 \(\times\) 6990 to 410 \(\times\) 27666 pixels.
The expert in dendrochronology manually annotated the tree-ring boundaries and the resin ducts in each wood core image. A combination of a touchscreen-style monitor with a stylus and mouse was used to draw circles and lines over the resin ducts and tree ring boundaries on the scan files. This procedure resulted in 8024 tree-ring boundaries and 24,735 resin ducts identified and annotated by an expert. Their distribution among the considered Pinus species is summarised in Table 1. Also, the time spent by an expert when annotating the data was recorded (cf “Results” Section).
The dataset of expert-annotated images was subsequently divided into three folds, with each considered species being more or less equally represented. These folds were employed for the three-fold cross-validation of the proposed pipeline. Specifically, two folds were utilized for training a convolutional neural network (CNN), and one fold was reserved for testing. This process was repeated three times, with different folds for training and testing in each repetition.
The proposed approach
General overview
The proposed method aims to automatically obtain measurements of the resin canals versus tree rings from images of the wood samples. It transforms an input wood core image \(\mathscr {I}(x,y)\) into two labeled images \(\mathscr {R}(x,y)\) and \(\mathscr {D}(x,y)\), such that \(\mathscr {R}(x,y): \Omega \subset \mathbb {R}^2 \rightarrow \{1, 2, \ldots , K\}\) is composed of K connected components \(r_i = \{(x,y): \mathscr {R}(x, y) = i\}\) each corresponding to a tree ring where \(\mathscr {R} = \big [\bigcup _{i=1}^K r_i\big ]\) and \({r}_i \cap {r}_j = \emptyset\) for \(i \ne j\), and \(\mathscr {D}(x,y): \Omega \subset \mathbb {R}^2 \rightarrow \{0, L\}\) is composed of \(L+1\) connected components \(d_i = \{(x,y): \mathscr {D}(x, y) = i\}\) corresponding to resin ducts (\(i>0\)) and background (\(i=0\)), such that \(\mathscr {D} = \big [\bigcup _{i=0}^L d_i\big ]\) and \({d}_i \cap {d}_j = \emptyset\) for \(i \ne j\). For this purpose, a pipeline sketched in Fig. 2 is proposed.
The proposed approach builds on the convolutional neural network (CNN) to detect resin ducts and tree-ring boundaries. The Attention UNet (AttUNet) model is incorporated into the pipeline to generate joint probability maps of the abovementioned structures. The maps are next subjected to postprocessing, which aims to define the precise location of resin ducts and segment consecutive tree rings. Finally, the statistics of the resin ducts versus the corresponding tree rings are determined. A detailed description of the consecutive steps of the pipeline is provided in the following subsections.
CNN model
Architecture
The CNN model used in this paper extends the author’s earlier study on tree-ring boundary detection using the U-Net model48 and derives from the Attention U-Net originally proposed in52.
Prediction
Seamless resin ducts \(\mathscr {P}_D\) and tree-ring boundary \(\mathscr {P}_R\) probability maps were obtained at the prediction step via applying a trained model to each image in a sliding window setup to overlap** image tiles (see Algorithm 1). The sliding window of size 128 \(\times\) 128 pixels equivalent with a patch size used for model training was moved across the consecutive image tiles, which overlapped by a stride of 20 pixels in both: the horizontal and the vertical direction. The stride was selected empirically to ensure the patches composing an input image fit the GPU memory. Finally, the response of the model to overlap** tiles was averaged and outputted as the final resin ducts and tree-ring boundary likelihood maps \(\mathscr {P}_D\) and \(\mathscr {P}_R\) respectively.
Sample wood core image and the predicted likelihoods of resin ducts and tree-ring boundaries are presented in Fig. 5.
Resin ducts probability map postprocessing
The resin ducts likelihood map \(\mathscr {P}_D\) is utilized to define the exact location and size of the resin ducts \(d_i \in \mathscr {D}\). The map is thus binarised \(\mathscr {T}: \mathscr {P}_D \rightarrow \{\mathscr {B}\): \(\mathscr {B}(x,y) \in \{0, 1\} \wedge \forall _{(x,y): \mathscr {P}(x,y)>t_L} \mathscr {B}_D(x,y) = 1\}\) to obtain regions of the highest resin-duct probabilities. The binarisation is performed adaptively via local thresholding to adapt to weaker (less evident) resin ducts. The local neighborhood of 25 \(\times\) 25 pixels of each pixel is considered to determine a threshold \(t_L\). This image subregion corresponds roughly to the area of size 0.278 mm\(^2\) and was determined through empirical analysis, considering the typical size of a resin duct. In particular, we observed that resin ducts in analyzed images have a diameter of approximately 20–30 pixels. Chosen patch size is, therefore, sufficiently large to differentiate between resin ducts and background while also being small enough to avoid being influenced by larger-scale variations in the image, such as changes in texture. It also allows obtaining the necessary statistics for threshold determination quickly. The threshold equal to the mean probability within the neighborhood increased by a small constant to increase noise resistance is applied to find the local maxima of resin-duct probabilities.
The last step is shape-based filtering of the detected objects to remove regions that are not circular. If an object’s circularity is below 0.9 and its area is smaller than half of the average of all objects, such an object is considered an outlier and removed from the resulting binary map of resin ducts.
Consecutive steps of the shape-based filtering are presented in Fig. 6, including sample wood core section (Fig. 6a), resin ducts likelihood outputted by the CNN model, original (Fig. 6b) and after binarisation (Fig. 6c), and finally detected resin ducts shown in red and outliers shown in green (Fig. 6d).
Tree-rings segmentation
For tree ring segmentation, tree-ring boundary likelihood maps \(\mathscr {P}_B\) are utilized (see Fig. 7b). First, similar to the previous step, local adaptive thresholding \(\mathscr {T}: \mathscr {P}_B \rightarrow \{\mathscr {P}_B': \mathscr {P}_B'(x,y) \in (0, 1) \wedge \forall _{(x,y): \mathscr {P}_B'(x,y)<t_L} \mathscr {P}_B'(x,y) = 0\} \}\) is applied to define the boundary candidates, i.e., regions with the highest probability corresponding to the tree ring boundaries (see Fig. 7c). Again, mean intensity within the pixel neighborhood of size 25 \(\times\) 25 pixels is considered a threshold \(t_L\). The window size was determined experimentally to balance the trade-off between accurately distinguishing tree rings from the background and avoiding over- or under-segmentation, particularly in the case of narrow, densely located tree-ring boundaries. However, the map is not binarised, but the pixels of intensity smaller than the threshold are set to 0. The remaining pixels are left unchanged. Such a map is next subjected to watershed segmentation. It results in regions that roughly correspond to the rings. The preprocessing step diminishes the level of over-segmentation. However, the over-segmentation can still be observed for some rings. Therefore in the last step, region merging is performed. All regions smaller than a predefined threshold (here set to 1500 pixels selected experimentally) are joined with the larger neighboring regions. If the region is neighboring to several regions, it is included in the region with the longest common boundary (cf. Algorithm 2).
Finally, watershed transform is applied to the binary image of linked tree-ring boundaries to extract connected components \(r_i \in \mathscr {R}\) label them with unique labels \(i\in [0, K]\) where K is the number of the detected tree rings (see Fig. 7 ).
Measurement
The segmented maps of the tree rings \(\mathscr {R}\) and resin ducts \(\mathscr {B}\) are next utilized for the linear and surface measurements of these structures.
Ring width
The ring widths in wood core images (see Fig. 8a) are measured along the horizontal line traversing the core center (see Fig. 8b). The ring boundary curvature is not accounted for by using the core center, but the purpose here is comparison between the automated and expert placed ring boundaries not chronology development. Since each tree ring region \(r_i \in \mathscr {R}\) was assigned a unique label \(i \in [1,K]\) where K is the number of rings, the procedure counts the number of consecutive connected pixels located along the core centerline and assigned one label. Since the core images were scanned at the resolution of 2400 dpi, the resulting number is then multiplied by 25.4/2400 to obtain the core width in millimeters.
Ring area
A ring is connected component \(r_i\) with all pixels assigned a label i. The ring area is thus determined by counting the number of pixels assigned to one label (see Fig. 8b,c) and multiplying it by \((25.4/2400)^2\) to obtain the core area in square millimeters.
The number of ducts per tree ring
To determine the number of ducts contained in the ring \(r_i\) is first masked, with a mask \(m_i = \{(x,y): \mathscr {R}(x,y) = i\}\) where \(i \in [1, K]\) and K is the number of rings (see Fig. 8c). Then the logical AND operation is computed between the resulting ring mask \(m_i\) and the binary ducts map \(\mathscr {R}(x,y)\) (see Fig. 8d). The number of connected components in the resulting logical image \(d_i = m_i \wedge \mathscr {R}_R(x,y)\) constitutes the number of ducts in the ring \(r_i\) (see Fig. 8e,f).
Tree ring coverage by ducts
The fraction of the ring covered by ducts is determined by dividing the total area of ducts in image \(d_i\) by the total area of ring \(r_i\). The areas of both ducts and tree rings can be determined by counting non-zero pixels in images \(r_i\) and \(m_i\), respectively.
Results
Visual results
Figure 9 presents visual results of resin ducts and tree-ring boundary detection in sample wood core segments using the proposed pipeline. The detected tree-ring boundaries are marked blue, while the detected resin ducts are outlined in red. Images representing each of the five considered species were selected for presentation.
Numerical results
The numerical assessment of resin duct detection and tree-ring boundary detection was performed by comparing the output of the proposed pipeline with the expert annotations of both considered structures. Both for resin ducts and tree-ring boundaries, the procedure included counting: (i) true positives (TP), i.e., structures correctly detected by the proposed pipeline, (ii) false negatives (FN), i.e., structures marked by an expert but missed by the proposed approach, and (iii) false positives (FP), i.e., false resin ducts/tree-ring boundaries introduced by the automatic approach.
Additionally, sensitivity \(SEN =\frac{TP}{TP+FN}\) and precision \(PREC = \frac{TP}{TP+FP}\) were determined. Specifically, sensitivity describes how good a proposed approach is at detecting considered structures correctly, while precision provides a ratio of the positively classified structures being relevant.
Resin ducts detection
The numerical assessment of the proposed approach in the resin ducts detection task is presented in Tables 2 and 3. Particularly, Table 2 presents global scores obtained for each of the three testing folds, while Table 3 additionally provides scores averaged over each of the considered wood species. A resin duct was considered true positive if it overlapped at least partially with the corresponding expert annotation.
Tree-ring boundary detection
The numerical assessment of the proposed approach in the tree-ring boundary detection task is presented in Tables 4 and 5. Similarly to resin ducts, global scores (cf. Table 4) and scores averaged per each considered species (cf. Table 5) are presented. The tree-ring boundary was considered detected if it overlapped at least partially with the corresponding tree-ring boundary annotated by an expert.
Measurement
The results of tree rings and duct properties measurements are summarised in Fig. 10 and Tables 6 and 7. Particularly, Fig. 10 presents box plots of the distributions of the tree ring average width, the tree ring average area, the average number of ducts per tree ring, and an average tree ring area coverage by ducts obtained for cores in each testing fold using the proposed pipeline (series auto). The results are compared with the corresponding measurements derived from expert annotations (series expert). The bottom panel also compares individual measurements obtained for each core using both considered measurement methods. The results are supplemented with a squared correlation coefficient between the measures obtained from a fully automatic pipeline and the measures derived from expert annotations shown in Table 6. Finally, the mean average values of the considered rings and ducts parameters are presented in Table 7.
Processing time
Finally, the time required for automatic ducts and tree-ring boundaries detection using the proposed pipeline was compared to the time spent by an expert annotating these structures in wood core images. The recorded times are shown in Table 8. For each considered species, a total and average time in seconds spent on processing the cores (manually or automatically) is given.
Discussion
The results of the proposed pipeline are auspicious. The models’ performance in resin duct detection is high. The average sensitivity at the level of 0.85 indicates that the convolutional neural network detected about 85% of the resin ducts marked by an expert. On the other hand, precision at the level of 0.76 means that the model introduced a noticeable number of false ducts. However, a closer inspection of these ducts revealed that some could be deemed missed by an expert but found by the model. As a result, the CNN model seems to perform somewhat better than the error would indicate when detecting the resin ducts. A quality control step would be beneficial for improving the reliability of the train data and thus improving the model’s performance in the resin duct detection task.
Differences in the model’s performance between species can be observed. The most challenging was PIVI. For this species, the model misdetected, on average, 22% of the ducts simultaneously introducing the highest number of false ducts. Narrow rings with overall small resin duct size in this species could have made detection more difficult. On the other hand, the PITA seems to be the easiest for automatic processing. For this species, the CNN model scored the highest sensitivity (0.93) and specificity in the resin ducts detection task. PITA has high growth rates relative to the other species resulting in wide rings with larger and clear resin duct boundaries that might have simplified the detection task.
The CNN model was even more accurate when detecting the tree-ring boundaries. In total, it missed only 8% of these structures, with a very low rate of false tree-ring boundaries (precision on average equal to 0.99). The CNN model performed very well when detecting linear and regular tree-ring boundaries. Such boundaries constituted the training set predominantly. On the other hand, most missed boundaries were curly, curved, and arch-shaped (cf. Fig. 11c–e). Such boundaries were underrepresented in the training set, which resulted in model’s worse performance in relation to them. The CNN model also mostly failed when detecting boundaries of densely packed and thin tree rings. This, in turn, resulted in the over-segmenting of these tree rings (cf. Fig. 11a,b). Again, the performance of the model when used for tree-ring boundary detection varied depending on the species. The highest scores (SEN of 0.97 and PREC of 1.0) were obtained for PIPU. In comparison to the other pines in the dataset, PIPU had clear ring boundaries with good contrast and very few ”false” rings. On the other hand, the most challenging was PIPA since, for this species, the model performed worst, with 18% of missed tree-ring boundaries and the highest number of false boundaries. PIPA in comparison to the other pines in the dataset had low contrast yielding less distinct ring boundaries.
Good performance of tree-ring boundary detection translates directly into accurate measurements of tree-ring widths. As shown in Fig. 10 automatic width measurements agree with the measurements derived from expert annotations. This is confirmed by the \(R^2\) coefficient on average equal to 0.91, for fold 3 reaching even the value of 0.95 (cf. Table 6). Also, the mean absolute error of the mean average tree ring width does not exceed 10% (cf. Table 7) which can be considered a very good result.
More challenging than the tree-ring boundary detection is the tree rings segmentation aimed at extracting connected components bounded by two tree-ring boundaries and corresponding to consecutive rings. The accuracy of tree ring segmentation translates into tree-ring area measurement accuracy. One challenge to this problem is that the detected tree-ring boundaries are often discontinuous, weak, or do not span the core width. As a result, some neighboring tree rings may be merged, increasing the average core area. On the other hand, some closely located, dense tree-ring boundaries may connect in the middle of the core width, resulting in over-segmentation (cf. Fig. 11b). Still, the results of core area measurement can be considered accurate. The \(R^2\) correlation coefficient between the ring area determined fully automatically and derived from expert annotations is high at the level of 0.79 on average, for fold 2, reaching even the value of 0.88 (cf. Table 6). The ring over-segmentation and under-segmentation errors seem to compensate for each other since the global difference between the mean average area determined automatically and based on expert annotations does not exceed 4% (cf. Tab 7).
The remaining two statistics, i.e., the average number of ducts per ring and ring area coverage by ducts, are visibly less accurate. The reason is that they cumulate errors in both duct detection and tree ring segmentation. First, the resin duct detection mechanism overestimates the total number of ducts (the number of false negatives is less than the number of false positives). Next, the tree ring segmentation algorithm tends to over-segment the thin and densely located tree rings. Consequently, the average number of ducts per ring is overestimated by c.a. 36% compared to stats derived from expert manual annotations. It is equivalent to about one additional (false) resin duct in a statistical tree ring (cf. Table 7). Still, the correlation between automatic and expert measurements is quite high, with the \(R^2\) correlation coefficient at the average level reaching 0.55 (cf. Table 6).
The highest error corresponds to the measurement of tree ring area average coverage by ducts. Apart from the factors mentioned above, the proposed pipeline seems to overestimate the ring size compared to expert annotations. This effect is presented in Fig. 12, where ducts detected by the proposed pipeline (shown in navy) are visibly larger than the ducts annotated by an expert (the overlap** regions are shown in cyan). The issue could be fixed by the dedicated postprocessing of the ring detection results or by develo** the dedicated ducts segmentation algorithm.
As with every machine learning-based tool, our method poses some challenges and limitations53. The proposed pipeline requires a substantial number of annotated resin ducts and tree rings to train the model. This study does not test how many more resin ducts or tree rings would improve the error rate. The accuracy of the proposed method may be affected by the quality and resolution of the wood images, the quality of expert annotations, and the variability of resin duct structures and their relationships with tree rings across different Pinus species. The proposed method may require further validation to assess its performance and reliability on a wide range of wood samples including sections from dead trees. Future research opportunities include testing a larger dataset with species specific models or attempting to detect and measure other features of tree rings (e.g., fire scars or frost rings).
Finally, the proposed pipeline significantly reduces the core processing time (cf. Table 8). The time spent by an expert on annotating resin ducts and tree-ring boundaries in a wood core image ranged from 120 to 5465 s, with an average of 1217 s (c.a. 20 min) per core. The total time spent by an expert on annotating all 74 cores was about 25 h. The time required by the proposed pipeline to perform this task automatically was 423 s (c.a. 7 min), with an average of fewer than 6 s per core. The automatic processing was then more than 200 times faster than an expert. It is a significant improvement, even if some manual corrections are still required to fix the results of automatic resin ducts and tree-ring boundary detection. The proposed method can significantly reduce the time and effort required for resin duct and tree-ring analysis, making it more accessible to researchers and practitioners in dendrochronology.
Conclusions
Here we have presented new automatic methods that can be further developed to aid future research efforts into resin ducts. The convolutional neural network, and in particular the modified AttUNet model implemented in a patch-based set up, provides a useful method of automated detection of both tree rings and resin ducts in wood core images. Postprocessing of the detected structures allows determination of resin duct statistics in relation to the tree-rings with a relatively high accuracy.
The proposed pipeline offers several advantages over traditional manual methods. Firstly, it is much faster, as it does not require a human operator to mark and measure the resin ducts. This results in a significant reduction in processing time, especially for large datasets. Secondly, the pipeline eliminates the possibility of human error in marking and measuring the resin ducts, resulting in more accurate and consistent detection. This is particularly important when dealing with large datasets, where the manual method may be prone to variation and errors, depending on the operator’s experience and judgment. Future research could include an investigation of which false-positive resin duct detection by the model were actually true ducts overlooked by an expert. The task of marking resin ducts and tree rings requires sustained concentration, therefore some degree of human error would be expected that is not accounted for in the model performance scores. Finally, the pipeline allows for standardized analysis of resin duct characteristics regarding the tree ring area to which they belong. This is an improvement over traditional methods, which do not account for the location and distribution of the resin ducts within the tree rings. Standardization makes comparing results across different samples and studies easier, leading to more robust and reliable conclusions. The increased volume of data facilitated by the method can provide valuable insights into the environmental conditions and growth patterns of Pinus trees, which can be used to study and monitor the effects of climate change and other factors on forest ecosystems.
Resin duct characteristics and oleoresin production have been shown to be important defense mechanisms for certain tree species in the genus Pinus54. Measuring resin duct characteristics of trees can provide trends related to the effect of management actions at specific points in time along with responses to pests and pathogens. Despite recent progress in measuring and quantifying resin ducts4,55, research on this important defense mechanism has been hampered by the difficult and time consuming task of manually delineating duct areas and tree ring boundaries. The automation presented here represents a large improvement in the speed of measuring these attributes for pine tree wood cores. Methods outlined in this study could be incorporated into future dendrochronological software applications to improve workflow. The method can be adapted and optimized for other species and types of wood, potentially enabling new applications in fields such as wood science, ecology, and forestry.
Data availability
The datasets used and/or analysed during the current study available from the corresponding author on reasonable request.
References
Ferrenberg, S., Kane, J. M. & Mitton, J. B. Resin duct characteristics associated with tree resistance to bark beetles across lodgepole and limber pines. Oecologia 174, 1283–1292. https://doi.org/10.1007/s00442-013-2841-2 (2014).
Hood, S. & Sala, A. Ponderosa pine resin defenses and growth: Metrics matter. Tree Physiol. 35, 1223–1235. https://doi.org/10.1093/treephys/tpv098 (2015).
Vázquez-González, C., López-Goldar, X., Zas, R. & Sampedro, L. Neutral and climate-driven adaptive processes contribute to explain population variation in resin duct traits in a mediterranean pine species. Front. Plant Sci. 10, 1613. https://doi.org/10.3389/fpls.2019.01613 (2019).
Hood, S. M., Reed, C. C. & Kane, J. M. Axial resin duct quantification in tree rings: A functional defense trait. MethodsX 7, 101035. https://doi.org/10.1016/j.mex.2020.101035 (2020).
Chen, F. F., Yang, J. L. & Downes, G. A visual information assessment tool for resin canal identification and property measurement. IAWA J. 29, 397–408. https://doi.org/10.1163/22941932-90000194 (2008).
Thomas, J. & Collings, D. A. Detection and map** of resin canals by image analysis in transverse sections of mechanically perturbed, young pinus radiata trees. IAWA J. 38, 170–181. https://doi.org/10.1163/22941932-20170166 (2017).
Hood, S. M., Reed, C. C. & Kane, J. M. Axial resin duct quantification in tree rings: A functional defense trait. MethodsX 7, 101035. https://doi.org/10.1016/j.mex.2020.101035 (2020).
Vázquez-González, C. et al. Resin ducts as resistance traits in conifers: Linking dendrochronology and resin-based defences. Tree Physiol. 40, 1313–1326. https://doi.org/10.1093/treephys/tpaa064 (2020).
Russakovsky, O. et al. ImageNet large scale visual recognition challenge. Int. J. Comput. Vis. 115, 211–252. https://doi.org/10.1007/s11263-015-0816-y (2015).
Chai, J., Zeng, H., Li, A. & Ngai, E. W. Deep learning in computer vision: A critical review of emerging techniques and application scenarios. Mach. Learn. Appl. 6, 100134. https://doi.org/10.1016/j.mlwa.2021.100134 (2021).
Silva, J. L., Bordalo, R., Pissarra, J. & de Palacios, P. Computer vision-based wood identification: A review. Forestshttps://doi.org/10.3390/f13122041 (2022).
Arifin, M. R., Sugiarto, B., Wardoyo, R. & Rianto, Y. Development of mobile-based application for practical wood identification. IOP Conf. Ser. Earth Environ. Sci. 572, 012040. https://doi.org/10.1088/1755-1315/572/1/012040 (2020).
Yusof, R. et al. Transfer learning approach in automatic tropical wood recognition system. In Computational and Experimental Simulations in Engineering (eds Okada, H. & Atluri, S. N.) 1225–1233 (Springer, 2020).
Wu, F., Gazo, R., Haviarova, E. & Benes, B. Wood identification based on longitudinal section images by using deep learning. Wood Sci. Technol. 55, 553–563. https://doi.org/10.1007/s00226-021-01261-1 (2021).
de Geus, A. R., Backes, A. R., Gontijo, A. B., Albuquerque, G. H. Q. & Souza, J. R. Amazon wood species classification: A comparison between deep learning and pre-designed features. Wood Sci. Technol. 55, 857–872. https://doi.org/10.1007/s00226-021-01282-w (2021).
Kırbaş, İsmail & Çifci, A. An effective and fast solution for classification of wood species: A deep transfer learning approach. Ecol. Inf. 69, 101633. https://doi.org/10.1016/j.ecoinf.2022.101633 (2022).
Fabijanska, A., Danek, M. & Barniak, J. Wood species automatic identification from wood core images with a residual convolutional neural network. Comput. Electron. Agric. 181, 105941. https://doi.org/10.1016/j.compag.2020.105941 (2021).
Liu, B., Chen, S., Huang, H. & Tian, X. Tree species classification of backpack laser scanning data using the pointnet++ point cloud deep learning method. Remote Sens.https://doi.org/10.3390/rs14153809 (2022).
Hell, M., Brandmeier, M., Briechle, S. & Krzystek, P. Classification of tree species and standing dead trees with lidar point clouds using two deep neural networks: Pointcnn and 3dmfv-net. PFG J. Photogramm. Remote Sens. Geoinform. Sci. 90, 103–121. https://doi.org/10.1007/s41064-022-00200-4 (2022).
Allen, M. J., Grieve, S. W. D., Owen, H. J. F. & Lines, E. R. Tree species classification from complex laser scanning data in mediterranean forests using deep learning. Methods Ecol. Evol.https://doi.org/10.1111/2041-210X.13981 (2022).
Yang, S.-Y. et al. Application of neural networks for classifying softwood species using near infrared spectroscopy. J. Near Infrared Spectrosc. 28, 298–307 (2020).
Moura, M. M. et al. Towards amazon forest restoration: Automatic detection of species from uav imagery. Remote Sens.https://doi.org/10.3390/rs13132627 (2021).
Jiang, S., Yao, W. & Heurich, M. Dead wood detection based on semantic segmentation of vhr aerial cir imagery using optimized fcn-densenet. Int. Arch. Photogramm. Remote Sens. Spatial Inf Sci. XLII–2/W16, 127–133. https://doi.org/10.5194/isprs-archives-XLII-2-W16-127-2019 (2019).
Huang, J. et al. Accurate identification of pine wood nematode disease with a deep convolution neural network. Remote Sens.https://doi.org/10.3390/rs14040913 (2022).
Li, H., Fang, W., Li, L. & Chln, X. Recognition of pine wood infected with pine nematode disease based on deep learning. J. For. Eng. 6, 142–147. https://doi.org/10.13360/j.issn.2096-1359.202012041 (2021).
Yu, R. et al. Early detection of pine wilt disease using deep learning algorithms and uav-based multispectral imagery. For. Ecol. Manag. 497, 119493. https://doi.org/10.1016/j.foreco.2021.119493 (2021).
Tao, H. et al. Deep learning-based dead pine tree detection from unmanned aerial vehicle images. Int. J. Remote Sens. 41, 8238–8255. https://doi.org/10.1080/01431161.2020.1766145 (2020).
Qiao, R., Ghodsi, A., Wu, H., Chang, Y. & Wang, C. Simple weakly supervised deep learning pipeline for detecting individual red-attacked trees in vhr remote sensing images. Remote Sens. Lett. 11, 650–658. https://doi.org/10.1080/2150704X.2020.1752410 (2020).
Norlander, R., Grahn, J. & Maki, A. Wooden knot detection using convnet transfer learning. In Image Analysis (eds Paulsen, R. R. & Pedersen, K. S.) 263–274 (Springer, 2015).
Gao, M., Chen, J., Mu, H. & Qi, D. A transfer residual neural network based on resnet-34 for detection of wood knot defects. Forests 12, 1–16. https://doi.org/10.3390/f12020212 (2021).
Chen, Y., Sun, C., Ren, Z. & Na, B. Review of the current state of application of wood defect recognition technology. BioResources 18, 2288–2302. https://doi.org/10.15376/biores.18.1.Chen (2023).
Ding, F. et al. Detecting defects on solid wood panels based on an improved ssd algorithm. Sensorshttps://doi.org/10.3390/s20185315 (2020).
Li, D., Zhang, Z., Wang, B., Yang, C. & Deng, L. Detection method of timber defects based on target detection algorithm. Measurement 203, 111937. https://doi.org/10.1016/j.measurement.2022.111937 (2022).
Sun, P. Wood quality defect detection based on deep learning and multicriteria framework. Math. Probl. Eng. 2022, 4878090. https://doi.org/10.1155/2022/4878090 (2022).
Yang, Y., Zhou, X., Liu, Y., Hu, Z. & Ding, F. Wood defect detection based on depth extreme learning machine. Appl. Sci.https://doi.org/10.3390/app10217488 (2020).
Ling, J. & **e, Y. Research on wood defects classification based on deep learning. Wood Res. 67, 147–156. https://doi.org/10.37763/WR.1336-4561/67.1.147156 (2022).
Celik, Y., Guney, S. & Dengiz, B. Applications of deep learning techniques to wood anomaly detection. In Xu, J., Altiparmak, F., Hassan, M. H. A., García Márquez, F. P. & Hajiyev, A. (eds.) Proceedings of the Sixteenth International Conference on Management Science and Engineering Management – Volume 1, 379–387 (Springer, 2022).
Wimmer, G., Schraml, R., Hofbauer, H., Petutschnigg, A. & Uhl, A. Two-stage cnn-based wood log recognition. Lecture Notes in Computer Science (including subseries Lecture Notes in Artificial Intelligence and Lecture Notes in Bioinformatics)12955 LNCS, 115–125, https://doi.org/10.1007/978-3-030-87007-2_9(2021).
Hacıefendioğlu, K. et al. Wood construction damage detection and localization using deep convolutional neural network with transfer learning. Eur. J. Wood Wood Prod. 80, 791–804. https://doi.org/10.1007/s00107-022-01815-5 (2022).
Kurdthongmee, W. & Suwannarat, K. Locating wood pith in a wood stem cross sectional image using yolo object detection. In 2019 International Conference on Technologies and Applications of Artificial Intelligence (TAAI). https://doi.org/10.1109/TAAI48200.2019.8959823(2019).
Habite, T., Abdeljaber, O. & Olsson, A. Determination of pith location along Norway spruce timber boards using one dimensional convolutional neural networks trained on virtual timber boards. Constr. Build. Mater. 329, 127129. https://doi.org/10.1016/j.conbuildmat.2022.127129 (2022).
Soille, P. & Misson, L. Tree ring area measurements using morphological image analysis. Can. J. For. Res. 31, 1074–1083. https://doi.org/10.1139/x01-025 (2001).
Cerda, M., Hitschfeld-Kahler, N. & Mery, D. Robust tree-ring detection. In Pacific-Rim Symposium on Image and Video Technology, vol. 4872 of LNCS, 575–585 (Springer, 2007).
Hietz, P. A simple program to measure and analyse tree rings using Excel. R and SigmaScan. Dendrochronologia 29, 245–250. https://doi.org/10.1016/j.dendro.2010.11.002 (2011).
Henke, M. & Sloboda, B. Semiautomatic tree ring segmentation using active contours and an optimised gradient operator. For. J. 60, 185–190 (2014).
Lara, W., Bravo, F. & Sierra, C. measuRing: An R package to measure tree-ring widths from scanned images. Dendrochronologia 34, 43–50. https://doi.org/10.1016/j.dendro.2015.04.002 (2015).
Fabijańska, A., Danek, M. G., Joanna, B. & Piórkowski, A. Towards automatic tree rings detection in images of scanned wood samples. Comput. Electron. Agric. 140, 279–289. https://doi.org/10.1016/j.compag.2017.06.006 (2017).
Fabijańska, A. & Gorzata Danek, M. Deepdendro: A tree rings detector based on a deep convolutional neural network. Comput. Electron. Agric. 150, 353–363. https://doi.org/10.1016/j.compag.2018.05.005 (2018).
Poláček, M. et al. Automation of tree-ring detection and measurements using deep learning. bioRxivhttps://doi.org/10.1101/2022.01.10.475709(2022). https://www.biorxiv.org/content/early/2022/03/22/2022.01.10.475709.full.pdf.
Speer, J. H. Fundamentals of Tree Ring Research (University of Arizona Press, Tucson, 2012), reprint edition edn.
Oktay, O. et al. Attention U-Net: Learning where to look for the pancreas (2018). ar**v:1804.03999.
Kingma, D. P. & Ba, J. Adam: A method for stochastic optimization. CoRR. arxiv:1412.6980. (2014).
Nasir, V. & Sassani, F. A review on deep learning in machining and tool monitoring: Methods, opportunities, and challenges. Int. J. Adv. Manuf. Technol. 115, 2683–2709. https://doi.org/10.1007/s00170-021-07325-7 (2021).
Hood, S., Sala, A., Heyerdahl, E. K. & Boutin, M. Low-severity fire increases tree defense against bark beetle attacks. Ecology 96, 1846–1855. https://doi.org/10.1890/14-0487.1 (2015).
Valor, T., Hood, S. M., Piqué, M., Larrañaga, A. & Casals, P. Resin ducts and bark thickness influence pine resistance to bark beetles after prescribed fire. For. Ecol. Manag. 494, 119322. https://doi.org/10.1016/j.foreco.2021.119322 (2021).
Author information
Authors and Affiliations
Contributions
A.F. Methodology, software, validation, formal analysis, investigation, writing—original draft, writing—review and editing, visualisation. G.C.: Conceptualization, data curation, investigation, validation, writing—original draft, writing—review and editing. All authors reviewed the manuscript.
Corresponding author
Ethics declarations
Competing interests
The authors declare no competing interests.
Additional information
Publisher's note
Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
Rights and permissions
Open Access This article is licensed under a Creative Commons Attribution 4.0 International License, which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons licence, and indicate if changes were made. The images or other third party material in this article are included in the article's Creative Commons licence, unless indicated otherwise in a credit line to the material. If material is not included in the article's Creative Commons licence and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder. To view a copy of this licence, visit http://creativecommons.org/licenses/by/4.0/.
About this article
Cite this article
Fabijańska, A., Cahalan, G.D. Automatic resin duct detection and measurement from wood core images using convolutional neural networks. Sci Rep 13, 7106 (2023). https://doi.org/10.1038/s41598-023-34304-7
Received:
Accepted:
Published:
DOI: https://doi.org/10.1038/s41598-023-34304-7
- Springer Nature Limited