Method, device, equipment and storage medium for determining quantity of transported wood

CN118037636BActive Publication Date: 2026-10-30JINGUANG PAPER CHINA INVESTMENT
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410065667.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-01-16
Publication Date
2026-10-30
Estimated Expiration
2044-01-16

AI Technical Summary

Technical Problem

但由于实际中环境复杂多变,容易发生光线变化,拍照角度和距离不受控制,且整车原木的堆放参差不齐,采集的图像会有原木之间的重叠遮挡,导致算法模型在实际使用的过程中检测效果难以稳定,普遍存在着漏检和小目标识别效果差等问题

Benefits of technology

[0015]上述方案,通过获取运输工具中木材端面的初始图像,并对目标分割后的初始图像分别得到第一分割图像和第二分割图像之间的差异确定木材的补偿数量,将补偿数量以及第一分割图像中包含的各木材区域的数量之和,作为运输工具中运输的木材的总数,相较于传统的计算机视觉方法计算得到的木材总数,本方案利用补偿数量确定运输的木材总数,能够提高确认木材总数的准确度。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118037636B_ABST
    Figure CN118037636B_ABST
Patent Text Reader

Abstract

The application discloses a method, device and equipment for determining the quantity of transported wood and a storage medium. The method for determining the quantity of transported wood comprises the following steps: acquiring initial images collected by end faces of all the wood in a transport tool; performing target segmentation processing on the initial images to obtain a first segmentation image and a second segmentation image, wherein the first segmentation image contains image information of each wood end face, and the second segmentation image contains image information corresponding to the overall edge of all wood end faces; determining a compensation quantity of the wood based on the difference between the first segmentation image and the second segmentation image; and taking the compensation quantity and the sum of the quantities of the wood regions contained in the first segmentation image as the total quantity of the wood transported in the transport tool. The above scheme can improve the accuracy of determining the total quantity of the transported wood.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of smart forestry technology, and in particular to a method, apparatus, equipment and storage medium for determining the quantity of transported timber. Background Technology

[0002] For timber production and processing enterprises, the transportation of logs from forest land to the destination factory requires inspection from multiple aspects. Among these, the automatic verification of the quantity of logs in a whole truckload has always been a difficult problem to solve. Many enterprises still mainly rely on manual marking and counting for inspection. Manual inspection is labor-intensive, time-consuming, inefficient, subjective, and inaccurate.

[0003] In recent years, various object detection algorithms have been proposed, and many scholars and experts have attempted to use computer vision methods to solve these problems. Artificial intelligence is used to analyze images, which are then input into a pre-designed algorithm model, outputting the number of detected logs. However, due to the complex and variable environment in reality, including changes in lighting, uncontrollable shooting angles and distances, and uneven stacking of logs, images may contain overlapping and occlusion between logs. This makes it difficult for the algorithm model to maintain stable detection performance in practical applications, resulting in common problems such as missed detections and poor recognition of small targets. How to achieve more accurate determination of the quantity of transported timber is a technical problem that urgently needs to be solved by those skilled in the art. Summary of the Invention

[0004] This application provides at least one method, apparatus, equipment, and storage medium for determining the quantity of timber to be transported.

[0005] This application provides a method for determining the quantity of transported timber, comprising: acquiring initial images of the end faces of all timbers in a transport vehicle; performing target segmentation processing on the initial images to obtain a first segmented image and a second segmented image, wherein the first segmented image contains image information of each timber end face and the second segmented image contains image information corresponding to the overall edges of all timber end faces; determining a compensation quantity of timber based on the difference between the first segmented image and the second segmented image; and using the sum of the compensation quantity and the quantity of each timber region contained in the first segmented image as the total number of timbers transported in the transport vehicle.

[0006] In some embodiments, determining the amount of compensation for wood based on the difference between the first segmented image and the second segmented image includes: acquiring a difference image between the first segmented image and the second segmented image, using the difference image as the image to be filled; using a filling area of ​​target size to fill the non-zero area in the image to be filled, and determining the number of successful fillings; using the number of successful fillings as the amount of compensation.

[0007] In some embodiments, before filling non-zero regions in the image to be filled using a filling region of the target size and determining the number of successful fillings, the method for determining the quantity of transported timber further includes: statistically analyzing each timber region in the first segmented image to determine the quantity of each timber region corresponding to the initial total quantity and the diameter of each timber; and determining the target size of the filling region based on the initial total quantity and the diameters.

[0008] In some embodiments, the number of successful fills is used as a compensation quantity, including: for each fill, performing the following steps: obtaining the number of overlapping pixels between the fill region and the non-zero region; and determining that the fill is successful in response to the number of overlapping pixels being equal to the total number of pixels contained in the fill region.

[0009] In some embodiments, obtaining a difference image between a first segmented image and a second segmented image, and using the difference image as the image to be filled, includes: cropping the difference image to obtain a cropped image; and using the cropped image as the image to be filled.

[0010] In some embodiments, the step of performing target segmentation processing on the initial image to obtain the first segmented image is performed by the detection segmentation model. The method for determining the quantity of transported timber further includes a training step for the detection segmentation model: acquiring a first end face sample image; performing image augmentation processing on the first end face sample image to obtain a first augmented image, wherein the image augmentation processing includes at least one of image rotation, image blurring, adding random noise, image affine transformation, and image sharpening; inputting the first augmented image into the detection segmentation model to obtain a training first image for each timber end face in the first augmented image; determining a first loss between the training first image and the preset first image corresponding to the augmented image, wherein the preset first image is obtained by labeling each timber end face in the augmented image; and adjusting the parameters of the detection segmentation model based on the first loss.

[0011] In some embodiments, the step of performing target segmentation processing on the initial image to obtain a second segmented image is performed by the end-face segmentation model. The method for determining the quantity of transported timber further includes a training step for the end-face segmentation model: acquiring a second end-face sample image; performing image augmentation processing on the second end-face sample image to obtain a second augmented image, wherein the image augmentation processing includes at least one of image rotation, image blurring, adding random noise, image affine transformation, and image sharpening; inputting the second augmented image into the end-face segmentation model to obtain a training second image of the overall edges of the timber end faces in the second augmented image; determining a second loss between the training second image and a preset second image corresponding to the second augmented image, wherein the preset second image is obtained by annotating the overall edges of all timber end faces in the augmented image; and adjusting the parameters of the end-face segmentation model based on the second loss.

[0012] This application provides a device for determining the quantity of transported timber, comprising: an acquisition module, a target segmentation module, a first determination module, and a second determination module. The acquisition module acquires initial images of the end faces of all timbers in the transport vehicle. The target segmentation module performs target segmentation processing on the initial images to obtain a first segmented image and a second segmented image. The first segmented image contains image information of each timber end face, and the second segmented image contains image information corresponding to the overall edges of all timber end faces. The first determination module determines the compensation quantity of timber based on the difference between the first segmented image and the second segmented image. The second determination module uses the sum of the compensation quantity and the quantity of each timber region contained in the first segmented image as the total number of timbers transported in the transport vehicle.

[0013] This application provides an electronic device, including a memory and a processor, wherein the processor is used to execute program instructions stored in the memory to implement the above-described method for determining the quantity of transported timber.

[0014] This application provides a computer-readable storage medium storing program instructions thereon, which, when executed by a processor, implement the above-described method for determining the quantity of transported timber.

[0015] The above scheme obtains an initial image of the end face of the timber in the transport vehicle, and determines the compensation quantity of timber by obtaining the difference between the first segmented image and the second segmented image after target segmentation. The sum of the compensation quantity and the number of timber regions contained in the first segmented image is used as the total number of timber transported in the transport vehicle. Compared with the total number of timber calculated by traditional computer vision methods, this scheme uses the compensation quantity to determine the total number of timber transported, which can improve the accuracy of confirming the total number of timber.

[0016] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this application. Attached Figure Description

[0017] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with this application and, together with the specification, serve to explain the technical solutions of this application.

[0018] Figure 1 This is a flowchart illustrating an embodiment of the method for determining the quantity of timber transported according to this application;

[0019] Figure 2 This is a schematic diagram of the effect of the initial image in one embodiment of the method for determining the quantity of timber transported in this application;

[0020] Figure 3This is a schematic diagram of the effect of the first segmented image in one embodiment of the method for determining the quantity of timber transported in this application;

[0021] Figure 4 This is a schematic diagram of the effect of the second segmented image in one embodiment of the method for determining the quantity of timber transported in this application;

[0022] Figure 5 This is a schematic diagram of the effect of the image to be filled in one embodiment of the method for determining the quantity of timber transported in this application;

[0023] Figure 6 This is a schematic diagram illustrating the effect of the target-sized filling area in one embodiment of the method for determining the quantity of timber transported in this application;

[0024] Figure 7 This is a schematic diagram of model training in one embodiment of the method for determining the quantity of timber transported in this application;

[0025] Figure 8 This is a schematic diagram of the structure of a fractal network shown in one embodiment of the method for determining the quantity of timber transported according to this application;

[0026] Figure 9 This is a schematic diagram of an embodiment of the timber transport quantity determination device of this application;

[0027] Figure 10 This is a schematic diagram of the structure of an embodiment of the electronic device of this application;

[0028] Figure 11 This is a schematic diagram of the structure of an embodiment of the computer-readable storage medium of this application. Detailed Implementation

[0029] The embodiments of this application will now be described in detail with reference to the accompanying drawings.

[0030] In the following description, specific details such as particular system architectures, interfaces, and technologies are presented for illustrative purposes rather than for limiting purposes, in order to provide a thorough understanding of this application.

[0031] In this document, the term "and / or" is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. Additionally, the character " / " generally indicates that the preceding and following related objects have an "or" relationship. Furthermore, "many" in this document means two or more. Moreover, the term "at least one" in this document means any combination of at least two of any one or more of a plurality of objects. For example, including at least one of A, B, and C can mean including any one or more elements selected from the set consisting of A, B, and C.

[0032] This application provides methods and apparatus for determining the quantity of transported timber. The application scenarios of this method for determining the quantity of transported timber include, but are not limited to, object detection. The executing entity of the method for determining the quantity of transported timber can be a device for determining the quantity of transported timber. For example, the device can be installed on a terminal device, server, or other processing device. The terminal device can be a device for determining the quantity of transported timber, a user equipment (UE), a mobile device, a user terminal, a terminal, a cellular phone, a cordless phone, a personal digital assistant (PDA), a handheld device, a computing device, an in-vehicle device, etc. In some possible implementations, the method for determining the quantity of transported timber can be implemented by a processor calling computer-readable instructions stored in memory.

[0033] Please see Figure 1 , Figure 1 This is a flowchart illustrating an embodiment of the method for determining the quantity of timber transported according to this application.

[0034] Specifically, the method for determining the quantity of timber to be transported may include the following steps:

[0035] Step S11: Obtain initial images of the end faces of all timbers in the transport vehicle.

[0036] The method for determining the quantity of transported timber in this application can be executed by a quantity determination model running within the timber transport quantity determination process. For example, the input to the quantity determination model can be an initial image, and the output of the quantity determination model can be the total number of timbers transported in the transport vehicle. The quantity determination model can include multiple models or modules. Each module can be a network module or an algorithm module. The models or modules are described below and will not be elaborated further here.

[0037] The means of transport can be any tool capable of loading and transporting timber. In some applications, the means of transport can be vehicles, ships, airplanes, and trains. For example, the means of transport can be trucks, roll-on / roll-off ships, helicopters, and railcars. Different means of transport may be used to transport timber in different regions and under different circumstances. The end face of the timber can refer to the cross-section of the timber. The end face of the timber can display other cross-sectional features such as grain, growth rings, and color. The initial image can be an image of the timber end face taken in the means of transport before transport, an image of the timber end face after counting correction, or an image of the timber end face taken in the means of transport after transport. In some applications, the means of transport can be a truck, and the initial image can be an image of the timber end face taken in the means of transport before leaving the factory, or an image of the timber end face taken in the means of transport after leaving the factory. In some applications, the initial image can be acquired by taking a picture with a digital camera and uploading it to the cloud, or by scanning with a scanner and uploading it to the cloud. The method of acquiring the initial image can vary depending on the requirements. In some applications, there can be multiple initial images. The initial images can be multiple images of the end face of the timber in the transport vehicle acquired after a preset time interval, or images of the end face of the timber in the transport vehicle acquired before transport, as well as images of the pre-transport images after correction processing.

[0038] Please see Figure 2 , Figure 2 This is a schematic diagram illustrating the effect of the initial image in one embodiment of this application. For example... Figure 2 As shown, the means of transport can be a truck, and the initial image can include the means of transport, the end face of the timber, and related background information. For example, a side image of the logs on the truck is taken using a camera. The side image of the logs taken when departing from the forest can be an initial image captured from the end face of the timber in the means of transport. Similarly, the side image of the logs taken upon arrival at the destination factory can also be an initial image captured from the end face of the timber in the means of transport. It is understood that the input to the quantity determination model of this application can be the initial image. Specifically, the initial image can be input to the acquisition module in the quantity determination model.

[0039] Step S12: Perform target segmentation processing on the initial image to obtain a first segmented image and a second segmented image. The first segmented image contains image information of each wood end face, and the second segmented image contains image information corresponding to the overall edges of all wood end faces.

[0040] Target segmentation can be performed on an image to obtain several non-overlapping regions, each corresponding to an object or background in the image. The target segmentation module in a quantity determination model can perform target segmentation on the initial image, obtaining a first segmented image and a second segmented image. Target segmentation can also separate the wood end face from other information in the image, obtaining the regions corresponding to the wood end face and other information. It can be understood that all regions in the acquired image except for the wood end face can be background regions corresponding to background information. Target segmentation can be achieved through thresholding, region growing, edge segmentation, clustering-based segmentation, and feature-based segmentation. In some applications, thresholding can divide pixel values ​​in an image into foreground and background regions according to a certain threshold, mainly including global thresholding and adaptive thresholding. The foreground region can correspond to the wood end face region. In some applications, region growing can start from known seed pixels and expand the foreground region according to specific growth rules until the edge of the region encounters the corresponding background pixel. Again, the foreground region can correspond to the wood end face region. In some applications, edge segmentation involves detecting and segmenting edges in an image. The outermost edge of the wood end face can be used as edge information. Common edge segmentation methods include Canny edge detection, Sobel edge detection, and Laplacian edge detection. In other applications, clustering-based segmentation divides the pixels in an image into multiple classes, each corresponding to a region. Clustering-based segmentation can separate the pixels into two categories: wood end face and background. Common clustering methods include k-means clustering and spectral clustering. In still other applications, feature-based segmentation utilizes local image features. Feature-based segmentation can segment the input image by leveraging the feature differences between the wood end face and the background. Examples include texture segmentation, shape segmentation, and color segmentation. Depending on the specific application and image features, a suitable target segmentation method should be selected.

[0041] Please see Figure 3 , Figure 3 This is a schematic diagram illustrating the effect of the first segmented image in one embodiment of the method for determining the quantity of timber transported according to this application. Figure 3As shown, the initial image is segmented using the detection and segmentation model in the target segmentation module to obtain the first segmented image. This first segmented image can contain image information of each wood end face. In some applications, the first segmented image may only retain a local image of the wood end face compared to the initial image, discarding background information other than the wood end face image from the initial image. It can be considered that the first segmented image obtained by target segmentation of the initial image can eliminate background information other than the wood end face image from interfering with the image. The first segmented image retains only the wood regions within the wood end face, making the image more homogeneous, and has lower requirements for the initial image acquisition process, as the background is not important during acquisition. It can be understood that each wood region in the first segmented image can be an image of the end face of each piece of wood, and the end face image of each piece of wood can be an image composed of the edges of the end face of each piece of wood. Each wood region can be a regular circular region or an irregular graphic region of each piece of wood.

[0042] Please see Figure 4 , Figure 4 This is a schematic diagram illustrating the effect of the second segmented image in one embodiment of the method for determining the quantity of timber transported according to this application. Figure 4 As shown, the end-face segmentation model in the target segmentation module is used to perform target segmentation processing on the initial image to obtain the first segmented image. The second segmented image can contain image information corresponding to the overall edges of all wood end faces. In some application scenarios, the second segmented image can be a partial image of all wood end faces compared to the initial image, discarding background information other than the wood end face images in the initial image. It can be considered that the second segmented image obtained by target segmentation of the initial image can eliminate background information other than the wood end face images from interfering with the image. The second segmented image only retains each wood region in the wood end face, making the image more homogeneous, and has lower requirements for the initial image acquisition, as the background of the initial image is not important. It can be understood that all wood regions in the second segmented image can be end-face images of the overall edges of all wood, and all end-face images of all wood can be the outer perimeter image of the wood formed by the edges of all wood end faces.

[0043] Understandably, the target segmentation module can obtain the mask from the initial image to obtain the first segmentation image and the second segmentation image. The first segmentation image can be represented as mask1, and the second segmentation image can be represented as mask2.

[0044] Step S13: Determine the amount of wood compensation based on the difference between the first segmented image and the second segmented image.

[0045] The target segmentation module can input the first segmented image and the second segmented image into the first determination module of the quantity determination model. The output of the first determination module can be the compensation quantity of wood. Based on the differences between the first segmented image and the second segmented image, the first determination module can determine the compensation quantity of wood. The differences between the first segmented image and the second segmented image can refer to the difference region. It can be understood that the difference region between the first segmented image and the second segmented image can be the wood missed detection region. The compensation quantity of wood can be determined using the difference region between the first segmented image and the second segmented image. The compensation quantity can be the number of wood missed detections. In some application scenarios, after the first segmented image and the second segmented image are input into the first determination module, the first determination module performs image comparison between the first segmented image and the second segmented image. For example, the image comparison method can be to use methods such as structural similarity algorithm (SSIM) or mean squared error (MSE) to compare the differences between the reference first segmented image and the second segmented image to obtain the comparison result. The first determination module can determine the difference region between the two images through the comparison result, where the difference region may be the location of the wood missed detection region. The first determination module can calculate the compensation quantity of the compensation target based on the location and size of the difference region. The specific calculation method may depend on the application scenario and the characteristics of the compensation target. For example, if the compensation target is the location of missed wood detections, an offset in pixels can be used as the compensation amount. For example, if the compensation target is the color difference from the missed wood detection area, the intensity of the color difference can be used as the compensation amount. In other application scenarios, the difference between the first segmented image and the second segmented image can be the pixel value difference between the two images. The first determining module can determine the compensation amount based on the pixel value difference.

[0046] Step S14: The sum of the compensation amount and the number of each timber region contained in the first segmentation image is taken as the total number of timbers transported in the transport vehicle.

[0047] The number of each wood region contained in the first segmented image can be the initial total number. For example... Figure 2 As shown, the end face edge of each piece of wood in the first segmentation image constitutes a wood region. The number of all wood regions in the first segmentation image can be the total number of all wood pieces. The initial total number can be the total number of wood pieces detected based on each wood region displayed in the first segmentation image. The compensation number can be the number of wood pieces missed by the first segmentation image relative to the initial total number obtained from the first segmentation image.

[0048] In the quantity determination model, the second determination module sums the compensation quantity output by the first determination module and the quantity of each timber region contained in the first segmented image obtained by the second determination module to obtain a sum value. The second determination module uses the sum value as the total number of timbers transported in the transport vehicle.

[0049] The above scheme obtains an initial image of the end face of the timber in the transport vehicle, and determines the compensation quantity of timber by obtaining the difference between the first segmented image and the second segmented image after target segmentation. The sum of the compensation quantity and the number of timber regions contained in the first segmented image is used as the total number of timber transported in the transport vehicle. Compared with the total number of timber calculated by traditional computer vision methods, this scheme uses the compensation quantity to determine the total number of timber transported, which can improve the accuracy of confirming the total number of timber.

[0050] In some embodiments, step S13 may include the following steps: First, obtain the difference image between the first segmented image and the second segmented image, and use the difference image as the image to be filled; use the filling area of ​​the target size to fill the non-zero area in the image to be filled, and determine the number of successful fillings; use the number of successful fillings as the compensation quantity.

[0051] The difference image between the first and second segmented images can refer to the differences between pixels in the two images. The difference image is generated by comparing corresponding pixels of the two images pixel by pixel. Each pixel value in the difference image represents the degree of difference between the two image pixels at that corresponding pixel value. In some applications, obtaining the difference image between the first and second segmented images can include comparing pixel values ​​channel by channel, calculating the Euclidean distance between pixel colors, and calculating the difference between grayscale pixel values. In other applications, the first and second segmented images can be mask images, and the difference image can be obtained by calculating the difference between the mask image mask2 corresponding to the second segmented image and the mask image mask1 corresponding to the first segmented image. Specifically, the first determining module can subtract the mask image mask1 corresponding to the first segmented image from the mask image mask2 corresponding to the second segmented image to obtain the difference image mask3 between the first and second segmented images. The first determining module uses the difference image mask3 as the image to be filled.

[0052] Please see Figure 5 , Figure 5 This is a schematic diagram illustrating the effect of filling an image in one embodiment of the method for determining the quantity of timber transported according to this application. For example... Figure 5As shown, the image to be filled contains image information corresponding to the overall edges of all wood end faces and image information for each individual wood end face. It can be understood that the image to be filled may include gap areas between the wood pieces, which are areas where wood is missed during detection. For example, a wood missed detection area is as follows: Figure 5 The white pixels are shown. In some applications, the difference image can be a binary image containing only 0s and 1s. The regions corresponding to 0s in the difference image can represent the individual wood regions contained in the first segmented image, that is, the image regions corresponding to the initial total number of woods. The regions corresponding to 1s in the difference image can represent areas where wood was missed.

[0053] Please see Figure 6 , Figure 6 This is a schematic diagram illustrating the effect of a target-size filling region in one embodiment of the method for determining the quantity of transported timber according to this application. The first determining module can use the target-size filling region to fill non-zero areas in the image to be filled, determining the number of successful fillings. The target-size filling region can be the filling target corresponding to each piece of timber in each filling operation. The first determining module can use the target-size filling region as the image area required for a unit quantity of timber in the image to be filled. It is understood that each target-size filling region can correspond to a preset timber region, which can be represented as a mask_circle. Non-zero areas in the image to be filled can refer to timber omission areas or gaps between timbers. Specifically, as... Figure 6 As shown, non-zero regions in the image to be filled can be white pixel regions. Pixel values ​​in non-zero regions of the image to be filled can be 1. Pixel values ​​in regions other than non-zero regions of the image to be filled are 0.

[0054] The first determining module traverses the image to be filled pixel by pixel using the target-size fill region and performs fill processing. Specifically, the first determining module uses the target-size fill region as the center and traverses the image to be filled pixel by pixel. For each fill operation, the first determining module fills the non-zero regions in the image to be filled. The first determining module can perform the following steps: When the target-size fill region reaches the current position of the image to be filled, the first determining module performs a bitwise AND operation between the image region corresponding to the current position of the image to be filled and the target-size fill region to obtain the target fill region. In response to the completion of filling the image region corresponding to the current position of the image to be filled, the first determining module performs the next fill operation, wherein the first determining module performs a bitwise AND operation between the image region corresponding to the next position of the image to be filled and the target-size fill region to obtain the target fill region.

[0055] The first determining module can determine the filling result corresponding to this filling based on the target filling area. This filling result can be a successful filling result or a failed filling result. For each filling, if the filling result is a failed filling result, the filling failure count is incremented by one. If the filling result is a successful filling result, the filling success count is incremented by one. The first determining module can count the number of successful fillings or the number of failed fillings based on the filling result. A successful filling result can mean that an image region of the target size or pixels corresponding to the current position of the image to be filled exists. A failed filling result can mean that an image region of the target size or pixels corresponding to the current position of the image to be filled does not exist. In some application scenarios, the first determining module sums the pixel values ​​of the image region corresponding to the current position of the image to be filled and the pixel values ​​of the target size filling region to obtain the pixel values ​​of the target filling region. For example, the first determining module performs a bitwise AND operation on the image region mask3 corresponding to the current position of the image to be filled and the target size filling region mask_circle, and sums the results to obtain the target filling region. The pixel values ​​of the target filling region can be the sum of the results between mask3 and mask_circle.

[0056] The first determining module can use the number of successful fillings as the compensation quantity. The first determining module can detect whether the filling process for all missing wood areas in the image to be filled is complete. In response to the completion of the filling process for all missing wood areas in the image to be filled, the first determining module counts the number of successful fillings. The output of the first determining module is the compensation quantity for the image to be filled. The compensation quantity for the image to be filled can be the number of successful fillings counted by the first determining module.

[0057] In some embodiments, the step of using the number of successful fills as the compensation quantity may include the following steps: For each fill, perform the following steps: First, obtain the number of overlapping pixels between the fill region and the non-zero region. Then, in response to the number of overlapping pixels being equal to the total number of pixels contained in the fill region, determine that the fill is successful.

[0058] For each fill operation, a target fill region can exist between the fill region and the non-zero region. The target-sized fill region is filled with the non-zero region in the image to be filled to obtain the target fill region. This target fill region contains multiple pixel values. In some application scenarios, the pixel values ​​corresponding to the target-sized fill region are all 1, and the pixel values ​​corresponding to the non-zero region in the image to be filled are all 1. The first determining module fills the target-sized fill region with the non-zero region in the image to be filled, resulting in a target fill region with pixel values ​​all of 1. The first determining module determines that the number of overlapping pixels between the fill region and the non-zero region is equal to the total number of pixels contained in the fill region, and the first determining module determines that the fill is successful. In other application scenarios, after determining that the fill is successful, the first determining module sets the non-zero region in the image to be filled to zero. This means that after determining that the fill is successful, the first determining module sets the pixel values ​​corresponding to the non-zero region in the image to be filled to 0. It can be assumed that after successful filling, setting the pixel values ​​of the already filled areas in the image to be filled to 0 will facilitate the next filling operation and reduce the amount of data calculation by the first determination module.

[0059] In other application scenarios, the pixel values ​​corresponding to the target-sized fill region are all 1, while the pixel values ​​corresponding to the non-zero regions in the image to be filled are not all 1. The first determining module fills the target-sized fill region with the non-zero regions in the image to be filled, resulting in a target fill region where the pixel values ​​are not all 1. The first determining module determines that if the number of overlapping pixels between the fill region and the non-zero regions is not equal to the total number of pixels in the fill region, the fill is considered a failed fill. It can be understood that for pixels at the same position in different images, when the target-sized fill region is filled with the non-zero regions in the image to be filled, if the pixel values ​​in both images are all 1, the resulting target fill region will have a pixel value of 1. If the pixel values ​​in both images are not all 1, the resulting target fill region will have a pixel value of 0.

[0060] It can be assumed that the first determining module determines whether the filling is successful based on whether the number of overlapping pixels is equal to the total number of pixels contained in the filling area, which can improve the accuracy of the obtained wood compensation quantity.

[0061] In some embodiments, before the step of filling non-zero regions in the image to be filled using the target-sized filling region and determining the number of successful fillings, the method for determining the quantity of transported timber further includes the following steps: First, statistically analyzing each timber region in the first segmented image to determine the quantity of each timber region corresponding to the initial total quantity and the diameter of each timber. Then, based on the initial total quantity and the diameters, determining the target size of the filling region.

[0062] The target segmentation module can statistically analyze each wood region in the first segmented image to determine the number of each wood region corresponding to the initial total number and the diameter of each piece of wood. The diameter of the wood can be the average of the major and minor diameters of each piece of wood. It is understood that the wood in a transport vehicle may have rectangular or irregular shapes, and the average of the major and minor diameters of such wood can be used as the diameter of the expected circular end face.

[0063] The initial total number of wood regions in the first segmented image can correspond to the initial total number of woods in the first segmented image. This can be understood as the initial total number of woods being the sum of the uncompensated numbers. The target segmentation module can also obtain the diameter of the wood corresponding to each wood region. This can be understood as each wood quantity in the first segmented image corresponding to a single or different wood diameter. In some application scenarios, the detection segmentation model in the target segmentation module statistically analyzes each wood region in the first segmented image to determine the initial total number of wood regions and the diameter of each wood. The detection segmentation model in the target segmentation module can sort the obtained wood diameters based on the initial total number of woods, obtaining a wood diameter ranking. The detection segmentation model can use a preset proportion to select each diameter from the wood diameter ranking, obtaining the average diameter of the wood with the preset proportion. The detection segmentation model can use this average diameter as a compensation diameter value. The detection segmentation model uses the circle of this compensation diameter value to determine the target size of the filling area. The preset proportion can refer to the ratio of the number of woods selected according to requirements or accuracy requirements to the initial total number. The preset proportion is used to adjust the accuracy of the target size according to requirements or accuracy requirements. This can be understood as... Figure 6 As shown, the target size can be the compensation diameter value. The filled area can be the circle corresponding to the compensation diameter value.

[0064] In some embodiments, the step of obtaining the difference image between the first segmented image and the second segmented image, and using the difference image as the image to be filled, may include the following steps: cropping the difference image to obtain a cropped image. Then, the cropped image is used as the image to be filled.

[0065] The quantity determination model may include a cropping module, which performs cropping processing on the input image. In some applications, the difference image can be input to the cropping module, and the output image is a cropped image. The quantity determination model can use the cropped image as the image to be filled. It is understandable that, as... Figure 5 As shown, the image is cropped using the bounding rectangle of the difference image, retaining only the image of the wood end face region, resulting in a cropped image. In other application scenarios, the first and second segmented images in step S12 are both output images after processing by the cropping module. It can be understood that both the first and second segmented images are images cropped using the bounding rectangle. The difference image obtained by the cropping module based on the first and second segmented images cropped using the bounding rectangle is also an image cropped using the bounding rectangle. It can be considered that the image processed by the cropping module can reduce the interference of image size on image processing and reduce the computational complexity of image processing in the image to be filled.

[0066] In some embodiments, the step of performing target segmentation processing on the initial image to obtain the first segmented image in step S12 is performed by the detection segmentation model. The method for determining the quantity of transported timber further includes a training step for the detection segmentation model: acquiring a first end face sample image; performing image augmentation processing on the first end face sample image to obtain a first augmented image, wherein the image augmentation processing includes at least one of image rotation, image blurring, adding random noise, image affine transformation, and image sharpening; inputting the first augmented image into the detection segmentation model to obtain a training first image for each timber end face in the first augmented image; determining a first loss between the training first image and the preset first image corresponding to the augmented image, wherein the preset first image is obtained by labeling each timber end face in the first augmented image; and adjusting the parameters of the detection segmentation model based on the first loss.

[0067] The target segmentation module in step S12 above may include a detection segmentation model. The first end-face sample image may be multiple images of the end face of the timber being transported in a transport vehicle, acquired by a camera. Specifically, the first end-face sample image is obtained by capturing images of the timber being transported by the transport vehicle under different shooting angles, distances, weather, lighting, and background conditions. Image augmentation processing may be performed by the image augmentation module in the detection segmentation model. The image augmentation processing in the image augmentation module of the detection segmentation model may be at least one of image rotation, image blurring, adding random noise, image affine transformation, and image sharpening. In some application scenarios, the image augmentation module may further include at least one of an image rotation module, an image blurring module, a random noise addition module, an image affine transformation module, and an image sharpening module to perform at least one of the above image rotation, image blurring, random noise addition, image affine transformation, and image sharpening. In some application scenarios, the connection relationships between the modules in the image augmentation module can be pre-established, and the modules in the image augmentation module can be connected sequentially according to a predetermined connection order. It can be considered that each module in the image augmentation module can change the appearance, shape, color, etc. of the image, thereby expanding the training dataset corresponding to the first end face sample image. The resulting first augmented image can improve the generalization ability and robustness of the subsequent detection and segmentation model. Using the image augmentation module, the first end face sample image is augmented to obtain the first augmented image. Then, each first augmented image is normalized and mapped to the interval [0, 1]. The training data is divided into training, validation, and test sets according to a certain ratio (e.g., 7:2:1), and trained for a certain number of rounds to obtain the detection and segmentation model. The first augmented image is input into the detection and segmentation model to obtain the training first image of the wood end face in the first augmented image. Then, a first loss is determined between the training first image and the preset first image corresponding to the first augmented image. The preset first image is obtained by annotating the first augmented image. Specifically, the preset first image is obtained by annotating each wood end face in the first augmented image. Finally, the parameters of the detection and segmentation model are adjusted based on the first loss. In some application scenarios, the edge regions of each wood end face are manually annotated in the first augmented image to obtain the preset first image. For each first augmented image, a normalization mapping is performed, mapping its values ​​to the interval [0, 1] to obtain the first training data. The first training data is divided into a training set, a validation set, and a test set according to a certain ratio (e.g., 7:2:1), and the detection and segmentation model is trained for a certain number of epochs to obtain the detection and segmentation model. A first loss is determined between the training first image and the preset first image corresponding to the first augmented image. Based on the first loss, the parameters of the detection and segmentation model are adjusted.It can be considered that the parameters of the detection and segmentation model are adjusted based on the first loss between the training first image and the preset first image corresponding to the first augmented image. A target first loss function can be defined to evaluate the difference between the prediction result of the detection and segmentation model and the true label. The prediction result of the detection and segmentation model can be the training first image, and the true label can be the preset first image corresponding to the first augmented image. The target first loss function can be a minimized first loss function. By minimizing the first loss function, the model parameters can be adjusted, enabling the detection and segmentation model to better fit the training data and predict unseen data.

[0068] In some embodiments, the step of performing target segmentation processing on the initial image to obtain the second segmented image in step S12 is performed by the end face segmentation model. The method for determining the quantity of transported timber also includes a training step for the end face segmentation model: acquiring a second end face sample image; performing image augmentation processing on the second end face sample image to obtain a second augmented image, wherein the image augmentation processing includes at least one of image rotation, image blurring, adding random noise, image affine transformation, and image sharpening; inputting the second augmented image into the end face segmentation model to obtain a training second image of the overall edges of the timber end faces in the second augmented image; determining a second loss between the training second image and the preset second image corresponding to the second augmented image, wherein the preset second image is obtained by annotating the overall edges of all timber end faces in the second augmented image; and adjusting the parameters of the end face segmentation model based on the second loss.

[0069] The target segmentation module in step S12 above may include an end-face segmentation model. The second end-face sample image may be multiple images of the end face of the timber in the transport vehicle acquired by a camera. Specifically, the second end-face sample images are obtained by capturing images of the timber being transported by the transport vehicle under different shooting angles, distances, weather, lighting, and background conditions. Image augmentation processing may be performed by the image augmentation module in the end-face segmentation model. The image augmentation processing in the image augmentation module of the end-face segmentation model may be at least one of image rotation, image blurring, adding random noise, image affine transformation, and image sharpening. In some application scenarios, the image augmentation module may further include at least one of an image rotation module, an image blurring module, a random noise addition module, an image affine transformation module, and an image sharpening module to perform at least one of the above image rotation, image blurring, random noise addition, image affine transformation, and image sharpening. In some application scenarios, the connection relationships between the modules in the image augmentation module can be pre-established, and the modules in the image augmentation module can be connected sequentially according to a predetermined connection order. It can be assumed that each module in the image augmentation module can change the appearance, shape, color, etc. of the image, thereby expanding the training dataset corresponding to the second end-face sample image. The resulting second augmented image can improve the generalization ability and robustness of the subsequent end-face segmentation model. Using the image augmentation module, the second end-face sample image is augmented to obtain the second augmented image. Then, each second augmented image is normalized and mapped to the interval [0, 1]. The training data is divided into training, validation, and test sets according to a certain ratio (e.g., 7:2:1), and trained for a certain number of rounds to obtain the end-face segmentation model. The second augmented image is input into the end-face segmentation model to obtain the training second image of the wood end face within the second augmented image. Then, a second loss is determined between the training second image and the preset second image corresponding to the second augmented image. The preset second image is obtained by annotating the second augmented image. Specifically, the preset second image is obtained by annotating the overall edges of all wood end faces in the second augmented image. Finally, based on the second loss, the parameters of the end-face segmentation model are adjusted. In some application scenarios, the edges of all wood end faces are manually annotated in the second augmented image to obtain a preset second image. Each second augmented image is then normalized and mapped to the interval [0, 1] to obtain the second training data. This second training data is divided into training, validation, and test sets according to a certain ratio (e.g., 7:2:1) to train the end face segmentation model. After a certain number of training epochs, the end face segmentation model is obtained. A second loss is determined between the training second image and the preset second image corresponding to the second augmented image. Based on this second loss, the parameters of the end face segmentation model are adjusted.It can be considered that the parameters of the end-face segmentation model can be adjusted based on the second loss between the training second image and the preset second image corresponding to the second augmented image. A target second loss function can be defined to evaluate the difference between the prediction result of the end-face segmentation model and the true label. The prediction result of the end-face segmentation model can be the training second image, and the true label can be the preset second image corresponding to the second augmented image. The target second loss function can be minimizing the second loss function. By minimizing the second loss function, the model parameters can be adjusted so that the end-face segmentation model can better fit the training data and predict unseen data.

[0070] Please see Figure 7 , Figure 7 This is a schematic diagram of the model training process in one embodiment of the method for determining the quantity of timber transported according to this application. Figure 7 As shown, the model training process may include the following steps:

[0071] Step S71: Obtain the first end face sample image and / or the second end face sample image.

[0072] In some application scenarios, the quantity determination model can acquire a first end-face sample image. In other application scenarios, the quantity determination model can acquire a second end-face sample image. In still other application scenarios, the quantity determination model can acquire both first and second end-face sample images. It is understood that the steps for acquiring the first end-face sample image can refer to the above content and will not be repeated here. The steps for acquiring the second end-face sample image can refer to the above content and will not be repeated here.

[0073] Step S72: Perform image augmentation processing on the sample images of each end face.

[0074] Each end-face sample image can be either a first end-face sample image or a second end-face sample image. In some application scenarios, image augmentation processing is performed on the first end-face sample image to obtain a first augmented image. In other application scenarios, image augmentation processing is performed on the second end-face sample image to obtain a second augmented image. It is understood that the steps for performing image augmentation processing on the first end-face sample image to obtain the first augmented image can refer to the above content and will not be repeated here. The steps for performing image augmentation processing on the second end-face sample image to obtain the second augmented image can refer to the above content and will not be repeated here.

[0075] Step S73: Annotation processing.

[0076] In some applications, annotation processing may involve annotating the first amplified image. In other applications, annotation processing may involve annotating the second amplified image. It is understood that the steps for annotating the first amplified image can be referenced above and will not be repeated here.

[0077] Step S74: Normalization mapping processing.

[0078] In some applications, normalization mapping may be performed on the first amplified image. In other applications, it may be performed on the second amplified image. It is understood that the steps for normalizing the first amplified image can be referenced above and will not be repeated here.

[0079] Step S75: Train the detection and segmentation model.

[0080] The training of the detection and segmentation model can be referenced from the above content, and will not be repeated here.

[0081] Step S76: Train the end face segmentation model.

[0082] The above information can be used as a reference, and will not be repeated here.

[0083] The above scheme obtains an initial image of the end face of the timber in the transport vehicle, and determines the compensation quantity of timber by obtaining the difference between the first segmented image and the second segmented image after target segmentation. The sum of the compensation quantity and the number of timber regions contained in the first segmented image is used as the total number of timber transported in the transport vehicle. Compared with the total number of timber calculated by traditional computer vision methods, this scheme uses the compensation quantity to determine the total number of timber transported, which can improve the accuracy of confirming the total number of timber.

[0084] To better understand the quantity determination model provided in this scheme, please refer to [link / reference]. Figure 8 . Figure 8 This is a schematic diagram of the structure of a fractal network shown in one embodiment of the method for determining the quantity of timber transported in this application.

[0085] The quantity determination model may include an acquisition module, a target segmentation module, a first determination module, and a second determination module.

[0086] In some application scenarios, the acquisition module can be used to acquire initial images of the end faces of timber in a transportation vehicle. The quantity determination model inputs the initial image to the target segmentation module, obtaining a first segmented image and a second segmented image. The first segmented image contains image information of each timber end face, and the second segmented image contains image information corresponding to the overall edges of all timber end faces. The target segmentation module can include a detection segmentation model and an end face segmentation model. The quantity determination model can also include a cropping submodule. In some application scenarios, the quantity determination model inputs the initial image to the detection segmentation model in the target segmentation module, which outputs the first segmented image. The quantity determination model inputs the initial image to the end face segmentation model in the target segmentation module, which outputs the second segmented image. The first determination module can be based on the difference image between the first and second segmented images. The first determination module can input the difference image to the cropping module to crop the difference image, obtaining a cropped image. The quantity determination model can use the cropped image as the image to be filled. In other application scenarios, both the first and second segmented images output by the target segmentation module are images processed by the cropping module. The quantity determination model inputs the first segmented image (cropped based on the bounding rectangle) and the second segmented image (cropped based on the bounding rectangle) into the first determination module, resulting in a difference image after bounding rectangle cropping. The first determination module uses this difference image as the image to be filled. It can be assumed that the computational complexity of image processing in the image to be filled after cropping is low.

[0087] In some application scenarios, the quantity determination model inputs the initial image into the detection and segmentation model in the target segmentation module. It can also output the initial total quantity corresponding to the quantity of each wood region and the diameter of each piece of wood. Based on the initial total quantity and diameters, the detection and segmentation model can determine the target size of the filling region. Specifically, the detection and segmentation model can select diameters from the wood diameter sorting using a preset proportion to obtain the average diameter of the wood with the preset proportion. The detection and segmentation model can use this average diameter as a compensation diameter value. The detection and segmentation model uses the circle containing this compensation diameter value to determine the target size of the filling region. In some application scenarios, the first determination module can use the filling region of the target size to fill non-zero regions in the image to be filled, determining the number of successful fillings. Then, the first determination module can use the number of successful fillings as the compensation quantity. For each filling, the first determination module can perform the following steps: obtain the number of overlapping pixels between the filling region and the non-zero region. In response to the number of overlapping pixels equaling the total number of pixels contained in the filling region, the filling is determined to be successful. In some application scenarios, the second determination module can sum the compensation quantity output by the first determination module and the quantity of each wood region in the first segmented image obtained by the second determination module to obtain a sum value. The second determining module uses the summation value as the total number of timbers transported in the transport vehicle.

[0088] The above scheme obtains an initial image of the end face of the timber in the transport vehicle, and determines the compensation quantity of timber by obtaining the difference between the first segmented image and the second segmented image after target segmentation. The sum of the compensation quantity and the number of timber regions contained in the first segmented image is used as the total number of timber transported in the transport vehicle. Compared with the total number of timber calculated by traditional computer vision methods, this scheme uses the compensation quantity to determine the total number of timber transported, which can improve the accuracy of confirming the total number of timber.

[0089] Please see Figure 9 , Figure 9This is a schematic diagram of an embodiment of the timber quantity determination device of this application. The timber quantity determination device 90 includes an acquisition module 91, a target segmentation module 92, a first determination module 93, and a second determination module 94. The acquisition module 91 is used to acquire initial images of the end faces of all timbers in the transport vehicle; the target segmentation module 92 is used to perform target segmentation processing on the initial images to obtain a first segmented image and a second segmented image, wherein the first segmented image contains image information of each timber end face, and the second segmented image contains image information corresponding to the overall edges of all timber end faces; the first determination module 93 is used to determine the compensation quantity of timber based on the difference between the first segmented image and the second segmented image; the second determination module 94 is used to take the sum of the compensation quantity and the quantity of each timber region contained in the first segmented image as the total number of timbers transported in the transport vehicle.

[0090] The above scheme obtains an initial image of the end face of the timber in the transport vehicle, and determines the compensation quantity of timber by obtaining the difference between the first segmented image and the second segmented image after target segmentation. The sum of the compensation quantity and the number of timber regions contained in the first segmented image is used as the total number of timber transported in the transport vehicle. Compared with the total number of timber calculated by traditional computer vision methods, this scheme uses the compensation quantity to determine the total number of timber transported, which can improve the accuracy of confirming the total number of timber.

[0091] Please refer to the method for determining the quantity of timber to be transported for the functions performed by each module; they will not be repeated here.

[0092] Please see Figure 10 , Figure 10 This is a schematic diagram of an embodiment of the electronic device of this application. The electronic device 100 includes a memory 101 and a processor 102. The processor 102 is used to execute program instructions stored in the memory 101 to implement the steps in the above-described embodiment of the method for determining the quantity of transported timber. In a specific implementation scenario, the electronic device 100 may include, but is not limited to, a microcomputer or a server. In addition, the electronic device 100 may also include mobile devices such as laptops and tablets, which are not limited here.

[0093] Specifically, processor 102 controls itself and memory 101 to implement the steps in the above-described embodiment of the method for determining the quantity of transported timber. Processor 102 can also be referred to as a CPU (Central Processing Unit). Processor 102 may be an integrated circuit chip with signal processing capabilities. Processor 102 can also be a general-purpose processor, digital signal processor (DSP), application-specific integrated circuit (ASIC), field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. A general-purpose processor can be a microprocessor or any conventional processor. Furthermore, processor 102 can be implemented using integrated circuit chips.

[0094] The above scheme obtains an initial image of the end face of the timber in the transport vehicle, and determines the compensation quantity of timber by obtaining the difference between the first segmented image and the second segmented image after target segmentation. The sum of the compensation quantity and the number of timber regions contained in the first segmented image is used as the total number of timber transported in the transport vehicle. Compared with the total number of timber calculated by traditional computer vision methods, this scheme uses the compensation quantity to determine the total number of timber transported, which can improve the accuracy of confirming the total number of timber.

[0095] Please see Figure 11 , Figure 11 This is a schematic diagram of the structure of an embodiment of the computer-readable storage medium of this application. The computer-readable storage medium 110 stores program instructions 1101 thereon, which, when executed by a processor, implement the steps in any of the above embodiments of the method for determining the quantity of transported timber.

[0096] The above scheme obtains an initial image of the end face of the timber in the transport vehicle, and determines the compensation quantity of timber by obtaining the difference between the first segmented image and the second segmented image after target segmentation. The sum of the compensation quantity and the number of timber regions contained in the first segmented image is used as the total number of timber transported in the transport vehicle. Compared with the total number of timber calculated by traditional computer vision methods, this scheme uses the compensation quantity to determine the total number of timber transported, which can improve the accuracy of confirming the total number of timber.

[0097] In some embodiments, the functions or modules of the apparatus provided in this disclosure can be used to perform the methods described in the above method embodiments. The specific implementation can be referred to the description of the above method embodiments, and for the sake of brevity, it will not be repeated here.

[0098] The description of the various embodiments above tends to emphasize the differences between the various embodiments. The similarities or similarities between them can be referred to, and for the sake of brevity, they will not be repeated here.

[0099] In the several embodiments provided in this application, it should be understood that the disclosed methods and apparatus can be implemented in other ways. For example, the apparatus implementations described above are merely illustrative. For instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection of devices or units may be electrical, mechanical, or other forms.

[0100] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0101] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) or processor to execute all or part of the steps of the methods of various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0102] If the technical solution of this application involves personal information, the product using this technical solution has clearly informed the user of the personal information processing rules and obtained the user's voluntary consent before processing the personal information. If the technical solution of this application involves sensitive personal information, the product using this technical solution has obtained the user's separate consent before processing the sensitive personal information, and also meets the requirement of "express consent". For example, at personal information collection devices such as cameras, clear and prominent signs are set up to inform users that they have entered the scope of personal information collection and that personal information will be collected. If an individual voluntarily enters the collection scope, it is deemed that they have agreed to the collection of their personal information; or on the personal information processing device, with clear signs / information informing users of the personal information processing rules, authorization is obtained from the individual through pop-up information or by asking the individual to upload their personal information; wherein, the personal information processing rules may include information such as the personal information processor, the purpose of personal information processing, the processing method, and the types of personal information processed.

Claims

1. A method for determining the quantity of timber to be transported, characterized in that, include: Acquire initial images of the end faces of all timbers in the transport vehicle; The initial image is subjected to target segmentation processing to obtain a first segmented image and a second segmented image. The first segmented image contains each end face of the wood, and the second segmented image contains the overall edges of all end faces of the wood. The first segmented image and the second segmented image are mask images. Determining the amount of wood compensation based on the difference between the first segmented image and the second segmented image includes: acquiring a difference image between the first segmented image and the second segmented image; using the difference image as the image to be filled, wherein the difference image represents the difference between the mask image corresponding to the second segmented image and the mask image corresponding to the first segmented image; filling the non-zero regions in the image to be filled using a filling region of a target size, and determining the number of successful fillings; using the number of successful fillings as the amount of compensation. The sum of the compensation quantity and the quantity of each timber region contained in the first segmented image is taken as the total number of timbers transported in the transport vehicle. The edge of each timber end face in the first segmented image constitutes a timber region. The step of using the number of successful fills as the compensation quantity includes: for each fill, performing the following steps: obtaining the number of overlapping pixels between the fill area and the non-zero area; and determining that the fill is successful in response to the number of overlapping pixels being equal to the total number of pixels contained in the fill area.

2. The method according to claim 1, characterized in that, Before filling the non-zero regions in the image to be filled using a fill region of the target size and determining the number of successful fills, the method further includes: The number of each wood region in the first segmented image is statistically analyzed to determine the initial total number of each wood region and the diameter of each wood. Based on the initial total quantity and each of the diameters, the target size of the filling area is determined.

3. The method according to any one of claims 1 to 2, characterized in that, The step of obtaining the difference image between the first segmented image and the second segmented image, and using the difference image as the image to be filled, includes: The difference image is cropped to obtain a cropped image; The cropped image is used as the image to be filled.

4. The method according to any one of claims 1 to 2, characterized in that, The step of performing target segmentation processing on the initial image to obtain a first segmented image is performed by a detection segmentation model. The method also includes a training step for the detection segmentation model. Obtain the first end face sample image; The first end face sample image is subjected to image augmentation processing to obtain a first augmented image. The image augmentation processing includes at least one of image rotation, image blurring, adding random noise, image affine transformation, and image sharpening. The first amplified image is input into the detection and segmentation model to obtain a training first image for each end face of the wood in the first amplified image; Determine a first loss between the training first image and the preset first image corresponding to the amplified image, wherein the preset first image is obtained by annotating each end face of the wood in the first amplified image; Based on the first loss, the parameters of the detection and segmentation model are adjusted.

5. The method according to any one of claims 1 to 2, characterized in that, The step of performing target segmentation processing on the initial image to obtain a second segmented image is performed by the end-face segmentation model. The method also includes a training step for the end-face segmentation model. Obtain the sample image of the second end face; The second end face sample image is subjected to image augmentation processing to obtain a second augmented image. The image augmentation processing includes at least one of image rotation, image blurring, adding random noise, image affine transformation and image sharpening. The second amplified image is input into the end face segmentation model to obtain a training second image of the overall edge of the wood end face in the second amplified image; A second loss is determined between the training second image and the preset second image corresponding to the second amplified image, wherein the preset second image is obtained by annotating the overall edges of all wood end faces in the second amplified image; Based on the second loss, the parameters of the end face segmentation model are adjusted.

6. A device for determining the quantity of transported timber, characterized in that, include: The acquisition module is used to acquire initial images of the end faces of all the timber in the transport vehicle; The target segmentation module is used to perform target segmentation processing on the initial image to obtain a first segmentation image and a second segmentation image, respectively. The first segmentation image contains each end face of the wood, and the second segmentation image contains the overall edges of all end faces of the wood. The first segmentation image and the second segmentation image are mask images. A first determining module is configured to determine the amount of wood compensation based on the difference between the first segmented image and the second segmented image, including: acquiring a difference image between the first segmented image and the second segmented image; using the difference image as the image to be filled, wherein the difference image represents the difference map between the mask image corresponding to the second segmented image and the mask image corresponding to the first segmented image; filling the non-zero regions in the image to be filled using a filling region of a target size, and determining the number of successful fillings; using the number of successful fillings as the compensation amount; wherein using the number of successful fillings as the compensation amount includes: for each filling, performing the following steps: acquiring the number of overlapping pixels between the filling region and the non-zero region; in response to the number of overlapping pixels being equal to the total number of pixels contained in the filling region, determining that this filling is a successful filling; The second determining module is used to take the sum of the compensation quantity and the quantity of each timber region contained in the first segmented image as the total number of timbers transported in the transport vehicle, wherein the end face edge of each timber in the first segmented image constitutes a timber region.

7. An electronic device, characterized in that, include: A memory and a processor, wherein the memory stores program instructions, and the processor retrieves the program instructions from the memory to execute the method for determining the quantity of transported timber as described in any one of claims 1-5.

8. A computer-readable storage medium, characterized in that, include: The system contains a program file that, when executed by a processor, is used to implement the method for determining the quantity of transported timber as described in any one of claims 1-5.

Citation Information

Patent Citations

  • Wood counting method based on contour optimization

    CN106023137A

  • ArUco code-based whole-vehicle wood measuring scale system and method thereof

    CN114202589A