CN116481429A - Log volume detection method based on target detection - Google Patents

Log volume detection method based on target detection Download PDF

Info

Publication number
CN116481429A
CN116481429A CN202310455439.2A CN202310455439A CN116481429A CN 116481429 A CN116481429 A CN 116481429A CN 202310455439 A CN202310455439 A CN 202310455439A CN 116481429 A CN116481429 A CN 116481429A
Authority
CN
China
Prior art keywords
face
image
log
circle
small
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202310455439.2A
Other languages
Chinese (zh)
Inventor
华蓓
黄汝维
黄镜润
刘阳
庞彤
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangxi University
Original Assignee
Guangxi University
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Guangxi University filed Critical Guangxi University
Priority to CN202310455439.2A priority Critical patent/CN116481429A/en
Publication of CN116481429A publication Critical patent/CN116481429A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G01MEASURING; TESTING
    • G01BMEASURING LENGTH, THICKNESS OR SIMILAR LINEAR DIMENSIONS; MEASURING ANGLES; MEASURING AREAS; MEASURING IRREGULARITIES OF SURFACES OR CONTOURS
    • G01B11/00Measuring arrangements characterised by the use of optical techniques
    • GPHYSICS
    • G01MEASURING; TESTING
    • G01BMEASURING LENGTH, THICKNESS OR SIMILAR LINEAR DIMENSIONS; MEASURING ANGLES; MEASURING AREAS; MEASURING IRREGULARITIES OF SURFACES OR CONTOURS
    • G01B11/00Measuring arrangements characterised by the use of optical techniques
    • G01B11/02Measuring arrangements characterised by the use of optical techniques for measuring length, width or thickness
    • G01B11/03Measuring arrangements characterised by the use of optical techniques for measuring length, width or thickness by measuring coordinates of points
    • GPHYSICS
    • G01MEASURING; TESTING
    • G01BMEASURING LENGTH, THICKNESS OR SIMILAR LINEAR DIMENSIONS; MEASURING ANGLES; MEASURING AREAS; MEASURING IRREGULARITIES OF SURFACES OR CONTOURS
    • G01B11/00Measuring arrangements characterised by the use of optical techniques
    • G01B11/08Measuring arrangements characterised by the use of optical techniques for measuring diameters
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/0464Convolutional networks [CNN, ConvNet]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/70Denoising; Smoothing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/13Edge detection
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/187Segmentation; Edge detection involving region growing; involving region merging; involving connected component labelling
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/194Segmentation; Edge detection involving foreground-background segmentation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/60Analysis of geometric attributes
    • G06T7/62Analysis of geometric attributes of area, perimeter, diameter or volume
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20081Training; Learning
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20084Artificial neural networks [ANN]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20112Image segmentation details
    • G06T2207/20132Image cropping
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20112Image segmentation details
    • G06T2207/20152Watershed segmentation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/30Subject of image; Context of image processing
    • G06T2207/30204Marker
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Biophysics (AREA)
  • Data Mining & Analysis (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Artificial Intelligence (AREA)
  • Biomedical Technology (AREA)
  • Software Systems (AREA)
  • Computational Linguistics (AREA)
  • Health & Medical Sciences (AREA)
  • Evolutionary Computation (AREA)
  • General Health & Medical Sciences (AREA)
  • Molecular Biology (AREA)
  • Computing Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Mathematical Physics (AREA)
  • Geometry (AREA)
  • Image Analysis (AREA)

Abstract

The invention discloses a log volume detection method based on target detection, which comprises the following steps: 1) Collecting log end face images, manufacturing a data set, and training by using a target detection model to obtain a trained target detection model; 2) Detecting the log end face images to be detected by using a trained target detection model, cutting and storing each detected end face circle image to obtain a plurality of small-size end face circle images; 3) Performing interference reduction treatment on the image obtained in the step 2); 4) Performing edge detection on the image obtained in the step 3); 5) Detecting the image obtained in the step 4) by using a circle detection method, and extracting the center coordinates and the radius of an end face circle in each edge detection result diagram; 6) Writing calculation codes according to a log volume calculation formula, substituting the radius of each end face circle into calculation, and inputting the length and diameter of the gauge to obtain the wood timber. The method has the advantages of low cost, high calculation speed and high precision.

Description

Log volume detection method based on target detection
Technical Field
The invention relates to the technical field of wood volume metering, in particular to a log volume detection method based on target detection.
Background
At present, the calculation of wood volume in China mainly depends on manual measurement or large-scale machine measurement. In manual measurement, measurement personnel are required to master the special volume measurement knowledge, and the measurement method has the problems of low accuracy, high randomness and the like, and human errors are easy to generate. In machine measurement, because of the knowledge related to hardware equipment use, signal calibration and the like, a measurer needs to master the operation method and related knowledge of complex professional instruments; on the other hand, the machine measurement also has the problems of excessively heavy machine, inconvenient carrying and the like.
With the development of computer vision, many students and experts try to solve the problems by using computer vision technology, and mainly measure the end face of the log by using hough transform circle detection method, spectrum imaging technology, ellipse detection method, K-means clustering and other methods, but these all require that the end face of the log has large difference from background, clear boundary, clear end face circle pattern and the like, and are difficult to measure successfully under the conditions of chiseled end face circle pattern and other stains, blurred boundary, shadow shielding, different end face circle size and the like. For example, the invention patent with publication number of CN114034243A proposes to use computer vision in combination with a laser scanning system to realize automatic measurement of wood volume, but the invention requires hardware to perform laser scanning, and has higher cost and hardware requirements. Lin Yaohai et al devised an isometric wood volume detection system combining deep learning and Hough conversion (Lin Yaohai, zhao Honglu, yang Zeshan, lin Mengting. An isometric wood volume detection system combining deep learning and Hough conversion, 2021,6 (1): 136-142), but the method was limited by factors such as the cleanliness of the end face dome Jing Wenlu, the size of the circle, etc., and the detection of the end face circle was established on a noise cancellation radius parameter R that requires manual measurement and estimation, and it was difficult to detect success for circles of different sizes in the same batch of log piles. The invention patent with publication number of CN111899296A discloses a log volume detection method based on computer vision, which realizes the function of photographing and identifying the log volume by using an image processing technology and a computer vision technology and obtains the volume detection result through a series of image processing and detection operations. However, when the end face circle picture is replaced or the gray level of the same end face circle image is changed, the parameters of the Hough transformation circle detection function are required to be readjusted, and log volume measurement operation is complex.
These methods, while combined with target detection or computer vision, either have limitations on instrumentation, cost, log end face size, background and end face cleanliness; or the measurement of the volume of the end face circle with a certain difference in size cannot be realized, and the measurement of the volume of various piles in real life at low cost is difficult.
Disclosure of Invention
The invention aims to solve the technical problem of providing a log volume detection method based on target detection, which has the advantages of low cost, high log volume calculation speed and high calculation precision.
In order to solve the technical problems, the invention adopts the following technical scheme:
the log volume detection method based on target detection comprises the following steps:
1) Collecting log end face images, manufacturing a data set, and training by using a target detection model to obtain a trained target detection model;
2) Detecting the log end face image to be detected by using a trained target detection model, cutting and storing each detected end face circle to obtain a plurality of small-size end face circle images;
3) Performing interference reduction treatment on each obtained small-size end face circle image to obtain a small-size end face circle image with reduced interference;
4) Performing edge detection on the obtained small-size end face circle images with reduced interference to obtain an edge detection result graph of the small-size end face circle;
5) Detecting the obtained edge detection result graphs of the small-size end face circles by using a circle detection method, and extracting the center coordinates and the radius of the end face circles in the edge detection result graphs;
6) And writing a calculation code according to a log volume calculation formula, substituting the radius of each obtained end face circle into calculation, and inputting the length of a gauge and the gauge diameter of a certain selected target small-size end face circle image to obtain the volume of the log in the log end face image to be detected.
In step 1) of the detection method of the present invention, the target detection model may be a conventional target detection convolutional neural network in the prior art, such as an SSD convolutional neural network, a YOLOv3 convolutional neural network, a YOLOv5s convolutional neural network, or a YOLOv8 convolutional neural network. The trained target detection model obtained correspondingly is a trained SSD model, a trained YOLOv3 model, a trained YOLOv5s model or a trained YOLOv8 model. The method for realizing the step 1) comprises the following steps:
1.1 Collecting log end face images, marking the log end face images, and obtaining a marked data set;
the log end face images may be collected by conventional techniques such as downloading a large number of log end face images using python-based crawler technology in a mainstream search engine of hundred degrees, must, etc., or capturing a desired number of log end face images by photographing various stacks of logs piled in a forest farm, or both. In general, a wide variety of collected log end face images need to be screened to remove excessively dark, blurred, non-end face circular images, leaving behind a front-shot, clear log end face image. The collected log end face image can also comprise more extreme image data besides the log end face circle image with clear end faces and simple background, such as log end face circle images with extremely many and few end face circles, dense and sparse conditions, complex background and the like. And marking the collected log end face image by adopting the conventional method, for example, marking the log end face circular image by using LabelImg, so as to obtain a marked data set.
1.2 Expanding the marked data set by adopting a data enhancement mode to obtain a data set with enhanced data;
in the application, 8 data enhancement modes of inversion transformation, random pruning, color dithering, translation transformation, scale transformation, contrast transformation, noise disturbance and rotation transformation are preferably adopted to expand the marked data set so as to obtain the data set with enhanced data.
1.3 Dividing the data set after data enhancement into a training set, a verification set and a test set to obtain a data set participating in model training;
the allocation proportion of the training set, the verification set and the test set can be set according to the requirement, and the allocation proportion is 7:2:1, and obtaining the data set participating in model training after adjusting the data set structure format.
1.4 Inputting the data set participating in model training into a target detection convolutional neural network, adjusting parameters, and outputting an optimal weight file through training of iterative preset times to obtain a trained target detection model;
the preset times are positive integers and can be freely adjusted according to practical conditions such as training conditions, and the preset times are preferably set to be 100 times in the application.
In the detection method of the invention, the method for realizing the step 2) is as follows:
2.1 Inputting an end face image of the log to be detected, detecting the end face image by using a trained target detection model to obtain a target detection result image of the end face image of the log to be detected and recording txt files of the positions of the target frames of the end face circles in the obtained target detection result image;
2.2 According to the coordinate position in txt file, traversing and cutting each end face circle bbox target frame from the log end face image to be detected, and obtaining a plurality of small-size end face circle images only displaying a single end face circle.
In step 3) of the detection method of the present invention, the interference of the small-size end face circle image can be eliminated or reduced by adopting the existing conventional method to obtain the small-size end face circle image with reduced interference, preferably, the method adopts a watershed algorithm based on distance transformation to perform interference reduction treatment on each small-size end face circle image, and the specific implementation method includes:
3.1 Gray-scale and then binarize the small-size end face circle image to obtain a binarized image;
3.2 Using an open operation to remove noise from the image obtained in step 3.1);
3.3 Determining a background area in the image obtained in the step 3.2), and determining a foreground area through distance transformation;
3.4 Determining an unknown region in the image obtained in the step 3.3), and marking the unknown region;
3.5 Marking the largest connected domain in the image obtained in the step 3.4);
3.6 Processing the image obtained in the step 3.5) by using a watershed algorithm, and modifying the boundary to be-1;
3.7 Color filling is carried out on the image obtained in the step 3.6), and the image is output, so that a small-size end face circle image with reduced interference is obtained.
In step 4) of the detection method of the present invention, the Canny edge detection algorithm is preferably used to perform edge detection on each obtained small-size end face circle image with reduced interference.
In step 5) of the detection method, the Hough circle detection method is preferably adopted to detect the edge detection result diagram of each small-size end face circle, and the specific implementation method comprises the following steps:
5.1 Graying the obtained edge detection result graph of the small-size end face circle;
5.2 Using a cv2. Houghcircuits function in OpenCv, detecting the image obtained in the step 5.1) after adjusting parameters, and extracting to obtain the center coordinates and the radius of each end face circle. And generating a circle detection result graph of each end face circle according to the extracted center coordinates and the radius.
In step 6) of the detection method according to the invention, the calculation code is usually written according to the log volume calculation formula given in GB/T4814-2013 log volume Table. The small-size end face circle image of the target in the step is automatically selected, specifically, the end face circle with the lowest coordinate position is selected according to the txt file of the target frame position of each end face circle in the target detection result image obtained in the step 2.1), so that manual measurement is facilitated, and the situation that the system randomly selects the highest end face circle and manual measurement is difficult is avoided.
Compared with the prior art, the detection method combines artificial intelligence and computer vision, and can calculate the log volume by using the image without the traditional manual one-by-one measurement method, thereby greatly improving the calculation speed of the log volume; in addition, the invention does not need to be equipped with redundant high-price hardware equipment such as a laser scanning system, a plurality of linear array scanning cameras and the like, and only needs one conventional notebook computer, so that the hardware cost is effectively reduced, and meanwhile, the manual operation required by the invention is limited to three simple operations of uploading pictures and inputting corresponding gauge diameters and gauge lengths by contrast pictures, so that the measurement threshold is greatly reduced.
Drawings
Fig. 1 is a basic structure diagram of a log volume detecting method based on target detection according to the present invention.
Fig. 2 is a flow chart of a log volume detection method based on target detection according to the present invention.
Figure 3 is an original image of an end face image of a log to be inspected in an embodiment of the present invention.
Fig. 4 is a diagram of a target detection result of an image of an end face of a log to be detected in an embodiment of the present invention.
Fig. 5 is a txt file diagram of the positions of the target frames of the end face circles in the target detection result diagram of the log end face image to be detected in the embodiment of the present invention.
Fig. 6 is a small-sized end circle image of reduced interference in an embodiment of the invention.
Fig. 7 is a diagram showing the edge detection result of a small-sized end face circle according to an embodiment of the present invention.
Fig. 8 is a circle detection result diagram generated according to the extracted center coordinates and radius after the center coordinates and radius are extracted from the edge detection result diagram of the small-sized end face circle in the embodiment of the present invention.
Fig. 9 is a diagram showing a calculation result of a log volume in an image of a log end face to be detected in an embodiment of the present invention.
Detailed Description
In order to better explain the technical scheme of the invention, the invention is described in further detail below with reference to the accompanying drawings, but the embodiment of the invention is not limited thereto.
The log volume detection method based on target detection combines artificial intelligence and computer vision, divides the scheme of the log volume detection method into three modules of image processing, circle detection and volume calculation, and the scheme basic structure diagram is shown in figure 1.
The image data of the image processing module is provided by a user during interaction, and the module comprises four sub-modules of YOLOv8 target detection, image clipping, a watershed algorithm based on distance transformation and Canny edge detection, wherein the watershed algorithm based on the distance transformation further comprises five steps of image graying and binarization, noise removal through open operation, background area and foreground area determination, unknown area determination and marking, maximum connected area marking, watershed algorithm processing and color filling. The image processing module aims to accurately position each end face circle, reduce image noise, outline clear end face circle edges and lay a foundation for accurately acquiring end face circle information by the circle detection module.
The circle detection module uses Hough transformation circle detection, and the data acquisition of the volume calculation module is performed in a man-machine interaction mode.
The flow chart of the log volume detection method based on target detection is shown in figure 2. Firstly inputting an end face image of a log to be detected, then detecting the end face image of the log to be detected by using a trained YOLOv8 model, cutting each detected end face circle image, and storing each small-size end face circle image; each small-size end face circle image is subjected to distance transformation-based watershed algorithm processing and interference reduction including image graying and binarization, open operation noise removal, background area and foreground area determination, unknown area determination and marking, maximum connected domain marking, watershed algorithm and color filling, then the image processed by the distance transformation-based watershed algorithm is detected by using a Canny edge detection algorithm, and then circle center coordinates and radius of the corresponding small-size end face circle image are further detected and obtained by using a Hough transformation circle detection method. Then, the detection rule diameter and detection rule length of the selected target small-size end face circle image are manually input and substituted into a formula in national standard GB/T4814-2013 log volume table to calculate and obtain the final volume of the log pile in the log end face image to be detected. The method specifically comprises the following steps:
1) Collecting log end face images, manufacturing a data set, and training by utilizing a YOLOv8 convolutional neural network to obtain a trained YOLOv8 model; the specific implementation method is as follows:
1.1 Collecting log end face images, labeling the log end face images, and obtaining a labeled data set.
A python-based crawler technology is used for downloading a large number of log end face images in a mainstream search engine of hundred degrees, must and the like, shooting is carried out on multiple log piles of pine, eucalyptus, miscellaneous wood and the like in a plurality of forest fields of Anyama county in both Guiport municipalities and pond municipalities of Guangxi Zhuang, and meanwhile, various collected log end face images are screened, and the images with too dark light, fuzzy and non-end face circles are removed, so that the front shot and clear log end face images are left. The finally collected log end face image comprises a log end face circle image with clear end face and simple background, and further comprises extreme image data, such as images of extremely many and few end face circles, dense and sparse end face circles, similar circular and irregular end face circle shapes, whether the end face circles have cutting marks and shadows, extremely large and extremely small end face circles, irregular background such as large-piece wood piles doped with background, extremely simple background and the like, so that the robustness and generalization capability of the YOLOv8 model are improved, and the model can be more suitable for actual complex situations. And labeling the finally collected log end face image by using LabelImg, and making a data set, namely the labeled data set.
1.2 For further improving the robustness and generalization capability of the YOLOv8 model, 8 data enhancement modes of inversion transformation, random pruning, color dithering, translation transformation, scale transformation, contrast transformation, noise disturbance and rotation transformation are used for expanding the marked data set, so that the aim of simulating shooting environments with different darkness, different strong exposure degrees and the like is fulfilled, and the data set with the enhanced data is obtained.
1.3 Data-enhanced data set as per 7:2: the proportion of 1 is divided into a training set, a verification set and a test set, and the catalog structures of the training set, the verification set and the test set are adjusted at the same time to obtain a data set participating in model training.
1.4 Inputting the data set participating in model training into a YOLOv8 convolutional neural network, adjusting parameters such as category and the like, iterating 100 times for training, and outputting an optimal weight file to obtain a trained YOLOv8 model.
2) Detecting the log end face images to be detected by using a trained YOLOv8 model, cutting and storing each detected end face circle image to obtain a plurality of small-size end face circle images; the specific implementation method is as follows:
2.1 Inputting an image of the end face of the log to be detected (shown in fig. 3), detecting the image by using a trained YOLOv8 model to obtain a target detection result diagram of the image of the end face of the log to be detected (shown in fig. 4), and recording txt files (shown in fig. 5) of the positions of target frames of the end face circles in the obtained target detection result diagram.
2.2 According to the coordinate position in txt file, traversing and cutting each end face circle bbox target frame from the log end face image to be detected, and obtaining a plurality of small-size end face circle images only displaying a single end face circle.
The design thought of the invention does not need to manually input a radius parameter R which is difficult to estimate and search and is used for eliminating noise, but the target end face circles with different sizes are preprocessed one by a method of changing pictures into small pictures, so that the preprocessing of images can be more targeted, and the troublesome degree of measurement is greatly reduced.
3) The watershed algorithm based on distance transformation is used for carrying out interference reduction treatment on the obtained small-size end face circle images, so that the small-size end face circle images with reduced interference are obtained; the specific implementation method is as follows:
3.1 Gray-scale and then binarize the small-size end face circle image to obtain a binarized image;
3.2 Using an open operation to remove noise from the image obtained in step 3.1);
3.3 Determining a background area in the image obtained in the step 3.2), and determining a foreground area through distance transformation;
3.4 Determining an unknown region in the image obtained in the step 3.3), and marking the unknown region;
3.5 Marking the largest connected domain in the image obtained in the step 3.4);
3.6 Processing the image obtained in the step 3.5) by using a watershed algorithm, and modifying the boundary to be-1;
3.7 Color filling is carried out on the image obtained in the step 3.6), and the image is output, so that a small-size end face circle image with reduced interference is obtained. One of the reduced interference small end circle images is shown in fig. 6.
4) And performing edge detection on the obtained small-size end face circle images with reduced interference by using a Canny edge detection algorithm to obtain an edge detection result graph of the small-size end face circle. Through the 3 steps, the image noise of the end face circle is greatly reduced, and disturbance information such as stump marks and decayed stains which are not measured in the end face circle is greatly eliminated (under the condition that the noise elimination radius R of the end face circle with the same size can only be processed without manually searching for the noise elimination radius R with extremely poor input flexibility). At the moment, the Canny edge detection algorithm is used, so that the extraction of the complete outline of the edge of the end face circle can be finally realized, and the interference of noise such as complex lines of the end face circle and the like on the extraction of the edge can be furthest reduced, thereby furthest avoiding the interference of end face circle noise without measurement significance in Hough transformation circle detection of the end face circle in the next step. The result diagram showing the result of processing one of the small-size end face circle images with reduced interference by the Canny edge detection algorithm is shown in fig. 7.
5) Detecting the obtained edge detection result graphs of the small-size end face circles by using a Hough circle detection method, and extracting the center coordinates and the radius of the end face circles in the edge detection result graphs; the specific implementation method is as follows:
5.1 Graying the obtained edge detection result graph of the small-size end face circle;
5.2 Using a cv2. Houghcircuits function in OpenCv, detecting the image obtained in the step 5.1) after adjusting parameters, and extracting to obtain the center coordinates and the radius of each end face circle. And generating a circle detection result graph of each end face circle according to the extracted center coordinates and the radius.
Aiming at the situation that the least square method is used for fitting ellipse to easily produce error fitting to non-elliptical outline in the feature detection of end face circle-like circles and the influence of interference points is larger; and the detection of using the original Hough transform circle is easy to be limited by parameters, and can cause the conditions that a plurality of images cannot detect the circle or detect a plurality of circles and return the interference result of the radius information of a plurality of non-target circles due to the reasons of size difference of each image, etc., the invention uses the following design ideas to solve the interference of the conditions: in the step 1) and the step 2), only one circle can be locked on a small-size image, so that the circle is the largest target main body in the image according to the target detection principle, and the background noise interference is greatly reduced; at the moment, the image noise such as the dirt formed by the internal cutting mark and decay of the end face circle is greatly reduced through the steps of image graying and binarization, opening operation to remove noise, determining a background area and a foreground area, determining and marking an unknown area, a watershed algorithm, color filling and the like, so that the information of a plurality of circles returned by a single image can be ordered according to the radius, and the information of the largest circle in the small-size image is only recorded, so that the target main circle in the image can be detected, and the interference information of a plurality of small circles which are easily detected by the Hough transformation circle principle due to small part of noise in the image can be eliminated. And after the circle center coordinates and the radius are extracted from the edge detection result diagram of the small-size end face circle, a circle detection result diagram generated according to the extracted circle center coordinates and the radius is shown in fig. 8.
6) Writing calculation codes according to a log volume calculation formula given in GB/T4814-2013 log volume table, substituting the radius of each end face circle into calculation, manually inputting the length of a gauge and the gauge diameter of a selected target small-size end face circle image to obtain the volume of the log in the log end face image to be detected, as shown in figure 9. The small-size end face circle image of the target in the step is set to be the end face circle with the lowest coordinate position selected according to the txt file of the target frame position of each end face circle in the target detection result image obtained in the step 2.1), so that manual measurement is facilitated, and the condition that the system randomly selects the highest end face circle and manual measurement is difficult is avoided.

Claims (10)

1. The log volume detection method based on target detection comprises the following steps:
1) Collecting log end face images, manufacturing a data set, and training by using a target detection model to obtain a trained target detection model;
2) Detecting the log end face images to be detected by using a trained target detection model, cutting and storing each detected end face circle image to obtain a plurality of small-size end face circle images;
3) Performing interference reduction treatment on each obtained small-size end face circle image to obtain a small-size end face circle image with reduced interference;
4) Performing edge detection on the obtained small-size end face circle images with reduced interference to obtain an edge detection result graph of the small-size end face circle;
5) Detecting the obtained edge detection result graphs of the small-size end face circles by using a circle detection method, and extracting the center coordinates and the radius of the end face circles in the edge detection result graphs;
6) And writing a calculation code according to a log volume calculation formula, substituting the radius of each obtained end face circle into calculation, and inputting the length of a gauge and the gauge diameter of a certain selected target small-size end face circle image to obtain the volume of the log in the log end face image to be detected.
2. The target detection-based log volume detection method according to claim 1, characterized in that the method implementing step 1) comprises:
1.1 Collecting log end face images, marking the log end face images, and obtaining a marked data set;
1.2 Expanding the marked data set by adopting a data enhancement mode to obtain a data set with enhanced data;
1.3 Dividing the data set after data enhancement into a training set, a verification set and a test set to obtain a data set participating in model training;
1.4 Inputting the data set participating in model training into a target detection convolutional neural network, adjusting parameters, and outputting an optimal weight file through training of iterative preset times to obtain a trained target detection model.
3. The log volume detection method based on target detection according to claim 2, wherein in step 1.2), the labeled dataset is expanded by using 8 data enhancement modes of inversion transformation, random clipping, color dithering, translation transformation, scale transformation, contrast transformation, noise disturbance and rotation transformation.
4. The target detection-based log volume detection method according to claim 1, characterized in that the method implementing step 2) comprises:
2.1 Inputting an end face image of the log to be detected, detecting the end face image by using trained target detection to obtain a target detection result image of the end face image of the log to be detected and recording txt files of the positions of the round end face target frames in the obtained target detection result image;
2.2 According to the coordinate position in txt file, traversing and cutting each end face circle bbox target frame from the log end face image to be detected, and obtaining a plurality of small-size end face circle images only displaying a single end face circle.
5. The method for detecting the volume of the raw wood based on the target detection according to claim 1, wherein in the step 3), interference reduction processing is performed on each small-size end face circle image by adopting a watershed algorithm based on distance transformation.
6. The target detection-based log volume detection method according to claim 5, wherein the method implementing step 3) includes:
3.1 Gray-scale and then binarize the small-size end face circle image to obtain a binarized image;
3.2 Using an open operation to remove noise from the image obtained in step 3.1);
3.3 Determining a background area in the image obtained in the step 3.2), and determining a foreground area through distance transformation;
3.4 Determining an unknown region in the image obtained in the step 3.3), and marking the unknown region;
3.5 Marking the largest connected domain in the image obtained in the step 3.4);
3.6 Combining the uncertain region and seeds in the image obtained in the step 3.5) by using a watershed algorithm, and modifying the boundary to be-1;
3.7 Color filling is carried out on the image obtained in the step 3.6), and the image is output, so that a small-size end face circle image with reduced interference is obtained.
7. The method for detecting the volume of the raw wood based on the target detection according to claim 1, wherein in the step 4), the Canny edge detection algorithm is adopted to carry out edge detection on each obtained small-size end face circle image with reduced interference.
8. The method according to claim 1, wherein in step 5), the obtained edge detection result map of each small-sized end face circle is detected by a Hough circle detection method.
9. The target detection-based log volume detection method according to claim 8, wherein the method implementing step 5) includes:
5.1 Graying the obtained edge detection result graph of the small-size end face circle;
5.2 Using a cv2. Houghcircuits function in OpenCv, detecting the image obtained in the step 5.1) after adjusting parameters, and extracting to obtain the center coordinates and the radius of each end face circle.
10. The target detection-based raw wood volume detection method according to claim 1, characterized in that in step 6), calculation codes are written according to the raw wood volume calculation formula given in GB/T4814-2013.
CN202310455439.2A 2023-04-25 2023-04-25 Log volume detection method based on target detection Pending CN116481429A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310455439.2A CN116481429A (en) 2023-04-25 2023-04-25 Log volume detection method based on target detection

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310455439.2A CN116481429A (en) 2023-04-25 2023-04-25 Log volume detection method based on target detection

Publications (1)

Publication Number Publication Date
CN116481429A true CN116481429A (en) 2023-07-25

Family

ID=87211473

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310455439.2A Pending CN116481429A (en) 2023-04-25 2023-04-25 Log volume detection method based on target detection

Country Status (1)

Country Link
CN (1) CN116481429A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117346685A (en) * 2023-10-11 2024-01-05 华中农业大学 Catfish phenotype characteristic measurement device and catfish phenotype characteristic measurement method
CN117635619A (en) * 2024-01-26 2024-03-01 南京海关工业产品检测中心 Log volume detection method and system based on machine vision

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117346685A (en) * 2023-10-11 2024-01-05 华中农业大学 Catfish phenotype characteristic measurement device and catfish phenotype characteristic measurement method
CN117635619A (en) * 2024-01-26 2024-03-01 南京海关工业产品检测中心 Log volume detection method and system based on machine vision
CN117635619B (en) * 2024-01-26 2024-04-05 南京海关工业产品检测中心 Log volume detection method and system based on machine vision

Similar Documents

Publication Publication Date Title
CN116481429A (en) Log volume detection method based on target detection
Brandtberg et al. Automated delineation of individual tree crowns in high spatial resolution aerial images by multiple-scale analysis
CN112818988B (en) Automatic identification reading method and system for pointer instrument
CN111784721A (en) Ultrasonic endoscopic image intelligent segmentation and quantification method and system based on deep learning
CN108564092A (en) Sunflower disease recognition method based on SIFT feature extraction algorithm
CN105844279A (en) Depth learning and SIFT feature-based SAR image change detection method
CN109903282B (en) Cell counting method, system, device and storage medium
CN109508709B (en) Single pointer instrument reading method based on machine vision
Malof et al. Image features for pixel-wise detection of solar photovoltaic arrays in aerial imagery using a random forest classifier
Theodorakopoulos et al. HEp-2 cells classification using morphological features and a bundle of local gradient descriptors
CN107729926A (en) A kind of data amplification method based on higher dimensional space conversion, mechanical recognition system
CN114758222B (en) Concrete pipeline damage identification and volume quantification method based on PointNet ++ neural network
CN105930852A (en) Method for identifying bubble image
CN117953314B (en) Multi-dimensional feature optimization ocean substrate classification method and system
Bayırlı et al. Determining different plant leaves' fractal dimensions: a new approach to taxonomical study of plants
CN111521128A (en) Shellfish external form automatic measurement method based on optical projection
CN114693524A (en) Side-scan sonar image accurate matching and fast splicing method, equipment and storage medium
CN110321869A (en) Personnel's detection and extracting method based on Multiscale Fusion network
Korpela et al. The performance of a local maxima method for detecting individual tree tops in aerial photographs
CN111563423A (en) Unmanned aerial vehicle image target detection method and system based on depth denoising automatic encoder
CN108960285B (en) Classification model generation method, tongue image classification method and tongue image classification device
CN115035417A (en) Sentinel-2 satellite image-based seaweed distribution map generation method
CN111473944B (en) PIV data correction method and device for observing complex wall surface in flow field
CN115100443A (en) Cable defect identification method based on high-speed template matching calculation
Ren et al. Sar image data enhancement method based on emd

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination