A Fast Instance Segmentation Technique for Log End Faces Based on Metric Learning
Authors: Li Hui , Liu Jinhao , Wang Dian 
Published: April 2023

The diameter of the logs on a vehicle is a critical part of the logistics and transportation of logs. However, the manual size-checking method is inefficient and affects the efficiency of log transportation. The example segmentation methods can generate masks for each log end face, which helps automate the check gauge of logs and improve efficiency. The example segmentation model uses rectangle detection to identify each end face and then traverses the rectangular boxes for mask extraction. The traversal of rectangular boxes increases the time consumption of the model and lacks separate handling of the overlapping areas between rectangular boxes, which causes a decline in mask extraction accuracy. To address the above problems, we propose a fast instance segmentation method for further improving the efficiency and accuracy of log-checking diameter. The method uses a convolutional neural network to extract the mask image, rectangular frame prediction image, and embed the vector image from the input image. The mask image is used to extract the log end face region, and the rectangular frame prediction image generates an enveloping rectangular frame for each log, which in turn divides the log end face region into instances. For the overlapping regions of rectangular boxes, a metric learning paradigm is used to increase the embedding vector distance between pixels located in different logs and decrease the embedding vector distance between pixels of the same log, and finally the mask pixels of the overlapping regions of rectangular boxes are instantiated according to the pixel embedding vectors. This method avoids repeated calls to the contour extraction algorithm for each rectangular box and enables fine delineation of pixels in the overlapping rectangular box region. To verify the efficiency of the proposed algorithm, the log working pile is photographed in different scenes using a smartphone to obtain the end face recognition database and divide the training set, validation set, and test set according to 8:1:1. Secondly, the proposed model is used to obtain log end face masks, and the log end face ruler diameter is determined by an edge-fitting algorithm combined with a ruler. Finally, the practicality of the algorithm is evaluated by calculating the check-rule diameter error, running speed, and the error of wood volume calculation under different national standards. The proposed method has 91.2% and 50.2 FPS of mask extraction accuracy and running speed, respectively, which are faster and more accurate than the mainstream instance segmentation model. The relative error of the proposed method is −4.62% for the check-rule diameter and −4.25%, −5.02%, −6.32%, and −5.73% for the wood volume measurement under the Chinese, Russian, American, and Japanese raw wood volume calculation standards, respectively. Among them, the error of the calculated timber volume according to our standard is the smallest, which indicates that the model in this paper is more suitable for application in domestic log production operations.