Original Article

Visual Classification of Wood Knots Using k-Nearest Neighbor and Convolutional Neural Network

Hyunbin Kim2, Mingyu Kim2, Yonggun Park2,3, Sang-Yun Yang2,3, Hyunwoo Chung2, Ohkyung Kwon4, Hwanmyeong Yeo2,3,
Author Information & Copyright
2Department of Forest Sciences, Seoul National University, Republic of Korea
3Research Institute of Agriculture and Life Sciences, Seoul National University, Republic of Korea
4National Instrumentation Center for Environmental Management, Seoul National University, Republic of Korea
Corresponding author: Hwanmyeong Yeo (e-mail: hyeo@snu.ac.kr, ORCID: 0000-0002-1779-069X)

© The Korean Society of Wood Science & Technology.

Received: Jan 08, 2019; Accepted: Mar 07, 2019

Published Online: Mar 25, 2019

Abstract

Various wood defects occur during tree growing or wood processing. Thus, to use wood practically, it is necessary to objectively assess their quality based on the usage requirement by accurately classifying their defects. However, manual visual grading and species classification may result in differences due to subjective decisions; therefore, computer-vision-based image analysis is required for the objective evaluation of wood quality and the speeding up of wood production. In this study, the SIFT+k-NN and CNN models were used to implement a model that automatically classifies knots and analyze its accuracy. Toward this end, a total of 1,172 knot images in various shapes from five domestic conifers were used for learning and validation. For the SIFT+k-NN model, SIFT technology was used to extract properties from the knot images and k-NN was used for the classification, resulting in the classification with an accuracy of up to 60.53% when k-index was 17. The CNN model comprised 8 convolution layers and 3 hidden layers, and its maximum accuracy was 88.09% after 1205 epoch, which was higher than that of the SIFT+k-NN model. Moreover, if there is a large difference in the number of images by knot types, the SIFT+k-NN tended to show a learning biased toward the knot type with a higher number of images, whereas the CNN model did not show a drastic bias regardless of the difference in the number of images. Therefore, the CNN model showed better performance in knot classification. It is determined that the wood knot classification by the CNN model will show a sufficient accuracy in its practical applicability.

Keywords: visual classification; knot classification; k-nearest neighbor; convolution neural network; deep learning; species identification; wood classification

1. INTRODUCTION

Due to its eco-friendly, human-friendly, and unique pattern, wood is highly popular. There has also been a growing interest in wood as a core material for sustainable development. Accordingly, there has been a need for objective and accurate quality evaluation and grading classification for the efficient use of wood based on its usage requirement. Generally, since wood is distributed in lumber form, the quality of wood is largely dependent upon the type and size of defects on its surface. While there may be different defects to be evaluated based on the usage of lumber, the quality of wood is generally evaluated by defects such as knots, cleavage and twisting, etc., which govern the dynamic performance and aesthetic properties of wood (KS F 2151, 2014).

There are various forms of defects during tree growing or processing: particularly, knots affect the strength performance of wood depending on their kind; therefore, the types of defects of the wood surface should be accurately classified for an accurate quality evaluation. There have been various methods using naked eye, electron microscope, near-infrared spectroscopy, etc. in species and grade classifications (Eom and Park, 2018; Kim and Choi, 2016; Kwon et al., 2017; Lee et al., 2018; Mohan, 2012; Park et al., 2018; Park et al., 2017; Tong et al., 2017). However, visual grading is performed by experienced evaluators, and Lampinen et al. (1998) reported that such visual grading results in classification with an accuracy of about 80%. However, evaluators’ subjective decision on the wood quality may cause errors; hence, it is necessary to develop a grade evaluation method that is more objective and less susceptible to surrounding environments.

Machine vision simulates and processes human’s visual capacity with a system of hardware and software, and it is often used in automated manufacturing processes in which defects of a product are repetitively measured (Lampinen et al., 1998). Among machine visions, image analysis used to categorize images usually extract features from images and categorizes images based on the analysis of the extracted features. Scale-Invariant Feature Transform (SIFT) is an algorithm that identifies and extracts features in images, such as corners, and it can extract features regardless of rotation, magnification. or location (Putri, 2018). One of the intuitive and simple map learning models among machine learning models, k-nearest neighbor (k-NN), identifies k number of data that are the closest in the same dimension from the existing data set when new data appears then categorizes images by allocating the class with the highest number of appearances among these data to the class of the new data (Mohan and Venkatachalapathy, 2012; Putri and Machbub, 2018). Research has been performed to categorize knots on a wooden surface using k-NN (Mohan and Venkatachalapathy, 2012), and it has been reported that the categorization of wood defects based on k-NN would result in an accuracy of about 72% (Tong et al., 2017). Furthermore, a study attempted to combine SIFT and k-NN to categorize wood species (Hu et al., 2015). However, there have been few studies on applying the combined structure of SIFT and k-NN to knot classification.

Image analysis based on deep-learning technology, one of the artificial intelligence techniques, shows higher performance than the other classification methods. Object recognition system using deep learning uses Convolutional Neural Network (CNN) to classify objects. CNN performs both feature extraction from and classification of images at the same time. This method extracts features from images through canals in certain size then categorize them using Artificial Neural Network (ANN) (LeCun et al., 2015). After having extracted various features of images using several canals, CNN converts them into a one- dimensional vector and categorizes them via ANN. With CNN, feature extraction and classification can be learned simultaneously with labeled images; thus, it allows for extracting and classifying suitable features for each target object. It has been reported that classifying the grade of broadleaf trees using one- dimensional ANN would result in an accuracy of about 80% (Thomas, 2017), and there has been another study on knot detection using two-dimensional CNN (Norlander et al., 2015). While CNN is currently used in dividing objects from various images or spectrum, few studies have applied it on wood. Therefore, in this study, SIFT+k-NN and CNN models were used to realize a model that automatically classifies the types of knots and the accuracy of the proposed model was evaluated.

2. MATERIALS and METHODS

2.1. Image dataset

The species used in this study were Larix kaempferi, Pinus koraiensis, Pinus densiflora, Cryptomeria japonica, and Chamaecyparis obtusa. The surface of each wood was photographed, and a total of 937 lumber images were used for learning and validation. The program used to label knots on the images was VGG Image Annotator (USA, Department of Engineering Science, University of Oxford). The knots on the surface of each lumber were classified into four categories based on KS F 2151, namely, decayed knot, encased knot, sound knot, and spike knot. Then, the knots’ images were cut in square to show the overall shape of the knots. Their size was adjusted to 100 × 100 pixels and the knot images with RGB color space data were used for learning and validation. The ratio of the training set used for model learning, to the validation set used to evaluate the learning level was 8:2. A total of 937 knot images were used for the learning while a total of 235 were used for the validation.

2.2. Knot classification using the model, SIFT+k-NN

Shown in Fig. 1 is the structure of the knot classification model using SIFT+k-NN. SIFT+k-NN is a structure combining SIFT, which extracts feature points within an image, and k-NN, which classifies images based on the feature points. Since each image contains features that represent it, they were extracted using SIFT. From each feature point, vectors of 128-dimension were created and entered into k-NN for learning. The feature point vectors extracted from the training set images were set as the initial data and the feature points extracted from the validation set images were categorized to determine the validation accuracy level of SIFT+k-NN model. The validation set was classified as the group with the highest frequency among the k number of the closest data. Here, the k index, which determines the performance of k-NN, was changed from 1 to 3, 5, …, and to 23 while conducting learning, and the k index with the highest validation accuracy was selected.

wood-47-2-229_F1
Fig. 1. Structure of SIFT+k-NN model. The image extracted by SIFT(a), Summed descriptors(b) and k-NN(c).
Download Original Figure

The features extracted from SIFT were grouped using k-Means Clustering. While circling each point, a new mass center was repetitively calculated until the group no longer changed; subsequently, they were grouped in such a way that they belong to the group to which the closest mass center belongs, and the key groups were then analyzed.

2.3. Knot classification using CNN

Shown in Fig. 2 is the configuration of CNN knot classification model used in this study. The size of the images used as an input was 100 × 100 pixels and images having RGB color space data were used. First, 32 feature images were created with convolution layers, which were maxpooling-processed in 50 × 50 pixels. Later, two processes, namely, convolution and maxpooling, were performed additionally for each block, and they were extracted as feature images in 6 × 6 pixels with 128 features per pixel. The feature-extracted images were finally converted into a one-dimensional vector with the size of 4,608 through the full connection; they were then passed through the hidden layer with 256, 128, 128 nodes for the knot classification. In this study, dropout method was used as a regulation method to prevent overfitting of the model.

wood-47-2-229_F2
Fig. 2. Structure of CNN model (*: (No. of pixels, No. of pixels, RGB value), **: (No. of pixels, No. of pixels, No. of dimension), ***: (No. of nodes)).
Download Original Figure

3. RESULTS and DISCUSSION

3.1. Knot classification results based on the model SIFT+k-NN

Shown in Fig. 3 are the results based on the model SIFT+k-NN. The more the k index, the lower the accuracy of the data for training became and the accuracy of the data for testing showed to decrease after increasing. The validation accuracy was the highest when the k index was 17, and the confusion matrix at that time is shown in Table 1. The average knot classification accuracy of the model was about 69.36%. Spike knots showed the lowest classification accuracy, and it is believed that this is because the number of spike knot images was so small that it was difficult to extract various feature points. In addition, since more images of sound knots were collected than any other knot images, the classification accuracy of sound knots was higher than the others and the others were often classified as sound knot. Therefore, it is determined that SIFT+k-NN model will offer a low accuracy unless the number of images of all knot forms is equally acquired.

wood-47-2-229_F3
Fig. 3. Accuracy of SIFT+k-NN according to k index.
Download Original Figure
Table 1. Confusion matrix of SIFT+k-NN model at k index = 17.
Predicted Knot type
Actual Knot type Decayed Encased Sound Spike
Decayed 23 6 16 0
Encased 5 43 10 0
Sound 8 9 95 2
Spike 2 5 9 2
Download Excel Table

The study analyzed the key features based on k-Means Clustering. Shown in Fig. 4(a) are the key features when the number of clusters was 8. There were differences in the distribution of feature points depending on knot types, and in Cluster 1, feature points extracted from dark and the decayed parts were distributed. In Cluster 3, feature points extracted from logged and processed parts were distributed while, those extracted from loaded parts and barks were distributed in Cluster 5. Shown in Fig. 4(b) is the knot image with the feature points distributed in Cluster 5 marked on it. These feature points classified as Cluster 5 are mostly distributed in spike knots, and within the spike knot images, the aging of the wood surface excluding the knot parts was extracted as a feature. It is expected that higher classification accuracy would result if knots were clustered as data set in a polygon form instead of square form.

wood-47-2-229_F4
Fig. 4. Predicted descriptors clusters per class (a) and distribution of feature points classified as cluster 5 (b).
Download Original Figure
3.2. Knot classification results based on the model CNN

Shown in Fig. 5 is the accuracy of CNN model based on the CNN learning epoch. As the result of CNN learning, the highest accuracy was shown at total 1205 epochs, at which, the validation accuracy was 88.09 %. The training set accuracy after 1205 epochs was 97.23%, which was determined to be no-overfitting to the images learned. Shown in Table 2 is the confusion matrix at the time. The deflection to sound knots was smaller in CNN than in SIFT+k-NN and even if the even number of images was not secured among the types of knots, CNN-based classification showed a high accuracy. However, CNN-based knot classification, in some cases, encased knots and sound knots were not accurately classified. In case of the images for which the prediction failed, many of them had healthy and encased parts at the same time, as shown in Fig. 6. In fact, if the dead part occupies 40 to 60% of a knot, it is difficult to accurately distinguish encased knots from sound knots. It is believed that since the CNN model used in this study could not acquire the sufficient number of images required for the learning of such a case, there were some cases in which the encased and sound knots failed to be classified accurately. The CNN-based knot classification model developed in this study offers a high accuracy on knot images without barks and if more knot data are used in learning, more objective knot classification with a higher accuracy can be expected.

wood-47-2-229_F5
Fig. 5. Loss and Accuracy of CNN model according to Epoch.
Download Original Figure
Table 2. Confusion matrix of CNN model after 1205 epochs
Predicted Knot type
Actual Knot type Decayed Encased Sound Spike
Decayed 37 5 2 0
Encased 6 50 9 0
Sound 0 1 110 1
Spike 1 0 3 10
Download Excel Table
wood-47-2-229_F6
Fig. 6. Knot image failed to classify.
Download Original Figure

4. CONCLUSION

This study aimed to realize a model that automatically categorizes the types of knots using SIFT+k-NN and CNN and analyze the accuracy of the developed models. 1,172 knot images in diverse shapes were acquired from five domestic conifers and used for learning and validation. SIFT+k-NN showed an accuracy of up to 69.4 %, but due to the deflection in the number of certain knot images, other knot images were incorrectly categorized as sound knots, which had the largest ratio. CNN showed a higher classification accuracy of up to 88.1% compared to SIFT+k-NN. Additionally, there was no deflection in knot classification despite the fact that the uneven number of knot images by type was not used in the learning process. Therefore, CNN-based knot classification model developed in the study can offer a more accuracy than the SIFT+k-NN-based knot classification method, through which it was determined that knot classification based on the CNN model with images or spectrum shows a practically applicable accuracy.

ACKNOWLEDGMENT

This study was a basic research project with the support of the National Research Foundation of Korea, funded by the Korean government (Ministry of Education) in 2018 (NRF-2018R1D1A1B07050743) and this study was carried out with the support of ‘R&D Program for Forest Science Technology (Project No. 2016009B10-1819-AB01)’ provided by Korea Forest Service (Korea Forestry Promotion Institute).

Appendices

APPENDIX (Korean Version)
k-Nearest Neighbor와 Convolutional Neural Network에 의한 제재목 표면 옹이 종류의 화상 분류

초록 : 목재의 결점은 생장과정에서 또는 가공 중에 다양한 형태로 발생한다. 따라서 목재를 이용하기 위해서는 목재의 결점을 정확하게 분류하여 용도에 맞는 목재 품질을 객관적으로 평가할 필요가 있다. 하지만 사람에 의한 등급구분과 수종구분은 주관적 판단에 의해 차이가 발생할 수 있기 때문에 목재 품질의 객관적 평가 및 목재 생산의 고속화를 위해서는 컴퓨터 비전을 활용한 화상분석 자동화가 필요하다. 본 연구에서는 SIFT+k-NN 모델과 CNN 모델을 통해 옹이의 종류를 자동으로 구분하는 모델을 구현하고 그 정확성을 분석해보고자 하였다. 이를 위하여 다섯 가지 국산 침엽수종으로부터 다양한 형태의 옹이 이미지 1,172개를 획득하여 학습 및 검증에 사용하였다. SIFT+k-NN 모델의 경우, SIFT 기술을 이용하여 옹이 이미지에서 특성을 추출한 뒤, k-NN을 이용하여 분류를 진행하였으며, 최대 60.53%의 정확도로 분류가 가능하였다. 이 때 k-index는 17이었다. CNN 모델의 경우, 8층의 convolution layer와 3층의 hidden layer로 구성되어있는 모델을 사용하였으며, 정확도의 최대값은 1205 epoch에서 88.09%로 나타나 SIFT+k-NN 모델보다 높은 결과를 보였다. 또한 옹이의 종류별 이미지 개수 차이가 큰 경우, SIFT+k-NN 모델은 비율이 높은 옹이 종류로 편향되어 학습되는 결과를 보였지만, CNN 모델은 이미지 개수의 차이에도 편향이 심하지 않아 옹이 분류에 있어 더 좋은 성능을 보였다. 본 연구 결과를 통해 CNN 모델을 이용한 목재 옹이의 분류는 실용가능성에 있어 충분한 정확도를 보이는 것으로 판단된다.

1. 서 론

목재는 친환경적이고, 인체친화적인 재료로서 특유의 문양을 갖기 때문에 대중적 선호도가 높다. 또한, 목재는 지속가능발전 의 핵심 재료로 관심이 증가하고 있다. 이에 따라 목재를 용도에 맞게 효율적으로 이용하기 위한 객관적이고 정확한 품질 평가와 등급 구분 방법에 대한 필요성이 대두되고 있다. 목재는 일반적으로 제재목 상태로 유통되고 있기 때문에 제재목 표면에 존재하는 결점의 종류와 크기에 따라 품질이 크게 영향을 받는다. 제재목의 용도에 따라 평가하는 결점이 다를 수 있지만 일반적으로는 목재의 역학적 성능과 심미적 측면에 영향을 미치는 옹이, 할렬, 틀어짐 등에 의해 목재의 품질이 평가되고 있다(KS F 2151, 2014).

생장이나 가공 중에 발생한 결점은 다양한 형태로 존재하며, 특히 옹이의 경우, 종류에 따라 목재의 강도적 성능 평가에 영향을 미치기 때문에 정확한 품질 평가를 위해서는 재면에 나타나는 결점의 종류를 정확하게 구분할 수 있어야 한다. 지금까지 육안, 전자현미경 또는 근적외선 분광분석법 등의 방법으로 수종구분과 등급구분이 시도되고 있다(Eom and Park, 2018; Kim and Choi, 2016; Kwon et al., 2017; Lee et al., 2018; Mohan, 2012; Park et al., 2018; Park et al., 2017; Tong et al., 2017). 하지만, 육안등급구분 방법은 숙련된 평가사에 의해서 이루어지며, Lampinen et al. (1998)은 숙련된 평가사에 의해 육안등급구 분을 실시할 경우, 약 80%의 정확도로 구분이 가능하다고 보고하였다. 하지만 평가사의 주관적인 판단에 따라 목재의 품질 평가가 이루어지기 때문에 주관적 판단에 따라 오차가 발생할 수 있다는 단점이 있다. 따라서, 보다 객관적이고, 주변 환경에 영향을 적게 받는 등급 평가 방법의 개발이 필요하다.

머신 비전은 사람의 시각능력을 하드웨어와 소프트웨어의 시스템으로 모사하여 처리하는 기술로서, 주로 제품의 결함을 반복적으로 측정하는 자동화 제조공정에서 사용된다(Lampinen et al., 1998). 머신 비전 중 이미지를 분류하는데 이용하는 화상분석은 일반적으로 이미지에서 특징을 추출하고, 추출된 특징을 분석하여 분류한다. SIFT(Scale-Invariant Feature Transform)는 이미지에서 모퉁이 지점과 같은 특징점을 찾아내어 추출하는 알고리즘으로서, 회전이나 배율, 위치에 관계없이 특징을 추출할 수 있다(Putri, 2018). 머신 러닝 모델 중 직관적이며, 간단한 지도 학습 모델 중 하나인 k-NN(k-nearest neighbor) 은 새로운 데이터가 나타났을 때 기존 데이터세트에서 차원상으로 거리가 가장 가까운 k개의 데이터를 찾고, 이 데이터들 중 가장 높은 빈도로 나타나는 클래스를 새로운 데이터의 클래스로 배정하여 이미지를 분류한다(Mohan and Venkatachalapathy, 2012; Putri and Machbub, 2018). k-NN을 이용한 목재 표면의 옹이 분류가 연구된 바 있으며(Mohan and Venkatachalapathy, 2012), k-NN을 이용하여 목재 결함을 분류한 결과, 약 72%의 정확도로 분류가 가능하다고 제시된 바 있다(Tong et al., 2017). 또한 SIFT와 k-NN을 결합하여 목재 수종을 구분하는 연구가 이루어졌다(Hu et al., 2015). 하지만 SIFT와 k-NN이 결합된 구조를 옹이 분류에 이용한 연구는 부족한 실정이다.

인공지능 기술 중 하나인 딥러닝 기술을 활용한 화상분석은 기존 분류 방법에 비해 높은 성능을 보여주고 있다. 딥러닝을 이용한 물체 인식 시스템은 합성곱신경망(CNN; Convolutional Neural Network)을 활용하여 물체를 구분한다. CNN은 이미지 의 특징 추출과 분류를 동시에 수행하는 방법으로서 일정 크기의 커널(canal)을 통해 이미지로부터 특징을 추출한 뒤, 인공신경망 (ANN; Artificial Neural Network)을 이용하여 분류하는 방법이다(LeCun et al., 2015). CNN은 다수의 커널을 사용하여 이미지 의 특징을 다양하게 추출한 뒤 이를 1차원 벡터로 변환한 다음, 인공신경망을 통해 분류를 진행하는 구조로 이루어져 있다. CNN은 라벨화된 이미지로 특징 추출과 분류가 동시에 학습되기 때문에 목표 개체에 따라 적합한 특성을 추출하여 분류할 수 있다는 장점이 있다. 1차원 인공신경망을 이용하여 활엽수 등급을 구분하였을 때, 약 80%의 정확도로 활엽수 등급 구분이 가능하다고 보고된 바 있으며(Thomas, 2017), 2차원 합성곱신경망을 이용한 옹이 탐지에 관해 연구된 바 있다(Norlander et al., 2015). CNN은 현재 다양한 이미지 또는 스펙트럼으로부터 물체를 구분하는데 이용되고 있지만, 이를 목재에 적용한 연구는 부족한 실정이다. 따라서 본 연구에서는 SIFT+k-NN 모델과 CNN 모델을 통해 옹이의 종류를 자동으로 구분하는 모델을 구현하고 그 정확성을 분석해보고자 하였다.

2. 재료 및 방법
2.1. Image dataset

본 연구에 사용한 수종은 국내산 낙엽송(Larix kaempferi), 잣나무(Pinus koraiensis), 소나무(Pinus densiflora), 삼나무 (Cryptomeria japonica), 편백(Chamaecyparis obtusa)이다. 각 목재의 재면 화상을 촬영하였으며, 총 937개의 제재목 사진을 이용하여 학습 및 검증을 진행하였다. 재면 화상에서 옹이 부위를 구별(labelling)하기 위해 사용한 프로그램은 VGG Image Annotator(USA, Department of Engineering Science, University of Oxford)이다. 각 제재목의 재면에서 옹이를 4가지 클래스로 구별하였으며, 각 클래스는 KS F 2151에 따라 썩은 옹이(decayed knot), 죽은 옹이(encased knot), 산 옹이(sound knot), 긴 옹이(spike knot)로 구분하였다. 이후 재면 화상에서 옹이의 전체적인 형상이 드러나도록 사각형으로 옹이 이미지를 잘라내어 100 × 100 pixels 크기의 데이터로 크기를 조정하였으며, RGB 색공간 데이터를 가지는 옹이 이미지를 학습과 검증에 사용하였 다. 모델 학습에 사용하는 학습 세트(training set)와 학습도를 평가하기 위한 검증 세트(validation set)의 비율은 8:2로 분리하였 다. 학습에 사용한 옹이 이미지는 총 937장, 검증에 사용한 옹이 이미지는 총 235장이었다.

2.2. SIFT+k-NN 모델을 이용한 옹이 분류

SIFT+k-NN을 이용한 옹이 분류 모델의 구조는 Fig. 1과 같다. SIFT+k-NN은 화상 내 특징점을 추출하는 SIFT와 특징점을 기반으로 분류하는 k-NN을 결합시킨 구조이다. 이미지마다 이미지의 특징을 대표하는 특징점이 다수 존재하기 때문에 이들을 SIFT를 이용하여 추출하였다. 각 특징점들로부터 128차원의 벡터를 만들었으며, 특징점 벡터들을 k-NN에 입력하여 학습을 진행하였다. 학습 세트 이미지에서 추출한 특징점 벡터를 초기 데이터로 설정하였으며, 검증 세트 이미지에서 추출한 특징점을 분류하여 SIFT+k-NN 모델의 검증 정확도를 판단하였다. 검증 세트는 가장 가까운 k개의 데이터에서 가장 많은 빈도를 가지는 그룹으로 분류된다. 이 때, k-NN의 성능을 결정짓는 k index를 1, 3, 5, … , 23까지 변경하며 학습을 진행한 뒤 가장 검증 정확도가 높은 k index를 선정하였다.

SIFT에서 추출된 특징을 k-Means Clustering을 이용하여 군집화하였다. 각 점을 순회하며, 집합이 변하지 않을 때까지 새로운 무게중심 계산을 반복하여 가장 가까운 무게중심이 속하는 집합에 속하도록 군집화시킨 뒤, 주요한 군집을 분석하였다.

2.3. CNN 모델을 이용한 옹이 분류

본 연구에서 사용한 CNN 옹이 분류 모델의 구성은 Fig. 2와 같다. Input으로 입력되는 이미지의 크기는 100 × 100 pixels이며, RGB 색 공간 데이터를 가진 이미지를 사용하였다. 먼저 convolution layer를 통해 32 개의 특성 이미지로 만든 뒤, 50 × 50 pixels로 maxpooling 처리하였다. 이후 각 block 에서 두 번의 convolution과 maxpooling 과정을 추가로 진행하였으며, 각 픽셀당 128개의 특성을 가지는 6 × 6 pixels 크기의 특성 이미지로 추출하였다. 특성이 추출된 이미지는 최종적으로 full connection을 통해 4,608의 크기를 가진 1차원 벡터로 변환된 후, 256, 128, 128개의 node를 가지는 hidden layer에 통과시켜 옹이 분류가 이루어지도록 구성하였다. 이 때, 모델의 overfitting을 방지하기 위한 regulation 방법으로 dropout을 사용하였다.

3. 결과 및 고찰
3.1. SIFT+k-NN 모델을 이용한 옹이 분류 결과

SIFT+k-NN 모델을 이용한 옹이 분류 결과는 Fig. 3과 같다. k index가 많아짐에 따라 훈련용 데이터(Train)의 정확도는 낮아지며, 검증용 데이터(Test)의 정확도는 증가 후 감소하는 경향을 보였다. 검증 정확도 k index가 17일 때 가장 높은 검증 정확도를 보였으며 이 때의 confusion matrix는 Table 1과 같다. 모델의 평균 정확도는 약 69.36 %로 옹이 분류가 가능하였다. 가장 낮은 정확도를 보인 옹이 형태는 spike knot이었으며, 이는 spike knot의 이미지 수가 적어 spike knot에서 추출한 특징점이 다양하게 확보되지 않았기 때문으로 추정된다. 또한 sound knot의 이미지가 다른 옹이 이미지 보다 많이 확보되었기 때문에 sound knot 분류 정확도가 다른 옹이 형태보다 높게 나타났으며 다른 옹이 형태가 sound knot으로 분류되는 경우가 많았다. 따라서 SIFT+k-NN 모델을 이용하여 옹이를 분류할 경우, 모든 형태의 옹이 이미지가 균등하게 확보되지 않으면 그 정확도가 낮을 것으로 판단된다.

k-Means Clustering을 이용하여 주요한 특징점을 분석한 결과, 군집의 개수가 8개일 경우의 주요 특징점은 Fig. 4 (a)와 같다. 옹이 종류에 따라 특징점 분포의 차이가 발생하였으며, 클러스터 1에서는 어둡게 썩은 부위에서 추출된 특징점들이 분포하였으며, 클러스터 3에서는 조재 부위, 클러스터 5에서는 만재와 수피 부위에서 추출된 특징점들이 분포하였다. Fig. 4 (b)는 클러스터 5에 분포하는 특징점들을 옹이 이미지에 표시한 그림이다. Cluster 5로 분류된 특징점들은 주로 spike knot에 많이 분포하였으며, spike knot 이미지 내에서 옹이 부위가 아닌 재면의 연륜이 특성으로 추출되었다. 이에 따라 옹이를 사각형이 아닌 다각형 형태로 데이터 셋을 구성하여 분류를 진행한다면 더 높은 정확도를 보일 것이라 기대된다.

3.2. CNN을 이용한 옹이 분류 결과

CNN 학습 횟수(epoch)에 따른 CNN 모델의 정확도는 Fig. 5와 같다. CNN 학습 결과, 총 1205 epoch에서 가장 높은 정확도를 보였으며 이 때 88.09 %의 검증 정확도를 보였다. 1205 epoch 에서 학습세트의 정확도는 97.23%로 학습하는 이미지에 과적합되 지 않은 것으로 판단하였다. 이 때의 confusion matrix는 Table 2와 같다. CNN 모델의 경우, SIFT+k-NN 모델보다 sound knot으로 편향되어 분류되는 현상이 감소하였으며, 균일한 개수의 이미지를 확보하지 않은 경우에도 CNN을 이용한 분류는 높은 정확도로 예측이 가능하였다. 하지만 CNN을 이용한 옹이 분류에서 encased knot와 sound knot을 정확하게 분류하지 못하는 경우가 일부 발생하였다. 예측에 실패한 이미지들의 경우, Fig. 6과 같이 건전 부위와 죽은 부위가 같이 있는 경우가 많았다. 실제로 죽은 부위가 옹이의 40 ~ 60%를 차지하는 경우, encased knot과 sound knot을 정확히 분류하기 힘들다. 본 연구에서 학습시킨 CNN 모델은 이와 같은 경우를 정확히 학습시킬 수 있는 수의 이미지를 확보하지 못하였기 때문에 encased knot과 sound knot가 정확히 분류되지 않는 경우가 발생한 것으로 추정된다. 본 연구에서 개발한 CNN 옹이 분류 모델은 수피가 존재하지 않는 옹이의 이미지에 높은 정확성을 보이며 분류가 가능하였으며, 더 많은 옹이 데이터를 학습에 이용한다면 매우 높은 정확도로 객관적인 옹이 분류가 가능할 것으로 기대된다.

4. 결 론

본 연구에서는 SIFT+k-NN 모델과 CNN 모델을 통해 옹이의 종류를 자동으로 구분하는 모델을 구현하고 그 정확성을 비교해 보고자 하였다. 다섯 가지 국산 침엽수종으로부터 다양한 형태의 옹이 이미지 1,172개를 획득하여 학습 및 검증에 사용하였다. SIFT+k-NN의 경우, 최대 69.4 %의 정확도를 보였으며, 옹이 이미지 개수의 편향으로 인해 다른 종류의 옹이 이미지가 가장 많은 비율을 차지하는 sound knot으로 분류되는 현상이 발생하였다. CNN 모델을 이용한 옹이 분류의 경우, 검증결과 최대 88.1 %의 정확도로 SIFT+k-NN 모델보다 높은 정확도를 보였다. 또한 종류별로 균일한 개수의 옹이 이미지를 학습시키지 않았음에도 옹이 분류가 편향적으로 이루어지는 현상이 발생하지 않았다. 따라서 본 연구에서 개발한 CNN 옹이 분류 모델은 SIFT+k-NN보다 높은 정확도로 예측이 가능하였다. 이를 통해 화상 또는 스펙트럼 기반 CNN 모델을 이용한 목재 옹이의 분류는 실용화 되기에 충분한 정확도를 보이는 것으로 판단된다.

References

1.

Eom Y., Park B. Wood Species Identification of Documentary Woodblocks of Songok Clan of the Milseong Park, Gyeongju, Korea. Journal of the Korean Wood Science and Technology. 2018; 46(3):270-277.

2.

Hu S., Li K., Bao X. Wood species recognition based on SIFT keypoint histogram, Image and Signal Processing (CISP). 2015; In: 2015 8th International Congress on IEEE p. 702-706.

3.

Kim S.C., Choi J. Study on Wood Species Identification for Daeungjeon Hall of Jeonghyesa Temple, Suncheon. Journal of the Korean Wood Science and Technology. 2016; 44(6):897-902.

4.

Kwon O., Lee H.G., Lee M.R., Jang S., Yang S.Y., Park S.Y., Choi I., Yeo H. Automatic Wood Species Identification of Korean Softwood Based on Convolutional Neural Networks. Journal of the Korean Wood Science and Technology. 2017; 45(6):797-808.

5.

KS F 2151 Visual grading for softwood structural lumber. 2014Korean Agency for Technology and Standard

6.

Lampinen J., Smolander S., Korhonen M. Wood surface inspection system based on generic visual features. Industrial Applications of Neural Networks. 1998; :35-42.

7.

LeCun Y., Bengio Y., Hinton G. Deep learning. Nature. 2015; 521:436.

8.

Lee K., Seo J., Han G. Dating Wooden Artifacts Excavated at Imdang-dong Site, Gyeongsan, Korea and Interpreting the Paleoenvironment according to the Wood Identification. Journal of the Korean Wood Science and Technology. 2018; 46(3):241-252.

9.

Mohan S., Venkatachalapathy K. Wood knot classification using bagging. International Journal of Computer Applications. 2012; 51(18).

10.

Norlander R., Grahn J., Maki A. Wooden knot detection using convnet transfer learning. 2015; In: In Scandinavian Conference on Image Analysis p. 263-274.

11.

Park J.H., Oh J.E., Hwang I.S., Jang H.U., Choi J.W., Kim S.C. Study on Species Identification for Pungnammun Gate (Treasure 308) in Jeonju, Korea. Journal of the Korean Wood Science and Technology. 2018; 46(3):278-284.

12.

Park S.Y., Kim J.C., Kim J.H., Yang S.Y., Kwon O., Yeo H., Cho K., Choi I.G. Possibility of Wood Classification in Korean Softwood Species Using Near-infrared Spectroscopy Based on Their Chemical Compositions. Journal of the Korean Wood Science and Technology. 2017; 45(2):202-212.

13.

Putri D.I.H., Machbub C. Object detection and tracking using SIFT-KNN classifier and Yaw-Pitch servo motor control on humanoid robot. 2018; In: In Signals and Systems (ICSigSys), 2018 International Conference on IEEE p. 47-52.

14.

Thomas E. An artificial neural network for real-time hardwood lumber grading. Computers and Electronics in Agriculture. 2017; 132:71-75.

15.

Tong H.L., Ng H., Yap T.V.T., Ahmad W.S.H.M.W., Fauzi M.F.A. Evaluation of feature extraction and selection techniques for the classification of wood defect images. Journal of Engineering and Applied Science. 2017; 12(3):602-608.