The CRISP-DM (Cross-Industry Standard Process for Data Mining) methodology (Schröer et al., 2021) was employed to develop a system capable of identifying timber species using artificial intelligence. CRISP-DM’s iterative nature allows for adjustments in each of its generic phases, making it highly applicable to machine learning and deep learning challenges (Schröer et al., 2021). These phases encompass data acquisition and processing, algorithm modeling, performance evaluation, and system deployment. In this context, computational models trained iteratively were used to classify macroscopic image data derived from cross sections of wood. Macroscopic-based methods are the most advantageous for initial wood identification. However, in real-world environments, individuals typically require specialized training and a basic understanding of these methods to differentiate between species (Ruffinatto, Castro, Cremonini, Crivellaro, & Zanuttini, 2020).
2.1. Colombian Forest material - Data
A total of 20 species were carefully chosen, comprising 18 native species and two planted species. This selection includes some of the most commercially relevant species in the region and throughout Colombia. These species have unfortunately been subject to a high level of illegal timber trafficking, as reported by the forestry authorities of the Cauca Regional Autonomous Corporation (CRC) within the environmental management division. The dataset is composed of images from two sources: a dataset of macroscopic images of 11 species, as previously documented in (Cano Saenz et al., 2022), which were obtained using a digital microscope; images of 9 native forest species from the Pacific region, which were acquired using the same type of device during forest harvesting operations conducted by the Ministry of Environment in collaboration with regional corporations. This dataset is publicly available for academic and research purposes, and it can be accessed at https://www.unicauca.edu.co/laboratorios-fisica/maderas_colombia/
The selection of forest species (Table 1) considered various factors, including different families, distinctions between hardwoods and softwoods, commercial and prohibited species, and whether they originated from natural or planted forests. Additionally, species with high ecological value within the Colombian ecosystem were considered.
Table 1
Description of wood species in the dataset.
Scientific Name/Folder Name
|
Family
|
Common Colombian Name/Global Trade Name
|
Wood Type
|
Feature
|
Samples
|
subset 1
|
|
|
Campnosperma panamensis
|
Anacardiaceae
|
Sajo/Orey Wood
|
Hardwood
|
Natural Forest
|
137
|
Cedrela odorata
|
Meliaceae
|
Cedro costeño/ Cigarbox cedar
|
Hardwood
|
Valuable - ban
|
159
|
Cedrelinga cateniformis
|
Fabaceae
|
Achapo/Cedrorana
|
Hardwood
|
Commercially available
|
115
|
Cordia alliodora
|
Boraginaceae
|
Nogal cafetero/Laurel
|
Hardwood
|
Commercially available
|
115
|
Dialyanthera gracilipes
|
Myristicaceae
|
Cuángare/Virola/White Cedar
|
Hardwood
|
Natural Forest
|
116
|
Eucalyptus globulus
|
Myrtaceae
|
Eucalipto blanco/Blue gum
|
Hardwood
|
Planted specie
|
167
|
Handroanthus chrysanthus
|
Bignoniaceae
|
Guayacán amarillo/Trumpet Tree
|
Hardwood
|
Commercially available
|
116
|
Humiriastrum procerum
|
Humiriaceae
|
Chanul/Corozo
|
Hardwood
|
Valuable - ban
|
116
|
Fraxinus uhdei
|
Oleaceae
|
Urapan/fresno/Shamel ash
|
Hardwood
|
Commercially available
|
245
|
Cupresus lusitanica
|
Cupressaceae
|
Cipres/Pino Cipres
|
Softwood
|
Planted specie
|
161
|
Pinus patula
|
Pinaceae
|
Pino patula/Ocote
|
Softwood
|
Planted specie
|
248
|
subset 2
|
|
|
Osteophloeum Platyspermun
|
Myristicaceae
|
Aguamanil/caracoli
|
Hardwood
|
Commercially available
|
101
|
Brosimum utile
|
Moraceae
|
Sande/guaimaro
|
Hardwood
|
Natural Forest
|
120
|
Pouteria Caimito
|
Sapotaceae
|
Caimito/caimitillo
|
Hardwood
|
Natural Forest
|
101
|
Calophyllum mariae
|
Calophyllaceae
|
Palo María/ Aceite Maria
|
Hardwood
|
Commercially available
|
100
|
Carapa guianensis
|
Meliaceae
|
Tangare/Andiroba/Nandiroba
|
Hardwood
|
Valuable
|
100
|
Cariniana pyriformis
|
Lecythidaceae
|
Abarco/Caobano/Equitiva
|
Hardwood
|
Valuable
|
101
|
Guatteria cuatrecasasii
|
Annonaceae
|
Cargadero
|
Hardwood
|
Commercially available
|
101
|
Ocotea insulares
|
Lauraceae
|
Laurel Paliarte / guadaripo
|
Hardwood
|
Commercially available
|
100
|
Qualea acuminata Spruce ex Warm
|
Vochysiaceae
|
Pomo/Chisparo/acuminata
|
Hardwood
|
Commercially available
|
100
|
2.2 Sample preparation and imaging
The image acquisition protocol followed the guidelines provided by the Regional Autonomous Corporation of Cauca (CRC), an organization with extensive field expertise. This protocol was based on an adaptation of the standard procedures outlined by the Ministry of Environment and Sustainable Development, covering aspects such as extraction, cutting, and specific regions of interest (Fig. 1). Additionally, the protocol took into account recommendations from literature sources, particularly those mentioned in Ravindran (2022), to ensure the creation of a high-quality and reliable test dataset (Ravindran & Wiedenhoeft, “”2022).
The preparation of the dataset for the selected timber species involved obtaining a suitable number of images for the timber classifier. This process unfolded as follows:
a) The first subset (dataset 1), which comprises thousands of images, was captured using a digital magnifying glass on exposed crosssections of wood blocks (Fig. 1). From this extensive collection, a careful selection of 100 to 250 images per species was made, focusing on image quality, sharpness, and overall image focus. This selective process was guided by criteria recommended by the authors, with the intent of working with a manageable number of images.
b) The second subset (dataset 2), encompassing the additional nine species, involved the extraction of four to five cylindrical samples from two to three standing specimens per species. These samples were obtained using Pressler drills or forestry drills with a diameter of approximately 5 to 6 mm (Fig. 2). Subsequently, the wood specimens, or wood cores, were left to dry to reduce excess moisture, which can impact image saturation and intensity during the image capture process. Following this drying phase, cross-sections of the wood were performed, revealing the anatomical characteristics of the wood. Multiple images were captured from various sections, totaling between 80 to 120 images per species.
Both subsets have consistent cross-sectional areas, irrespective of whether the wood was originally in the form of a block or a cylinder. This uniformity is maintained since the cut exposes the most pertinent anatomical characteristics for discrimination through macroscopic analysis (Barmpoutis et al., 2018). Additionally, the images were acquired using a digital magnifying glass with a fixed magnification of 10X, equivalent to 3.9 µm/pixel. This magnification covers an area measuring 2.5 mm x 1.9 mm, providing an appropriate scale for observing key wood anatomical features such as pores, fibers, vessels, and parenchyma. Lastly, the images’ resolution was set to 640x480 pixels, ensuring clarity and detail in the visual representation.
2.2. Architectures and modeling for transfer learning
Convolutional Neural Networks (CNNs) are versatile models that have demonstrated their adaptability in various domains, particularly in tasks involving image classification and localization with reference images ( Wang, Y., Zhang, W., Gao, R. et al. Recent advances in the application of deep learning methods to forestry. Wood Sci Technol 55, 1171–1202 (2021)) CNNs embody the core principle of machine learning, aiming to reduce human intervention in the development of autonomous tools (Kattenborn et al., 2021; Macaulay & Shafiee, 2022). To achieve optimal learning, CNNs typically require a substantial volume of images, often in the hundreds of thousands. However, in the context of wood identification, where obtaining specimens and images is limited, transfer learning becomes a well-suited approach. Transfer learning is employed to strike a balance between training error and validation error, preventing the model from memorizing patterns. This balance is achieved through various regularization techniques, including dropout, early stopping, weight decay, and stochastic depth (Xu et al., 2019; Gonçalves & João, 2022).
Consequently, in this study, various CNN models were retrained to find the most suitable weights for classification. Several architectures, such as Resnet-50, EfficientNet-B0, and MobileNet, were experimented with and compared based on their performance. The goal was to determine the most effective architecture for deploying the model in the field. The Resnet-50 architecture (Residual Network) was chosen as a reference due to its widespread use, flexibility, and robustness. Resnet-50 is particularly useful for training deep networks using the residual learning framework, as demonstrated in prior work (Moreno, 2020; Kırbaş & Çifci, 2022). This architecture has also been employed in the Xylotron tool (Ravindran et al., 2020).
Special attention was devoted to the EfficientNet-B0 architecture, which is relatively newer and lighter in terms of trainable hyperparameters. The EfficientNet family of architectures is designed to provide improved accuracy and efficiency in terms of computational processing (Tan & Le, 2019), making it a promising option for the future of timber species identification.
2.3. Evaluation
At this stage, the evaluation of the CNN models involves assessing their performance on both the training and testing datasets, as well as their real-world effectiveness when deployed in the field. Typically, this evaluation is conducted within the context of timber species. It entails using 70% of the available data for training and conducting experimental validations with the remaining 30% of the data, which is kept unknown to the models. The models are fine-tuned by adjusting hyperparameters, including the learning rate (LR), the number of batches per epoch, the total number of epochs, the percentage of layers with dropout, and the number of frozen convolutional layers in transfer learning. The goal is to achieve optimal feature generalization and to deploy the model with the best metrics.
The performance of the classifier models is assessed using a range of metrics, including the confusion matrix (CM), from which key metrics such as accuracy (A), precision (P), sensitivity (S) or recall, F1-score, and the Mathews Correlation Coefficient (MCC) are derived. The MCC (Eq. 1) is a particularly valuable metric as it provides a balanced measure of classification performance (Chicco et al., 2021) and complements more traditional ones by taking into account all four values in the confusion matrix (True Positives TP, True Negatives TN, False Positives FP, False Negatives FN).
$$MCC = \frac{(TP\times TN - FP\times FN)}{\sqrt{(TP+FP)(TP+FN)(TN+FP)(TN+FN) }}$$
1
In the field testing of the deployed model within the framework of this study, classification percentages were evaluated. The testing was conducted in warehouses, and involved using timber species samples acquired on-site that were provided by the Cauca Autonomous Regional Corporation. This testing phase offers insight into the classifier’s practicality as a tool for real-world applications. During this stage, a specialized metric known as the F3-score is introduced. This metric is designed to assess the device’s performance by focusing on the top 3 matches or highest-weighted species. The aim is to assist in the determination and verification of forest species. In other words, the system is not expected to achieve 100% accuracy, which is a feat even beyond human capabilities.
2.4. Deployment
Most works focused on deep learning for wood identification typically conclude their efforts after evaluating the model on a test dataset and demonstrating its utility for this purpose. However, only a few applications, such as Xylorix and Xylotron, have progressed to the deployment phase, with the intention of commercial or academic use, as well as for applications in wood transport control processes, as mentioned in Arevalo et al. (2021) and Xylorix (2022).
In this case, the goal is to enhance the flexibility of deploying and using the deep learning model, with or without an internet connection. Two deployment schemes have been considered: i) A low-cost and portable microcomputer (Fig. 4a) that can operate with or without internet access. The CNN model can be used sequentially to make classification predictions, and it offers a user-friendly interface on a touchscreen; ii) A chatbot response system (Fig. 3b) that provides versatility and can be accessed from any device with internet connectivity. This system offers the model’s functionalities through the Telegram messaging application and communicates with Amazon AWS cloud services via the HTTP protocol.
In the second deployment scheme, an API Gateway access point continuously listens for incoming requests. Each message it receives triggers an activation signal to an AWS Lambda computing service. This Lambda function is responsible for processing the image, making predictions, and sending a response message to the user through the messaging system interface. Notably, the AWS Lambda compute service is only activated when a request is received and does not store states. A distinct instance is activated for each request, ensuring streamlined parallelization and cost reduction, especially when the request rate is not continuous or predictable.