Resin boundary detection model training method and resin boundary detection method

By introducing a multi-scale convolutional attention module into the YOLOv8 model, a resin boundary line detection model is constructed, which solves the problem of resin interface recognition technology being disturbed by the external environment, and achieves high-precision and fast resin boundary detection.

CN120107714APending Publication Date: 2025-06-06GUONENG GUANGTOU BEIHAI POWER GENERATION CO LTD +1
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202510062089.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-15
Publication Date
2025-06-06

AI Technical Summary

Technical Problem

Resin interface recognition technology is affected by the external environment, which affects the accuracy and reliability of resin boundary line detection.

Method used

The multi-scale convolutional attention module is used to introduce the YOLOv8 model to build a resin boundary detection model, and through the division and loss function optimization of the training set, verification set and test set, the model's anti-interference ability and detection accuracy are improved.

Benefits of technology

Realize high-precision resin boundary detection in various complex backgrounds, effectively overcome the influence of random interference and improve the accuracy and speed of detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120107714A_ABST
    Figure CN120107714A_ABST
Patent Text Reader

Abstract

The invention relates to the field of resin boundary detection, and provides a training method of a resin boundary detection model and a resin boundary detection method. According to the method, the trained resin boundary detection model can achieve high-precision resin boundary detection under various complex backgrounds, meanwhile, the high processing speed is kept, the YOLOv8 model is improved by introducing a multi-scale convolution attention module into the YOLOv8 model, the resin boundary detection model can effectively overcome the influence of random interference, and the detection accuracy of the resin boundary is improved. The anti-interference capability and the detection accuracy are effectively improved, the method is more suitable for processing a resin boundary detection task, a visual detection system can be helped to complete analysis of a target scene in various environments, and detection personnel can be helped to complete identification and positioning of the resin boundary to the greatest extent.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the technical field of resin boundary line detection, and in particular to a training method for a resin boundary line detection model and a resin boundary line detection method. Background Art

[0002] In order to improve the operation and regeneration level of the condensate polishing system and avoid the influence of large errors caused by manual intervention, most of the existing power plants use intelligent monitoring equipment to replace some manual operations and inspections to achieve intelligent control of the condensate polishing system. This type of intelligent monitoring equipment usually filters the non-analyzed area in the resin image through pre-processing and region of interest (ROI), and performs image enhancement processing by changing the grayscale of each pixel in the image to improve the image contrast, thereby realizing the detection of the resin boundary line.

[0003] However, in actual application, the resin interface recognition technology is subject to much interference from the external environment. Different regeneration system control devices are located in different external environments, which makes the position, illumination, and angle of the external light source affect the resin image acquisition effect. In addition, the material of the mirror directly affects the accuracy of the image recognition technology, and fluorescent lamps or natural light sources may cause pseudo light sources to appear at the resin interface, seriously affecting the recognition effect. Therefore, how to overcome the influence of random interference on the detection of resin boundary lines has become an urgent problem to be solved in this field. Summary of the invention

[0004] The present disclosure aims to solve at least one of the problems existing in the prior art and provides a training method for a resin boundary line detection model and a resin boundary line detection method.

[0005] In one aspect of the present disclosure, a method for training a resin boundary line detection model is provided, the training method comprising:

[0006] Acquire multiple resin images under various environments, including different lighting conditions, different angles, and including resin boundary lines;

[0007] Preprocessing each of the resin images, and marking the position of the resin boundary line in each of the resin images to obtain a corresponding annotated image containing a boundary line label, and constructing a data set;

[0008] Dividing the data set into a training set, a validation set, and a test set according to a preset ratio;

[0009] The multi-scale convolutional attention module is introduced into the YOLOv8 model to build a resin boundary detection model;

[0010] Training step: using the training set to train the resin boundary line detection model, and using the validation set to validate it, using a preset loss function to calculate the training loss and validation loss corresponding to each training and validation, respectively, and back-propagating to update the parameters of the resin boundary line detection model, and judging whether the training loss and the validation loss converge;

[0011] If the training loss and the validation loss do not converge, the hyperparameters of the resin boundary line detection model are adjusted and the training step is returned to; if the training loss and the validation loss converge, the trained resin boundary line detection model is evaluated using the test set.

[0012] Optionally, the multi-scale convolutional attention module includes a multi-scale feature extraction module and a convolutional attention module; wherein,

[0013] The multi-scale feature extraction module is used to perform convolution operations on the same input feature map in parallel using parallel convolution kernels of different sizes, and fuse the outputs of the convolution kernels to output a comprehensive feature map;

[0014] The convolutional attention module includes a channel attention submodule and a spatial attention submodule; the channel attention submodule is used to perform feature weighted processing on the comprehensive feature map in the channel dimension based on the channel attention mechanism; the spatial attention submodule is used to perform feature weighted processing on the feature map output by the channel attention submodule in the spatial dimension based on the spatial attention mechanism.

[0015] Optionally, the calculation formula of the channel attention mechanism is:

[0016] M c (F 1 )=f(MLP(AvgPool(F 1 ))+MLP(MaxPool(F 1 )));

[0017] Among them, M c represents the channel attention mechanism, F 1 represents the comprehensive feature map output by the multi-scale feature extraction module, f represents an activation function, MLP represents a fully connected layer network, AvgPool represents an average pooling operation, and MaxPool represents a maximum pooling operation;

[0018] The calculation formula of the spatial attention mechanism is:

[0019] M s (F) = f(conv 7×7 ([F 1 avg , F 1max ]));

[0020] Among them, M s represents the spatial attention mechanism, F represents the feature map output by the channel attention submodule, conv 7×7 Indicates the convolution operation with a convolution kernel of 7×7, F 1 avg Indicates F 1 The feature map obtained by the average pooling operation, F 1 max Indicates F 1 The feature map obtained by performing the maximum pooling operation.

[0021] Optionally, the multi-scale convolutional attention module is introduced into the YOLOv8 model to construct a resin boundary detection model, including:

[0022] The multi-scale convolutional attention module is added to the backbone of the Backbone structure of the YOLOv8 model to construct the resin boundary line detection model.

[0023] Optionally, the multi-scale convolutional attention module is added to the backbone of the Backbone structure of the YOLOv8 model to construct the resin boundary detection model, including:

[0024] After adding the multi-scale convolutional attention module to the C2f module in the Backbone structure of the YOLOv8 model, the resin boundary line detection model is constructed.

[0025] Optionally, the preset loss function is expressed as:

[0026] L=λ 1 ·L class +λ 2 ·L loc +λ 3 ·L cof ;

[0027] Wherein, L represents the preset loss function, λ 1 , 2 , 3 L class , L loc , L cof The weight coefficient, L class represents the classification loss, L loc represents the positioning loss, L cof Represents the confidence loss.

[0028] Optionally, the classification loss L class It is expressed as:

[0029]

[0030] Where i = 1, 2, ..., N represents the sample number, N represents the total number of samples, y i represents the true label of the i-th sample, represents the predicted label of the resin boundary detection model for the i-th sample;

[0031] Positioning loss L loc It is expressed as:

[0032] Among them, smoth L1 represents a smooth function, t i represents the bounding box coordinates of the true label of the i-th sample, represents the bounding box prediction coordinates of the predicted label of the resin boundary line detection model for the i-th sample;

[0033] Confidence loss L cof It is expressed as:

[0034]

[0035] Among them, c i Indicates the true confidence of the existence of the target corresponding to the i-th sample, Indicates the predicted confidence of the existence of the target corresponding to the i-th sample.

[0036] Another aspect of the present disclosure provides a resin boundary line detection method, the resin boundary line detection method comprising:

[0037] Acquire an image of the resin to be detected;

[0038] The resin image to be detected is input into a trained resin boundary line detection model to obtain a corresponding resin boundary line detection result; wherein the resin boundary line detection model is trained using the training method of the resin boundary line detection model described above.

[0039] Another aspect of the present disclosure provides a training device for a resin boundary line detection model, the training device comprising:

[0040] An acquisition module, used to acquire multiple resin images under various environments including different lighting conditions, different angles and including resin boundary lines;

[0041] A preprocessing module, used to preprocess each of the resin images and mark the position of the resin boundary line in each of the resin images to obtain a corresponding marked image containing a boundary line label and construct a data set;

[0042] A partitioning module, used to divide the data set into a training set, a validation set, and a test set according to a preset ratio;

[0043] A construction module is used to introduce the multi-scale convolutional attention module into the YOLOv8 model and build a resin boundary detection model;

[0044] A training module, used to perform a training step: train the resin boundary line detection model using the training set, and verify it using the verification set, calculate the training loss and verification loss corresponding to each training and verification respectively using a preset loss function, and reversely transfer and update the parameters of the resin boundary line detection model, and determine whether the training loss and the verification loss converge;

[0045] An evaluation module is used to adjust the hyperparameters of the resin boundary line detection model when the training loss and the validation loss do not converge, and start the training module to re-execute the training step; when the training loss and the validation loss converge, use the test set to evaluate the trained resin boundary line detection model.

[0046] Another aspect of the present disclosure provides a resin boundary line detection device, the resin boundary line detection device comprising:

[0047] An image acquisition module, used for acquiring an image of the resin to be detected;

[0048] The detection module is used to input the resin image to be detected into a trained resin boundary line detection model to obtain a corresponding resin boundary line detection result; wherein the resin boundary line detection model is trained using the training method of the resin boundary line detection model described above.

[0049] Compared with the prior art, the present invention utilizes the highly optimized architecture and advanced feature extraction capabilities of the YOLOv8 model, so that the trained resin boundary line detection model can achieve high-precision resin boundary line detection in various complex backgrounds while maintaining a fast processing speed, and improves the YOLOv8 model by introducing a multi-scale convolutional attention module into the YOLOv8 model, so that the resin boundary line detection model can effectively overcome the influence of random interference, and the anti-interference ability and detection accuracy are effectively improved, which is more suitable for processing resin boundary line detection tasks, and can help the visual inspection system to complete the analysis of the target scene in various environments, and help the inspection personnel to complete the identification and positioning of the resin boundary line to the greatest extent. After that, by using the trained resin boundary line detection model to detect the resin boundary line in the resin image to be inspected, the influence of random interference on the resin boundary line detection can be effectively avoided, and the resin boundary line in the resin image to be inspected can be accurately and quickly identified and positioned. BRIEF DESCRIPTION OF THE DRAWINGS

[0050] One or more embodiments are exemplarily described by pictures in the corresponding drawings, and these exemplifications do not constitute limitations on the embodiments. Elements with the same reference numerals in the drawings represent similar elements, and unless otherwise stated, the figures in the drawings do not constitute proportional limitations.

[0051] Figure 1 A flowchart of a method for training a resin boundary line detection model provided in one embodiment of the present disclosure;

[0052] Figure 2 A schematic diagram of the structure of a multi-scale convolutional attention module provided in another embodiment of the present disclosure;

[0053] Figure 3 A schematic structural diagram of a resin boundary line detection model provided by another embodiment of the present disclosure;

[0054] Figure 4 A flowchart of a resin boundary line detection method provided in another embodiment of the present disclosure;

[0055] Figure 5 A schematic flow chart of a resin boundary line detection method provided in another embodiment of the present disclosure;

[0056] Figure 6 A schematic structural diagram of a training device for a resin boundary line detection model provided by another embodiment of the present disclosure;

[0057] Figure 7 A schematic structural diagram of a resin boundary line detection device provided in another embodiment of the present disclosure. DETAILED DESCRIPTION

[0058] In order to make the purpose, technical scheme and advantages of the embodiments of the present disclosure clearer, the embodiments of the present disclosure will be described in detail below in conjunction with the accompanying drawings. However, it can be understood by those skilled in the art that in each embodiment of the present disclosure, many technical details are proposed in order to enable readers to better understand the present disclosure. However, even without these technical details and various changes and modifications based on the following embodiments, the technical scheme claimed for protection in the present disclosure can also be implemented. The division of the following embodiments is for the convenience of description and should not constitute any limitation on the specific implementation of the present disclosure. The various embodiments can be combined and referenced with each other without contradiction.

[0059] One embodiment of the present disclosure relates to a method for training a resin boundary line detection model, the process of which is as follows: Figure 1 As shown, it includes steps S110 to S160.

[0060] Step S110 , acquiring a plurality of resin images under various environments including different lighting conditions, different angles and including resin boundary lines.

[0061] Specifically, step S110 can first collect multiple resin images with different lighting conditions and angles from the actual environment as original images, then screen out resin images with obvious boundary features from the original images, and delete resin images with more impurities, unclear features, or overly complex and messy features, to ensure that the resin boundary lines in each resin image finally retained are clearly visible.

[0062] Step S120 , preprocessing each resin image, and marking the position of the resin boundary line in each resin image, obtaining a corresponding labeled image containing a boundary line label, and constructing a data set.

[0063] Specifically, each resin image is preprocessed mainly to standardize the image size and enhance the visibility of the resin boundary line to improve the image quality and thus improve the model training effect.

[0064] Preprocessing operations may include but are not limited to cropping, scaling, rotation, translation, color adjustment, etc. Among them, cropping mainly removes irrelevant areas in the resin image and only retains the resin boundary line and related areas in the image. Scaling mainly scales all resin images to a uniform resolution and randomly scales the size of the resin image to simulate resin boundary line detection at different distances. Rotation mainly randomly rotates the image at a certain angle to simulate resin boundary line detection at different angles. Translation mainly randomly translates the image a certain distance to simulate resin boundary line detection at different positions. Color adjustment mainly randomly adjusts the color of the resin image to simulate resin boundary line detection under different colors.

[0065] For example, step S120 can use the labeling tool LabelImg to label the position of the resin boundary line in each resin image, determine the bounding box of each resin boundary line, so that each part of the resin boundary line in each resin image is accurately marked, so that the resin boundary line detection model can learn the accurate representation of the resin boundary line during the training process.

[0066] After obtaining the annotated images corresponding to each resin image, each annotated image can constitute a data set for training.

[0067] Step S130, dividing the data set into a training set, a validation set, and a test set according to a preset ratio.

[0068] Specifically, in order to better train the resin boundary line detection model and test the trained resin boundary line detection model, this embodiment divides the constructed data set into a training set, a validation set and a test set according to a preset ratio. Among them, the preset ratio can be set according to actual needs. For example, the preset ratio can be set to 7:2:1. At this time, the training set contains 70% of the annotated images in the data set, which are used for learning and parameter adjustment of the resin boundary line detection model. The validation set contains 20% of the annotated images in the data set, which are used to evaluate the model performance, adjust the model's hyperparameters, and select a suitable model architecture during the training process. The test set contains 10% of the annotated images in the data set, which is used for the final evaluation of the trained resin boundary line detection model.

[0069] It should be noted that before dividing the data set into training set, validation set, and test set, the data set needs to be randomly shuffled to ensure that the samples in the training set, validation set, and test set are randomly distributed to reduce the deviation caused by uneven data distribution.

[0070] Step S140, introducing a multi-scale convolutional attention module into the YOLOv8 model to construct a resin boundary detection model.

[0071] Specifically, since the resin boundary line is a small type target, in order to better obtain the image features and information around the resin boundary line, this embodiment designs a new attention mechanism network, namely the multi-scale convolutional block attention module (MS-CBAM), and introduces the multi-scale convolutional attention module into the YOLOv8 model, thereby improving the existing YOLOv8 model, and uses the improved YOLOv8 model, namely the YOLOv8 model that introduces the multi-scale convolutional attention module, as a resin boundary line detection model.

[0072] Exemplarily, the multi-scale convolutional attention module uses two stages to extract image features, the first stage is the multi-scale feature extraction stage, and the second stage is the convolutional attention mechanism stage. In other words, Figure 2 As shown, the multi-scale convolutional attention module includes a multi-scale feature extraction module and a convolutional attention module.

[0073] Among them, the multi-scale feature extraction module mainly obtains more extensive contextual information through multi-scale feature extraction. Specifically, it is used to use parallel convolution kernels of different sizes to perform convolution operations on the same input feature map in parallel, and fuse the outputs of each convolution kernel to output a comprehensive feature map.

[0074] For example, combining Figure 2, convolution kernels of different sizes can include small-sized convolution kernels (such as 3×3) and large-sized convolution kernels (such as 5×5 and 7×7). Among them, the small-sized convolution kernel is used to capture the detailed features of the input image, and the large-sized convolution kernel is used to capture more extensive contextual information, so that the comprehensive feature map output by the multi-scale feature extraction module can combine information at multiple scales to provide richer feature representation for subsequent processing.

[0075] like Figure 2 As shown in the figure, the convolutional attention module combines channel attention and spatial attention, including a channel attention submodule and a spatial attention submodule, which can simultaneously focus on the channel correlation and important positions in space of the feature map. By setting the channel attention submodule and the spatial attention submodule in the convolutional attention module, the convolutional attention module can simultaneously consider the relationship between channels and the relationship between spaces, thereby improving the perception of important features of the resin boundary detection model.

[0076] Among them, the channel attention submodule is specifically used to perform feature weighting processing on the comprehensive feature map in the channel dimension based on the channel attention mechanism. The channel attention submodule emphasizes the channels that are important for target detection, which helps the resin boundary detection model focus on the most informative features. Therefore, the calculation formula of the channel attention mechanism can be expressed as:

[0077] M c (F 1 )=f(MLP(AvgPool(F 1 ))+MLP(MaxPool(F 1 ))).

[0078] Among them, M c represents the channel attention mechanism. 1 represents the comprehensive feature map output by the multi-scale feature extraction module. f represents the activation function. MLP represents the fully connected layer network. AvgPool represents the average pooling operation. MaxPool represents the maximum pooling operation. By using the channel attention mechanism to 1 After processing, we can get the feature maps F output by the average pooling operation AvgPool and the maximum pooling operation MaxPool respectively. 1 avg 、F 1 max .

[0079] The spatial attention submodule is specifically used to perform feature weighting processing on the feature map output by the channel attention submodule in the spatial dimension based on the spatial attention mechanism. The spatial attention submodule further emphasizes the areas in the image that are important for target detection, so that the resin boundary detection model can focus more on these areas. Therefore, the calculation formula of the spatial attention mechanism can be expressed as:

[0080] M s (F) = f(conv 7×7 ([F 1 avg , F 1 max ])).

[0081] Among them, M s represents the spatial attention mechanism. F represents the feature map output by the channel attention submodule. 7×7 Indicates a convolution operation with a convolution kernel of 7×7. 1 avg Indicates F 1 The feature map obtained by average pooling operation. 1 max Indicates F 1 The feature map obtained by the maximum pooling operation. After the feature map is processed by the channel attention mechanism, it is further processed by the spatial attention mechanism to better focus on the feature information in the image.

[0082] Exemplarily, step S140 includes: adding a multi-scale convolutional attention module to the backbone of the Backbone structure of the YOLOv8 model to construct a resin boundary line detection model.

[0083] Specifically, by adding the multi-scale convolutional attention module to the backbone of the Backbone structure of the YOLOv8 model, the aggregation of features can be effectively enhanced, the target recognition ability of the resin boundary line detection model for the resin boundary line can be improved, and missed detection can be reduced.

[0084] Exemplarily, a multi-scale convolutional attention module is added to the backbone of the Backbone structure of the YOLOv8 model to construct a resin boundary line detection model, including: adding the multi-scale convolutional attention module to the C2f module in the Backbone structure of the YOLOv8 model to construct a resin boundary line detection model.

[0085] Specifically, combined with Figure 3, the YOLOv8 model usually includes Backbone structure, Neck structure, and Head structure. Among them, the Backbone structure usually includes CBS module, C2f module, and SPPF module. The Neck structure usually includes Concat module, Upsample module, C2f module, and CBS module. The Head structure usually includes Detect module.

[0086] In order to further improve the target recognition ability of the resin boundary detection model, the inventors of the present disclosure added multi-scale convolutional attention modules to different positions in the Backbone structure of the YOLOv8 model to test the model performance. Through the test, it was found that Figure 3 As shown in the figure, when the multi-scale convolutional attention module, i.e., MS-CBAM, is added to the C2f module in the Backbone structure of the YOLOv8 model, the target recognition ability of the resin boundary detection model is the strongest.

[0087] Step S150, training step: use the training set to train the resin boundary line detection model, and use the verification set to verify it, use the preset loss function to calculate the training loss and verification loss corresponding to each training and verification, and reversely transfer the parameters of the updated resin boundary line detection model to determine whether the training loss and verification loss converge.

[0088] Specifically, in order to better train the resin boundary line detection model, this embodiment designs a combined loss function as the loss function for each training and corresponding verification, and the preset loss function is expressed as:

[0089] L=λ 1 ·L class +λ 2 ·L loc +λ 3 ·L cof .

[0090] Where L represents the preset loss function. 1 , 2 , 3 L class , L loc , L cof The weight coefficient is used to balance the impact of different types of losses. class Represents the classification loss, which is mainly used to ensure that the resin boundary detection model can correctly classify the detected objects, and can help the resin boundary detection model accurately distinguish the resin boundary and other possible objects or backgrounds. locIt represents the positioning loss, which is mainly used to ensure that the resin boundary line detection model can accurately determine the position and size of the target object, i.e., the resin boundary line, so as to better predict the coordinates of the bounding box corresponding to the resin boundary line. cof Represents the confidence loss, which is mainly used to evaluate the confidence of the resin boundary line detection model on whether each object it detects actually exists, and helps the resin boundary line detection model distinguish between the background and the actual target object, namely the resin boundary line.

[0091] For example, the classification loss L class It is expressed as:

[0092]

[0093] Where i = 1, 2, ..., N represents the sample number, N represents the total number of samples, y i represents the true label of the i-th sample, Represents the predicted label of the resin boundary detection model for the i-th sample.

[0094] Positioning loss L loc It is expressed as:

[0095] Among them, smooth L1 represents a smooth function, t i represents the bounding box coordinates of the true label of the i-th sample, Represents the bounding box prediction coordinates of the predicted label of the resin boundary detection model for the i-th sample.

[0096] Confidence loss L cof It is expressed as:

[0097]

[0098] Among them, c i Indicates the true confidence of the existence of the target corresponding to the i-th sample, Indicates the predicted confidence of the existence of the target corresponding to the i-th sample.

[0099] The above three losses, namely classification loss, positioning loss, and confidence loss, work together in the training process of the resin boundary line detection model to ensure that the resin boundary line detection model can not only accurately identify and classify the target object, namely the resin boundary line, but also accurately locate the object and judge the credibility of its existence. During the training process, by optimizing the loss function containing the above three losses, the resin boundary line detection model can show higher accuracy and robustness in processing complex actual scenes.

[0100] For example, when the resin boundary line detection model is trained using the training set, step S150 can set training parameters such as initial learning rate, batch size, training cycle (epoch) iteration number, etc. according to actual needs, and adopt the random gradient descent strategy for random decay. In each training cycle, step S150 can divide the labeled images in the training set into multiple batches for processing. For each batch of labeled images, the forward propagation of the resin boundary line detection model is first performed, the predicted output of the resin boundary line detection model is calculated, and the predicted label is obtained, and then the loss between the predicted label and the true label is calculated, and finally the gradient of the loss is calculated by the back propagation algorithm, and the parameters of the resin boundary line detection model are updated according to the gradient using the optimizer.

[0101] Step S160: If the training loss and the validation loss do not converge, the hyperparameters of the resin boundary line detection model are adjusted and the training step is returned; if the training loss and the validation loss converge, the trained resin boundary line detection model is evaluated using the test set.

[0102] Specifically, step S160 can regularly record the training loss and validation loss of the resin boundary line detection model after each training cycle, and use the visualization tool TensorBoard to observe the changing trend of the training loss and validation loss over time. If the training loss and validation loss do not converge, the hyperparameters of the resin boundary line detection model such as learning rate, batch size, regularization parameter, etc. are adjusted, and then the resin boundary line detection model is retrained using the training step. If the training loss and validation loss converge, the trained resin boundary line detection model is finally evaluated using the test set to obtain the final resin boundary line detection model.

[0103] Compared with the prior art, the training method of the resin boundary line detection model provided in the embodiment of the present invention utilizes the highly optimized architecture and advanced feature extraction capabilities of the YOLOv8 model, so that the trained resin boundary line detection model can achieve high-precision resin boundary line detection in various complex backgrounds while maintaining a fast processing speed. The YOLOv8 model is improved by introducing a multi-scale convolutional attention module into the YOLOv8 model, so that the resin boundary line detection model can effectively overcome the influence of random interference, and the anti-interference ability and detection accuracy are effectively improved. It is more suitable for processing resin boundary line detection tasks, and can help the visual inspection system to complete the analysis of the target scene in various environments, and help the inspection personnel to complete the identification and positioning of the resin boundary to the greatest extent.

[0104] Another embodiment of the present disclosure relates to a resin boundary line detection method, the process of which is as follows: Figure 4 As shown, it includes step S410 and step S420.

[0105] Step S410, obtaining an image of the resin to be inspected.

[0106] Specifically, the resin image to be detected refers to a resin image that needs to be tested for resin boundary line detection. The resin image to be detected can be acquired from an actual environment or from a storage device storing resin images, and this embodiment does not limit this.

[0107] Step S420, input the resin image to be detected into the trained resin boundary line detection model to obtain the corresponding resin boundary line detection result. The resin boundary line detection model is trained using the training method of the resin boundary line detection model described in the above embodiment.

[0108] Compared with the prior art, the resin boundary line detection method provided in the embodiment of the present disclosure can effectively avoid the influence of random interference on the resin boundary line detection by using a trained resin boundary line detection model to detect the resin boundary line in the resin image to be detected, and accurately and quickly identify and locate the resin boundary line in the resin image to be detected.

[0109] In order to enable those skilled in the art to better understand the above implementation, a specific example is used as an example for description below.

[0110] Combined Figure 5 A resin boundary line detection method includes a model training part and a real-time detection part, specifically including the following steps:

[0111] Collect original images and perform preprocessing: 11,713 resin images with different lighting conditions and angles and containing resin boundary lines were collected as the collected original images. Resin images with obvious boundary line features were screened out from the original images, and resin images with more impurities, unclear features, or overly complex and messy features were deleted. Finally, a total of 10,000 valid resin images were obtained. The 10,000 valid resin images were preprocessed by cropping, scaling, rotating, translating, and color adjustment, and the preprocessed resin images were annotated using LabelImg annotation software to ensure that each part of the resin boundary line in the resin image was accurately marked, and annotated images containing resin boundary line labels of different shapes were obtained. Each annotated image was organized into a data set S for training.

[0112] Shuffle the data and divide the dataset into 7:2:1 ratio: pre-shuffle the dataset randomly, and divide the randomly shuffled dataset into training set, validation set, and test set in a ratio of 7:2:1. The training set contains 70% of the annotated images in the dataset, which is used for learning and parameter adjustment of the resin boundary line detection model. The validation set contains 20% of the annotated images in the dataset, which is used to evaluate model performance, adjust model hyperparameters, and select appropriate model architecture during training. The test set contains 10% of the annotated images in the dataset, which is used for the final evaluation of the trained resin boundary line detection model.

[0113] Improve the YOLOv8 model: Figure 2 The multi-scale convolutional attention module shown is introduced into the YOLOv8 model, as shown in Figure 3 As shown in the figure, after adding the multi-scale convolutional attention module to the C2f module in the Backbone structure of the YOLOv8 model, a resin boundary line detection model is constructed.

[0114] Use the improved YOLOv8 model for training: Use the training set to train the resin boundary line detection model, and use the validation set to verify it. Use the preset loss function L to calculate the training loss and validation loss corresponding to each training and validation, and back-propagate to update the parameters of the resin boundary line detection model to determine whether the training loss and validation loss converge. If the training loss and validation loss do not converge, adjust the hyperparameters of the resin boundary line detection model and continue to train the resin boundary line detection model. If the training loss and validation loss converge, use the test set to evaluate the trained resin boundary line detection model to obtain the trained resin boundary line detection model.

[0115] Perform real-time detection: obtain the resin image to be detected, input the resin image to be detected into the trained resin boundary line detection model, and obtain the corresponding resin boundary line detection result.

[0116] Another embodiment of the present disclosure relates to a training device for a resin boundary line detection model, such as Figure 6 As shown, it includes an acquisition module 610, a preprocessing module 620, a division module 630, a construction module 640, a training module 650, and an evaluation module 660.

[0117] The acquisition module 610 is used to acquire multiple resin images under various environments including different lighting conditions, different angles and including resin boundary lines.

[0118] The preprocessing module 620 is used to preprocess each resin image and mark the position of the resin boundary line in each resin image to obtain a corresponding labeled image containing the boundary line label and construct a data set.

[0119] The partitioning module 630 is used to partition the data set into a training set, a validation set, and a test set according to a preset ratio.

[0120] The construction module 640 is used to introduce the multi-scale convolutional attention module into the YOLOv8 model to build a resin boundary detection model.

[0121] The training module 650 is used to execute the training steps: train the resin boundary line detection model using the training set, and verify it using the verification set, use the preset loss function to calculate the training loss and verification loss corresponding to each training and verification, and reversely transfer the updated parameters of the resin boundary line detection model to determine whether the training loss and verification loss converge.

[0122] The evaluation module 660 is used to adjust the hyperparameters of the resin boundary line detection model when the training loss and the validation loss do not converge, and start the training module to re-execute the training steps; when the training loss and the validation loss converge, the trained resin boundary line detection model is evaluated using the test set.

[0123] The specific implementation method of the training device of the resin boundary line detection model provided in the embodiment of the present disclosure can be found in the training method of the resin boundary line detection model provided in the embodiment of the present disclosure, and will not be repeated here.

[0124] Compared with the prior art, the training device for the resin boundary line detection model provided in the embodiment of the present invention utilizes the highly optimized architecture and advanced feature extraction capabilities of the YOLOv8 model, so that the trained resin boundary line detection model can achieve high-precision resin boundary line detection in various complex backgrounds while maintaining a fast processing speed. The YOLOv8 model is improved by introducing a multi-scale convolutional attention module into the YOLOv8 model, thereby further improving the anti-interference ability and detection accuracy of the resin boundary line detection model, making the resin boundary line detection model more suitable for processing resin boundary line detection tasks, and further enabling the trained resin boundary line detection model to help the visual inspection system complete the analysis of the target scene in various environments, thereby helping the inspection personnel to complete the identification and positioning of the resin boundary to the greatest extent.

[0125] Another embodiment of the present disclosure relates to a resin boundary line detection device, such as Figure 7 As shown, it includes an image acquisition module 710 and a detection module 720.

[0126] The image acquisition module 710 is used to acquire the image of the resin to be detected.

[0127] The detection module 720 is used to input the resin image to be detected into the trained resin boundary detection model to obtain the corresponding resin boundary detection result. The resin boundary detection model is trained using the training method of the resin boundary detection model described in the above embodiment.

[0128] The specific implementation method of the resin boundary line detection device provided in the embodiment of the present disclosure can refer to the resin boundary line detection method provided in the embodiment of the present disclosure, which will not be repeated here.

[0129] Compared with the prior art, the resin boundary line detection device provided in the embodiment of the present disclosure can effectively avoid the influence of random interference on the resin boundary line detection by using a trained resin boundary line detection model to detect the resin boundary line in the resin image to be detected, and accurately and quickly identify and locate the resin boundary line in the resin image to be detected.

[0130] Those skilled in the art will appreciate that the above-mentioned embodiments are specific embodiments for implementing the present disclosure, and in actual applications, various changes may be made thereto in form and detail without departing from the spirit and scope of the present disclosure.

Claims

1. A training method for a resin boundary detection model, characterized in that: The training method comprises: Acquire multiple resin images under various environments, including different lighting conditions, different angles, and including resin boundary lines; Preprocessing each of the resin images, and marking the position of the resin boundary line in each of the resin images to obtain a corresponding annotated image containing a boundary line label, and constructing a data set; Dividing the data set into a training set, a validation set, and a test set according to a preset ratio; The multi-scale convolutional attention module is introduced into the YOLOv8 model to build a resin boundary detection model; Training step: using the training set to train the resin boundary line detection model, and using the validation set to validate it, using a preset loss function to calculate the training loss and validation loss corresponding to each training and validation, respectively, and back-propagating to update the parameters of the resin boundary line detection model, and judging whether the training loss and the validation loss converge; If the training loss and the validation loss do not converge, the hyperparameters of the resin boundary line detection model are adjusted and the training step is returned to; if the training loss and the validation loss converge, the trained resin boundary line detection model is evaluated using the test set.

2. The training method according to claim 1, characterized in that: The multi-scale convolutional attention module includes a multi-scale feature extraction module and a convolutional attention module; wherein, The multi-scale feature extraction module is used to perform convolution operations on the same input feature map in parallel using parallel convolution kernels of different sizes, and fuse the outputs of the convolution kernels to output a comprehensive feature map; The convolutional attention module includes a channel attention submodule and a spatial attention submodule; the channel attention submodule is used to perform feature weighted processing on the comprehensive feature map in the channel dimension based on the channel attention mechanism; the spatial attention submodule is used to perform feature weighted processing on the feature map output by the channel attention submodule in the spatial dimension based on the spatial attention mechanism.

3. The training method according to claim 2, characterized in that: The calculation formula of the channel attention mechanism is: M c (F1)=f(MLP(AvgPool(F1))+MLP(MaxPool(F1))); Among them, M c represents the channel attention mechanism, F1 represents the comprehensive feature map output by the multi-scale feature extraction module, f represents an activation function, MLP represents a fully connected layer network, AvgPool represents an average pooling operation, and MaxPool represents a maximum pooling operation; The calculation formula of the spatial attention mechanism is: Among them, M s represents the spatial attention mechanism, F represents the feature map output by the channel attention submodule, conv 7×7 Indicates a convolution operation with a convolution kernel of 7×7, F1 avg Represents the feature map obtained by average pooling operation on F1, F1 max Represents the feature map obtained by performing the maximum pooling operation on F1.

4. The training method according to any one of claims 1 to 3, characterized in that: The multi-scale convolutional attention module is introduced into the YOLOv8 model to construct a resin boundary detection model, including: The multi-scale convolutional attention module is added to the backbone of the Backbone structure of the YOLOv8 model to construct the resin boundary line detection model.

5. The training method according to claim 4, characterized in that: The multi-scale convolutional attention module is added to the backbone of the Backbone structure of the YOLOv8 model to construct the resin boundary detection model, including: After adding the multi-scale convolutional attention module to the C2f module in the Backbone structure of the YOLOv8 model, the resin boundary line detection model is constructed.

6. The training method according to claim 5, characterized in that: The preset loss function is expressed as: L=λ1·L class +λ2·L loc +λ3·L cof ; Wherein, L represents the preset loss function, λ1, λ2, and λ3 are L class , L loc , L cof The weight coefficient, L class represents the classification loss, L loc represents the positioning loss, L cof Represents the confidence loss.

7. The training method according to claim 6, characterized in that: Classification loss L class It is expressed as: Where i = 1, 2, ..., N represents the sample number, N represents the total number of samples, y i represents the true label of the i-th sample, represents the predicted label of the resin boundary detection model for the i-th sample; Positioning loss L loc It is expressed as: Among them, smooth L1 represents a smooth function, t i represents the bounding box coordinates of the true label of the i-th sample, represents the bounding box prediction coordinates of the predicted label of the resin boundary line detection model for the i-th sample; Confidence loss L cof It is expressed as: Among them, c i Indicates the true confidence of the existence of the target corresponding to the i-th sample, Indicates the predicted confidence of the existence of the target corresponding to the i-th sample.

8. A resin boundary line detection method, characterized in that: The resin boundary line detection method comprises: Acquire an image of the resin to be detected; The resin image to be detected is input into a trained resin boundary line detection model to obtain a corresponding resin boundary line detection result; wherein the resin boundary line detection model is trained using the training method of the resin boundary line detection model described in any one of claims 1 to 7.

9. A training device for a resin boundary line detection model, characterized in that: The training device comprises: An acquisition module, used to acquire multiple resin images under various environments including different lighting conditions, different angles and including resin boundary lines; A preprocessing module, used to preprocess each of the resin images and mark the position of the resin boundary line in each of the resin images to obtain a corresponding marked image containing a boundary line label and construct a data set; A partitioning module, used to divide the data set into a training set, a validation set, and a test set according to a preset ratio; A construction module is used to introduce the multi-scale convolutional attention module into the YOLOv8 model and build a resin boundary detection model; A training module, used to perform a training step: train the resin boundary line detection model using the training set, and verify it using the verification set, calculate the training loss and verification loss corresponding to each training and verification respectively using a preset loss function, and reversely transfer and update the parameters of the resin boundary line detection model, and determine whether the training loss and the verification loss converge; An evaluation module is used to adjust the hyperparameters of the resin boundary line detection model when the training loss and the validation loss do not converge, and start the training module to re-execute the training step; when the training loss and the validation loss converge, use the test set to evaluate the trained resin boundary line detection model.

10. A resin boundary line detection device, characterized in that: The resin boundary line detection device comprises: An image acquisition module, used for acquiring an image of the resin to be detected; A detection module is used to input the resin image to be detected into a trained resin boundary line detection model to obtain a corresponding resin boundary line detection result; wherein the resin boundary line detection model is trained using the training method of the resin boundary line detection model described in any one of claims 1 to 7.

Citation Information

Patent Citations

  • Improved YOLOv8 unmanned aerial vehicle aerial target detection method

    CN117557922A

  • Resin interface robust detection method and system based on image processing

    CN117994239A

  • Condensate polishing resin regeneration layering state identification method and system

    CN118734121A

  • Dry-type transformer epoxy resin surface crack identification method

    CN119125138A

  • Marine organism detection method, device and equipment and storage medium

    CN119274205A