An engine cylinder liner defect detection method and system based on improved YOLOv11

CN122617809APending Publication Date: 2026-08-21山东电子职业技术学院
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610768303.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-05-30
Publication Date
2026-08-21

AI Technical Summary

Technical Problem

[0005]基于此,有必要针对上述技术问题,提供一种能够有效消除发动机缸套曲面引起的缺陷形状畸变,增强微小缺陷特征响应,提升缺陷检测精度和效率,解决多视角图像特征融合不足、漏检误检率较高等问题,适配工业实际检测场景的基于改进YOLOv11的发动机缸套缺陷检测方法及系统

Benefits of technology

[0016]The aforementioned engine cylinder liner defect detection method and system based on the improved YOLOv11 can effectively solve the technical problems existing in the background technology, such as low defect detection accuracy, missed detection of small defects, surface distortion affecting the detection effect, and insufficient model generalization ability. Multi-view dual-state image acquisition and cylindrical projection correction can eliminate defect shape distortion caused by cylinder liner curved surfaces. Combined with data augmentation and contrastive learning sample set construction, the diversity and effectiveness of the dataset are improved, laying a solid data foundation for accurate detection. Spectral adaptive channel attention modules are embedded in multiple feature levels of the YOLOv11 backbone network. A multi-level collaborative channel attention pyramid is constructed through gated cross-scale connections, which can adaptively enhance the channel responses of features related to minor defects, achieving efficient fusion of high and low-level features and effectively solving the problems of missed detection of minor defects and insufficient feature extraction. Based on the augmented sample set, the target detection loss and supervised contrast loss are calculated and weighted, and the model is trained using an early stopping mechanism, balancing detection accuracy and model generalization ability, avoiding overfitting and shortening the training cycle. Single-view image inference and candidate box deduplication design are adapted to actual industrial detection scenarios, improving detection efficiency while ensuring detection accuracy, reducing false detection and false detection rates, and providing a reliable and efficient technical solution for engine cylinder liner surface defect detection, with high engineering application value.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122617809A_ABST
    Figure CN122617809A_ABST
Patent Text Reader

Abstract

The application relates to an engine cylinder liner defect detection method and system based on improved YOLOv11. The method comprises the following steps: acquiring multi-view bright field and dark field images of an engine cylinder liner and labeling, performing cylindrical surface projection correction after data set construction; constructing positive and negative sample pairs and simultaneously performing data enhancement; inserting a frequency spectrum self-adaptive channel attention module into each feature layer of a YOLOv11 backbone network, establishing a gate cross-scale connection to construct a basic model, fusing middle layer features and low layer features, and generating an initial cylinder liner surface defect detection model; loading pre-training weights, training the model in combination with a joint loss, and adopting an early stopping strategy to obtain an engine cylinder liner surface defect detection model; inputting a to-be-detected image into the engine cylinder liner surface defect detection model after pretreatment, performing feature extraction, detection frame decoding and screening, and outputting defect information. The method can improve the micro defect recognition precision and detection efficiency of the engine cylinder liner, enhance the anti-interference capability of the model, and meet actual detection requirements.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of machine vision inspection, and in particular relates to a method and system for detecting engine cylinder liner defects based on an improved YOLOv11. Background Technology

[0002] With the development of machine vision inspection technology, deep learning-based target detection technology has emerged. This technology features high detection efficiency, high degree of automation, and non-contact detection. It eliminates the need for manual contact with the engine cylinder liner surface, effectively avoiding secondary damage to the cylinder liner surface during the inspection process. At the same time, it can achieve rapid identification and location of defects and has been gradually applied to the field of surface defect detection of engine parts.

[0003] In traditional technologies, the detection of defects on the surface of engine cylinder liners is mostly carried out by manual visual inspection or simple machine vision inspection. Manual visual inspection relies on the experience of the inspectors, who observe the surface of the cylinder liner for defects such as bumps and pinholes with the naked eye, while using simple tools such as magnifying glasses to assist in the judgment. Simple machine vision inspection mostly uses traditional image processing algorithms to extract defect features through grayscale threshold segmentation, edge detection and other methods, and then completes the defect identification.

[0004] However, current inspection methods still have many problems: manual visual inspection is not only labor-intensive and inefficient, but also easily affected by the fatigue and experience of the inspectors, resulting in a high rate of missed and false detections, making it difficult to meet the inspection needs of large-scale industrial production; traditional machine vision inspection algorithms have weak ability to identify complex backgrounds and small defects, and have poor adaptability to image distortion caused by cylinder liner curved surfaces, making it impossible to effectively extract weak defect features, resulting in limited detection accuracy and difficulty in adapting to the precise detection needs of various types of defects on the surface of engine cylinder liners. Summary of the Invention

[0005] Based on this, it is necessary to provide an engine cylinder liner defect detection method and system based on the improved YOLOv11 that can effectively eliminate the defect shape distortion caused by the curved surface of the engine cylinder liner, enhance the feature response of small defects, improve the accuracy and efficiency of defect detection, solve the problems of insufficient multi-view image feature fusion and high false detection rate, and adapt to actual industrial testing scenarios.

[0006] Firstly, this application provides a method for detecting engine cylinder liner defects based on an improved YOLOv11, including:

[0007] S1. Obtain bright-field and dark-field images of the engine cylinder liner from multiple angles, and annotate the defects in the bright-field and dark-field images to obtain a multi-view dual-state image dataset; perform cylindrical projection correction on the bright-field and dark-field images in the multi-view dual-state image dataset to obtain a corrected dataset; based on the corrected dataset, construct a multi-view contrast learning sample set with positive and negative sample pairs; perform data augmentation on the multi-view contrast learning sample set to obtain an augmented multi-view contrast learning sample set.

[0008] S2. Using the YOLOv11 network as a baseline, embed spectrum adaptive channel attention modules into multiple feature levels of the backbone network of the YOLOv11 network. Through gated cross-scale connections, the channel attention weights output by the spectrum adaptive channel attention modules corresponding to the higher feature levels are multiplied by the input features of the spectrum adaptive channel attention modules corresponding to the adjacent lower feature levels after convolution and activation. This constructs a multi-level collaborative channel attention pyramid and obtains the initial cylinder liner surface defect detection model.

[0009] S3. Based on the enhanced multi-view contrast learning sample set, calculate the target detection loss and the supervised contrast loss, and perform a weighted summation of the target detection loss and the supervised contrast loss to obtain the joint loss value. Based on the joint loss value, train the initial cylinder liner surface defect detection model through backpropagation, and adopt an early stop mechanism to monitor the preset verification index. When the preset verification index does not improve within the preset evaluation period, stop training and output the engine cylinder liner surface defect detection model.

[0010] S4. Obtain a single-view image of the engine cylinder liner to be detected. Input the single-view image of the engine cylinder liner into the engine cylinder liner surface defect detection model. Extract the defect feature map of the single-view image of the engine cylinder liner through the channel attention pyramid. Parse the candidate detection box, defect category and confidence from the defect feature map. Remove duplicate candidate detection boxes and output the defect category, bounding box and confidence of the engine cylinder liner.

[0011] Secondly, this application also provides an engine cylinder liner defect detection system based on an improved YOLOv11, including:

[0012] The multi-view dual-state image acquisition and preprocessing module is used to acquire bright-field and dark-field images of the engine cylinder liner from multiple angles, annotate defects in the bright-field and dark-field images to obtain a multi-view dual-state image dataset; perform cylindrical projection correction on the bright-field and dark-field images in the multi-view dual-state image dataset to obtain a corrected dataset; based on the corrected dataset, construct a multi-view contrast learning sample set with positive and negative sample pairs; and perform data augmentation on the multi-view contrast learning sample set to obtain an augmented multi-view contrast learning sample set.

[0013] The initial cylinder liner surface defect detection model construction module is used to embed spectrum adaptive channel attention modules into multiple feature levels of the backbone network of the YOLOv11 network as a baseline. Through gated cross-scale connections, the channel attention weights output by the spectrum adaptive channel attention modules corresponding to the higher feature levels are multiplied by the input features of the spectrum adaptive channel attention modules corresponding to the adjacent lower feature levels after convolution and activation, thereby constructing a multi-level collaborative channel attention pyramid to obtain the initial cylinder liner surface defect detection model.

[0014] The model training module is used to calculate the target detection loss and supervised contrast loss based on the enhanced multi-view contrast learning sample set. The target detection loss and supervised contrast loss are weighted and summed to obtain the joint loss value. Based on the joint loss value, the initial cylinder liner surface defect detection model is trained through backpropagation. An early stopping mechanism is adopted to monitor the preset verification index. When the preset verification index does not improve within the preset evaluation period, the training stops and the engine cylinder liner surface defect detection model is output.

[0015] The defect detection inference module is used to acquire a single-view image of the engine cylinder liner to be detected. The single-view image of the engine cylinder liner is input into the engine cylinder liner surface defect detection model. The defect feature map of the single-view image of the engine cylinder liner is extracted through the channel attention pyramid. Candidate detection boxes, defect categories and confidence scores are parsed from the defect feature map. The candidate detection boxes are deduplicated and the defect category, bounding box and confidence score of the engine cylinder liner are output.

[0016] The aforementioned engine cylinder liner defect detection method and system based on the improved YOLOv11 can effectively solve the technical problems existing in the background technology, such as low defect detection accuracy, missed detection of small defects, surface distortion affecting the detection effect, and insufficient model generalization ability. Multi-view dual-state image acquisition and cylindrical projection correction can eliminate defect shape distortion caused by cylinder liner curved surfaces. Combined with data augmentation and contrastive learning sample set construction, the diversity and effectiveness of the dataset are improved, laying a solid data foundation for accurate detection. Spectral adaptive channel attention modules are embedded in multiple feature levels of the YOLOv11 backbone network. A multi-level collaborative channel attention pyramid is constructed through gated cross-scale connections, which can adaptively enhance the channel responses of features related to minor defects, achieving efficient fusion of high and low-level features and effectively solving the problems of missed detection of minor defects and insufficient feature extraction. Based on the augmented sample set, the target detection loss and supervised contrast loss are calculated and weighted, and the model is trained using an early stopping mechanism, balancing detection accuracy and model generalization ability, avoiding overfitting and shortening the training cycle. Single-view image inference and candidate box deduplication design are adapted to actual industrial detection scenarios, improving detection efficiency while ensuring detection accuracy, reducing false detection and false detection rates, and providing a reliable and efficient technical solution for engine cylinder liner surface defect detection, with high engineering application value. Attached Figure Description

[0017] To more clearly illustrate the technical solutions in the embodiments or related technologies of this application, the accompanying drawings used in the description of the embodiments or related technologies will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0018] Figure 1 A schematic diagram illustrating the application environment of an engine cylinder liner defect detection method based on an improved YOLOv11 provided by this invention;

[0019] Figure 2 A flowchart illustrating an engine cylinder liner defect detection method based on an improved YOLOv11 provided by this invention;

[0020] Figure 3 This is a schematic diagram of the process for generating an initial cylinder liner surface defect detection model in one optional embodiment of the present invention;

[0021] Figure 4 A schematic diagram of the network structure of an engine cylinder liner surface defect detection model provided by the present invention;

[0022] Figure 5 This is a schematic diagram of the structure of an engine cylinder liner defect detection system based on the improved YOLOv11 provided by the present invention. Detailed Implementation

[0023] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0024] This application provides an embodiment of an engine cylinder liner defect detection method based on an improved YOLOv11, which can be applied to, for example... Figure 1 In the application environment shown, terminal 102 can communicate with server 101 via a network. A data storage system can store the data that server 101 needs to process. The data storage system can be integrated onto server 101 or located in the cloud or on other network servers. Server 101 can deploy an engine cylinder liner surface defect detection model, completing core operations such as model training, defect feature extraction, detection inference, and result analysis. Terminal 102 can collect images of the engine cylinder liner surface and upload them to the server, while simultaneously receiving defect detection results returned by server 101, enabling visualization of detection results, parameter setting, and initiation and management of detection tasks. Terminal 102 can be, but is not limited to, various personal computers, laptops, smartphones, tablets, IoT devices, and portable wearable devices. Server 101 can be implemented using a standalone server or a server cluster consisting of multiple servers.

[0025] In one exemplary embodiment, such as Figure 2 As shown, a method for detecting engine cylinder liner defects based on an improved YOLOv11 is provided, and this method is applied to... Figure 1 Taking server 101 as an example, the explanation includes the following steps:

[0026] S1. Obtain bright-field and dark-field images of the engine cylinder liner from multiple angles, and label the defects in the bright-field and dark-field images to obtain a multi-view dual-state image dataset; perform cylindrical projection correction on the bright-field and dark-field images in the multi-view dual-state image dataset to obtain a corrected dataset; based on the corrected dataset, construct a multi-view contrast learning sample set with positive and negative sample pairs; perform data augmentation on the multi-view contrast learning sample set to obtain an augmented multi-view contrast learning sample set.

[0027] Specifically, bright-field images refer to images of the engine cylinder liner surface taken using a direct, frontal light source, clearly revealing visible defects and surface texture details. Dark-field images refer to images of the engine cylinder liner surface taken using side-lit or oblique light sources, effectively highlighting latent defects. Multi-viewpoint imaging refers to shooting from different angles around the circumference and axis of the engine cylinder liner, ensuring full coverage without blind spots. Cylindrical projection correction refers to image processing that, considering the cylindrical curved surface characteristics of the engine cylinder liner, eliminates defect shape distortion caused by surface refraction and shooting angles by using camera calibration parameters and the known radius of the cylinder liner, thus presenting the defects in their true form. Positive sample pairs refer to pairs of bright-field or dark-field images belonging to the same engine cylinder liner but taken from different angles; negative sample pairs refer to pairs of bright-field or dark-field images belonging to different engine cylinder liners. Data augmentation refers to increasing the number and diversity of samples through a series of image processing operations.

[0028] Optionally, server 101 can acquire bright-field and dark-field images obtained by the image acquisition device from multiple angles around the engine cylinder liner, and label each bright-field and dark-field image with information such as the shooting angle, light source type, acquisition time, acquisition device parameters, and cylinder liner number. Server 101 can statistically analyze the defects in the manually labeled bright-field and dark-field images, clarify the location, boundaries, and categories of defects, and construct a multi-view dual-state image dataset. Server 101 can acquire the calibration parameters of the image acquisition device, and combined with the known radius of the engine cylinder liner, perform cylindrical surface projection correction on each image in the multi-view dual-state image dataset to eliminate defect distortion caused by the curved surface, obtaining a corrected dataset. Based on the corrected dataset, server 101 can select images from different perspectives of the same cylinder liner to form positive sample pairs and images from different cylinder liners to form negative sample pairs, constructing a multi-view comparison learning sample set. Simultaneously, it can perform data augmentation operations such as random flipping, rotation, scaling, brightness and contrast adjustment, and Gaussian noise injection on the positive and negative sample pairs in the multi-view comparison learning sample set to generate an enhanced multi-view comparison learning sample set.

[0029] S2. Using the YOLOv11 network as a baseline, embed spectrum adaptive channel attention modules into multiple feature levels of the YOLOv11 network backbone. Through gated cross-scale connections, the channel attention weights output by the spectrum adaptive channel attention modules corresponding to higher feature levels are multiplied by the input features of the spectrum adaptive channel attention modules corresponding to adjacent lower feature levels after convolution and activation, thereby constructing a multi-level collaborative channel attention pyramid and obtaining the initial cylinder liner surface defect detection model.

[0030] Specifically, the backbone network can refer to the core feature extraction part of the YOLOv11 network, responsible for extracting features at different levels from the input image. These feature levels include low-level, mid-level, and high-level feature layers, each corresponding to feature outputs with different downsampling ratios. Low-level features emphasize detailed information, while high-level features emphasize semantic information. The spectrum-adaptive channel attention module can refer to a module used to enhance feature channel responses. It can adaptively adjust the cross-channel interaction range based on the spectrum information of the input features, focusing on enhancing the feature channel responses related to minor cylinder liner defects and suppressing interference from irrelevant features. The channel attention pyramid can refer to a feature enhancement structure composed of spectrum-adaptive channel attention modules at different feature levels and gated cross-scale connections, enabling comprehensive extraction and enhancement of multi-level defect features.

[0031] Optionally, server 101 can use the basic framework of the YOLOv11 network as a baseline model and load the pre-trained weights of the YOLOv11 network on a general object detection dataset. Server 101 can embed spectral adaptive channel attention modules after the outputs of the low-level, mid-level, and high-level feature layers of the YOLOv11 backbone network, and configure the core parameters of these modules. Server 101 can construct a gated cross-scale connection structure, set a 1×1 convolutional kernel and a sigmoid activation function, and perform convolution and activation processing on the channel attention weights output by the spectral adaptive channel attention modules corresponding to the high-level feature layers. Then, it multiplies these weights channel-by-channel with the input features of the spectral adaptive channel attention modules corresponding to the adjacent low-level feature layers, completing the collaborative fusion of high- and low-level features. Server 101 can sequentially complete the gated cross-scale connections of features at each level, construct a multi-level collaborative channel attention pyramid, integrate the improved network structure, and generate an initial cylinder liner surface defect detection model.

[0032] S3. Based on the enhanced multi-view contrast learning sample set, calculate the target detection loss and the supervised contrast loss, and perform a weighted summation of the target detection loss and the supervised contrast loss to obtain the joint loss value. Based on the joint loss value, train the initial cylinder liner surface defect detection model through backpropagation, and adopt an early stopping mechanism to monitor the preset verification index. When the preset verification index does not improve within the preset evaluation period, stop training and output the engine cylinder liner surface defect detection model.

[0033] Specifically, target detection loss refers to the loss value used to measure the difference between the detection prediction results of the initial cylinder liner surface defect detection model and the sample annotation information, reflecting the accuracy of the model's defect detection. Supervised contrastive loss refers to the loss value calculated based on positive and negative sample pairs in the enhanced multi-view contrastive learning sample set, used to strengthen the initial cylinder liner surface defect detection model's ability to identify the similarity of defect features from different perspectives of the same cylinder liner and to distinguish between different cylinder liner defect features. Weighted summation refers to the method of summing the target detection loss and supervised contrastive loss after assigning appropriate weights according to their importance. Backpropagation refers to a model parameter update method that adjusts the parameters of each layer of the model in reverse by calculating the gradient of the joint loss value, thereby optimizing model performance. Early stopping mechanism refers to a training strategy to prevent model overfitting, controlling the timing of training termination by monitoring changes in preset validation metrics. Preset validation metrics can be set according to the actual needs of engine cylinder liner surface defect detection and industrial inspection standards, combined with the model training objectives. Preset validation metrics can accurately evaluate the model's defect detection performance. The preset evaluation cycle can be set according to the normal efficiency of model training, sample size, and the performance requirements of industrial detection. It is usually a fixed number of training rounds to ensure that the changing trend of the validation indicators can be fully monitored and to avoid stopping training too early, which would result in the model not being optimized enough or overtraining leading to overfitting.

[0034] Optionally, server 101 can call the enhanced multi-view contrast learning sample set, divide the enhanced multi-view contrast learning sample set into a training set and a validation set, and reasonably allocate the dataset ratio. Server 101 can load the initial cylinder liner surface defect detection model, input the training set samples into the model for forward propagation, calculate the target detection loss and supervised contrast loss respectively, set the weight coefficients of the target detection loss and supervised contrast loss, and obtain the joint loss value by weighted summation of the target detection loss and supervised contrast loss. Based on the joint loss value, server 101 can calculate the gradient through the backpropagation algorithm, update the parameters of each layer of the initial cylinder liner surface defect detection model, such as the backbone network and the spectrum adaptive channel attention module, and optimize the detection performance of the initial cylinder liner surface defect detection model. Server 101 can enable an early stopping mechanism, set preset validation indicators and preset evaluation periods, evaluate the model performance with the validation set after each round of training, and monitor the changes in the preset validation indicators. When server 101 detects that the preset validation indicators have not improved within the preset evaluation period, it immediately stops model training, saves the model parameters at this time, and outputs the engine cylinder liner surface defect detection model.

[0035] S4. Obtain a single-view image of the engine cylinder liner to be detected. Input the single-view image of the engine cylinder liner into the engine cylinder liner surface defect detection model. Extract the defect feature map of the single-view image of the engine cylinder liner through the channel attention pyramid. Parse the candidate detection box, defect category and confidence from the defect feature map. Remove duplicate candidate detection boxes and output the defect category, bounding box and confidence of the engine cylinder liner.

[0036] Specifically, the single-view image of the engine cylinder liner to be inspected refers to an image of the engine cylinder liner surface taken from only a single angle, eliminating the need for multi-view shooting and adapting to rapid inspection scenarios in industrial applications. The defect feature map includes key information such as the location and shape of defects on the cylinder liner surface. The candidate detection box refers to the region bounding box parsed from the defect feature map that is suspected of containing defects, used for preliminary defect location. The confidence score refers to the probability value that the engine cylinder liner surface defect detection model determines the presence of a corresponding defect within the candidate detection box; the higher the confidence score, the more reliable the detection result.

[0037] Optionally, server 101 can receive a single-view image of the engine cylinder liner to be detected uploaded by terminal 102, and perform preprocessing on the single-view image of the engine cylinder liner, including size normalization, grayscale correction, and noise removal, to ensure that the image quality meets the model detection requirements. Server 101 can input the preprocessed single-view image of the engine cylinder liner into the engine cylinder liner surface defect detection model, and perform multi-level feature extraction and enhancement on the single-view image of the engine cylinder liner through channel attention pyramid to generate a defect feature map. Server 101 can use the inference module of the engine cylinder liner surface defect detection model to parse candidate detection boxes, corresponding defect categories, and confidence levels from the defect feature map, and initially filter candidate detection boxes with confidence levels lower than a preset confidence threshold to obtain the remaining candidate detection boxes. Server 101 can use a non-maximum suppression algorithm to deduplicate the remaining candidate detection boxes, calculate the overlap between each candidate detection box, remove the remaining candidate detection boxes with overlap exceeding a preset overlap threshold, and retain the remaining candidate detection boxes with the most accurate localization and the highest confidence. Server 101 can organize defect categories, deduplicated bounding boxes, and confidence levels, output the final detection results, and push them synchronously to terminal 102.

[0038] The aforementioned engine cylinder liner defect detection method based on improved YOLOv11 effectively eliminates image distortion caused by the cylinder liner's curved surface and restores the true shape of the defect by acquiring multi-view bright-field and dark-field images and performing cylindrical projection correction. It enhances sample diversity and model generalization ability by constructing a multi-view contrastive learning sample set and data augmentation. Furthermore, it strengthens the response of minute defect features and improves feature extraction accuracy by embedding a spectrum-adaptive channel attention module into the YOLOv11 backbone network and constructing a channel attention pyramid. The method accelerates model convergence, avoids overfitting, and improves detection stability by combining target detection loss and supervised contrastive loss with cosine annealing and early stopping strategies. Finally, it achieves efficient and accurate inference through single-view image preprocessing, candidate box decoding, and non-maximum suppression filtering. This method significantly improves the accuracy and efficiency of cylinder liner defect detection, reduces false negatives and missed detections, has strong anti-interference capabilities, and is suitable for actual industrial testing needs.

[0039] In an exemplary embodiment, bright-field and dark-field images of the engine cylinder liner are acquired from multiple angles. Defects in the bright-field and dark-field images are labeled to obtain a multi-view dual-state image dataset. Cylindrical projection correction is performed on the bright-field and dark-field images in the multi-view dual-state image dataset to obtain a corrected dataset. Based on the corrected dataset, a multi-view contrast learning sample set with positive and negative sample pairs is constructed. Data augmentation is performed on the multi-view contrast learning sample set to obtain an augmented multi-view contrast learning sample set, including the following steps:

[0040] S11. Defect category labeling is performed on the acquired bright field and dark field images to obtain a multi-view dual-state image dataset, with defect categories including bumps and pinholes.

[0041] Optionally, the server can obtain manually annotated defect information from bright-field and dark-field images to obtain annotation files. The server can verify the annotation results, filter out images with incorrect, missing, or mislabeled annotations, and return them to staff for re-annotation. After verification, all annotated bright-field images, dark-field images, and annotation files are associated and stored to form a multi-view, dual-state image dataset. The annotation information includes defect location coordinates, defect category, annotator information, annotation time, and annotation confidence level.

[0042] S12. Obtain the calibration parameters of the camera used to capture the bright field image and dark field image. Based on the known radius and calibration parameters of the engine cylinder liner, perform cylindrical projection correction on the bright field image and dark field image in the multi-view dual-state image dataset to eliminate the defect shape distortion caused by the curved surface of the engine cylinder liner and obtain the corrected dataset.

[0043] Specifically, camera calibration parameters can refer to the set of parameters used to describe the imaging characteristics of the camera, including camera intrinsic parameters and camera extrinsic parameters; the known radius of the engine cylinder liner can refer to the preset geometric parameters of the engine cylinder liner to be inspected, which are determined by the production specifications of the engine cylinder liner. The known radius can be used to match the curved surface model of the cylindrical surface projection correction; defect shape distortion can refer to the phenomenon that the image will be stretched and distorted during shooting due to the cylindrical curved surface of the engine cylinder liner, resulting in the inconsistency between the actual shape of the defect and the shape presented in the image.

[0044] Optionally, the server can access a multi-view dual-state image dataset, simultaneously reading the calibration parameters of the corresponding camera and the known radius of the engine cylinder liner. Based on physical imaging geometry, a cylindrical projection correction model is constructed, and correction algorithm parameters are set. The server can perform cylindrical projection geometric correction on each bright-field and dark-field image in the multi-view dual-state image dataset, eliminating defect shape distortion caused by curved surfaces through geometric transformation. The correction effect is monitored in real-time during the correction process to ensure accurate defect shape restoration. The server can perform quality checks on the corrected images, filtering out images with incomplete correction and residual distortion, readjusting the correction algorithm parameters for secondary correction. After passing the check, all corrected images are associated with the original annotation information to construct a corrected dataset.

[0045] Preferably, the calculation formula for cylindrical surface projection correction can be:

[0046]

[0047] in, For the corrected pixel coordinates, Let be the radius of the engine cylinder liner. For the camera's optical center coordinates, For camera focal length, This represents the image width.

[0048] S13. Combine the bright-field images and dark-field images from different shooting angles belonging to the same engine cylinder liner in the corrected dataset into positive sample pairs, and combine the bright-field images and dark-field images belonging to different engine cylinder liners into negative sample pairs, to obtain a multi-view contrast learning sample set with positive and negative sample pairs.

[0049] Optionally, the server can access the calibrated dataset and extract the engine cylinder liner number, shooting angle, and image type information corresponding to the bright-field and dark-field images in the calibrated dataset to establish a correlation between the images and the cylinder liner numbers. The server can classify and filter images based on the cylinder liner numbers, pairing bright-field and dark-field images from different shooting angles under the same cylinder liner number to generate positive sample pairs; and randomly pairing bright-field and dark-field images corresponding to different cylinder liner numbers to generate negative sample pairs. After combination, the server can verify all positive and negative sample pairs, removing incorrectly combined and duplicate sample pairs, and integrating them to generate a multi-view contrast learning sample set containing both positive and negative sample pairs.

[0050] S14. Simultaneously and randomly flip the bright field and dark field images contained in the positive and negative sample pairs in the multi-view contrast learning sample set to obtain a flipped enhanced image; simultaneously and randomly rotate the flipped enhanced image to obtain a rotated enhanced image; simultaneously and randomly scale the rotated enhanced image to obtain a scaled enhanced image; simultaneously adjust the brightness and contrast of the scaled enhanced image to obtain a brightness and contrast enhanced image; inject Gaussian noise into the brightness and contrast enhanced image to obtain an enhanced multi-view contrast learning sample set.

[0051] Specifically, random flipping refers to simultaneously performing horizontal and vertical flipping operations on the bright and dark images in both positive and negative sample pairs, ensuring that the flipping states of the bright and dark images are consistent across both pairs. Random rotation refers to simultaneously rotating the bright and dark images in the flipped enhanced image at random angles. The rotation angle can be preset according to actual needs, keeping the rotation angles of the two images consistent. Random scaling refers to simultaneously enlarging and reducing the bright and dark images in the rotated enhanced image at random ratios, maintaining the image aspect ratio and ensuring that the scaling ratios of the bright and dark images are consistent. Brightness and contrast adjustment refers to randomly adjusting the brightness and contrast of the scaled enhanced image to improve the visual effect. Gaussian noise injection refers to adding an appropriate amount of Gaussian noise to the brightness and contrast enhanced image to simulate image noise that may occur during actual shooting, improving the model's anti-interference ability.

[0052] Optionally, the server can access a multi-view contrast learning sample set, extract all positive and negative sample pairs from the set, ensuring that the bright-field and dark-field images in each sample pair are correlated. The server can simultaneously perform random flipping operations on the bright-field and dark-field images in each sample pair, randomly selecting horizontal or vertical flipping to generate a flipped enhanced image. The server can simultaneously perform random rotation on the flipped enhanced image, preset a reasonable rotation angle range to ensure the bright-field and dark-field images rotate at the same angle, resulting in a rotated enhanced image. The server can simultaneously perform random scaling on the rotated enhanced image, setting a scaling ratio range to maintain the original image proportions, generating a scaled enhanced image. The server can simultaneously adjust the brightness and contrast of the scaled enhanced image, randomly setting adjustment parameters to obtain a brightness and contrast enhanced image. The server can inject Gaussian noise into the brightness and contrast enhanced image, controlling the noise intensity within a reasonable range to avoid masking defect features. After completing all enhancement operations, all enhanced sample pairs are integrated to obtain an enhanced multi-view contrast learning sample set.

[0053] In one exemplary embodiment, such as Figure 3 As shown, using the YOLOv11 network as a baseline, spectral adaptive channel attention modules are embedded in multiple feature layers of the YOLOv11 network backbone. Through gated cross-scale connections, the channel attention weights output by the spectral adaptive channel attention modules corresponding to higher feature layers are multiplied channel-by-channel by the input features of the spectral adaptive channel attention modules corresponding to adjacent lower feature layers after convolution and activation. This constructs a multi-level collaborative channel attention pyramid, yielding the initial cylinder liner surface defect detection model, including the following steps:

[0054] S21. Insert a spectrum adaptive channel attention module after the output of the low-level feature layer, the middle-level feature layer, and the high-level feature layer of the YOLOv11 network backbone network, respectively. The low-level feature layer, the middle-level feature layer, and the high-level feature layer are feature output layers with different downsampling ratios in the backbone network. The spectrum adaptive channel attention module is used to adaptively adjust the cross-channel interaction range according to the spectrum information of the input features to enhance the response of the feature channels related to minor defects.

[0055] Specifically, downsampling ratio refers to the reduction ratio of the feature map size in the backbone network relative to the input image size. Different downsampling ratios correspond to different levels of feature extraction capabilities.

[0056] Optionally, the server can invoke the basic framework of the YOLOv11 network to locate the output ends of the low-, mid-, and high-level feature layers of the backbone network. The server can insert spectrum-adaptive channel attention modules after the output ends of each feature layer, configure the core parameters of the spectrum-adaptive channel attention modules, and ensure that the spectrum-adaptive channel attention modules can correctly receive the output features of the corresponding feature layers. The server can perform preliminary debugging of the backbone network after inserting the spectrum-adaptive channel attention modules to verify the connection stability between the spectrum-adaptive channel attention modules and each feature layer.

[0057] S22. Establish a gated cross-scale connection between the backbone network and the neck network of the YOLOv11 network. After the channel attention weights output by the spectrum adaptive channel attention module corresponding to the high-level feature level are activated by 1×1 convolution and Sigmoid, they are multiplied with the input features of the spectrum adaptive channel attention module corresponding to the middle-level feature level channel by channel to output the basic cylinder liner surface defect detection model.

[0058] Specifically, gated cross-scale connections refer to a dedicated connection method established between the backbone network and the neck network. Gated cross-scale connections enable efficient transfer and collaboration of features at different levels, ensuring that the attention weights of high-level features are accurately applied to mid-level features, improving the model's accuracy in identifying cylinder liner defects, and preventing the disconnect between features at different levels. 1×1 convolutions can be used to adjust the dimensionality of the channel attention weights output from high-level features, ensuring that the channel attention weights and mid-level features maintain the same dimensionality, guaranteeing smooth channel-by-channel multiplication. The Sigmoid activation function can be used to normalize the adjusted attention weights, controlling the weight values ​​within a reasonable range and preventing abnormal weights from affecting the feature fusion effect.

[0059] Optionally, the server can preload relevant parameters of the backbone network and neck network, locate the connection nodes of gated cross-scale connections, and ensure connection stability. The server can extract the channel attention weights corresponding to high-level features, adjust the dimension of the channel attention weights through a 1×1 convolutional layer, normalize the channel attention weights through a sigmoid activation function, and then multiply the processed channel attention weights with the mid-level features channel by channel to complete collaborative feature fusion and generate a basic cylinder liner surface defect detection model.

[0060] Preferably, the formula for calculating the channel attention weight can be:

[0061]

[0062] in, For the first Channel attention weights For feature map spectral transformation, For one-dimensional convolution, It is the Sigmoid activation function. For the backbone network The output of the nth feature level Channel input feature map.

[0063] S23. Based on the basic cylinder liner surface defect detection model, the channel attention weights output by the spectrum adaptive channel attention module corresponding to the middle feature level are multiplied by the input features of the spectrum adaptive channel attention module corresponding to the lower feature level through 1×1 convolution and Sigmoid activation, forming a multi-level collaborative channel attention pyramid, and thus obtaining the initial cylinder liner surface defect detection model.

[0064] Optionally, the server can invoke the basic cylinder liner surface defect detection model, extract the channel attention weights output by the spectrum adaptive channel attention module corresponding to the mid-level feature layer, adjust the dimension of the channel attention weights through a preset 1×1 convolutional layer to match the dimension of the channel attention weights with the input feature dimension of the low-level feature layer, and then normalize the channel attention weights using the Sigmoid activation function to ensure that the channel attention weight values ​​are reasonable. The server can then multiply the processed channel attention weights and the input features of the spectrum adaptive channel attention module corresponding to the low-level feature layer channel by channel to complete the fusion of features at different levels. After fusion, the server can integrate all features and channel attention weights to construct a multi-level collaborative channel attention pyramid, ultimately generating the initial cylinder liner surface defect detection model.

[0065] In an exemplary embodiment, based on an enhanced multi-view contrastive learning sample set, target detection loss and supervised contrastive loss are calculated. The target detection loss and supervised contrastive loss are weighted and summed to obtain a joint loss value. Based on this joint loss value, an initial cylinder liner surface defect detection model is trained via backpropagation. An early stopping mechanism is employed to monitor preset verification indicators. Training stops when the preset verification indicators do not improve within a preset evaluation period, and the output is as follows: Figure 4 The engine cylinder liner surface defect detection model shown includes the following steps:

[0066] S31. Load the pre-trained weights of the YOLOv11 network on the general object detection dataset and initialize the backbone network parameters of the initial cylinder liner surface defect detection model.

[0067] Specifically, a general object detection dataset can refer to a publicly available standard dataset that includes images of common objects in multiple categories and scenes, used to pre-train the network's basic feature extraction capabilities; pre-trained weights can refer to the network parameters saved after the YOLOv11 network is trained on the general object detection dataset, possessing general feature extraction and texture perception capabilities; and backbone network parameters can refer to the learnable parameters such as the weights and biases of each network layer in the backbone network of the initial cylinder liner surface defect detection model.

[0068] Optionally, the server can obtain the pre-trained weights corresponding to the YOLOv11 network, match the network structure layers, and remove redundant weight parameters that do not match the initial cylinder liner surface defect detection model structure; load the successfully matched pre-trained weights layer by layer into the model backbone network to complete the initialization of the backbone network parameters.

[0069] S32. Input the enhanced multi-view contrast learning sample set into the initial cylinder liner surface defect detection model for forward propagation to obtain the detection prediction results, and extract the defect feature vectors output by the attention modules of each spectrum adaptive channel after global pooling.

[0070] Specifically, forward propagation can refer to the process of inputting sample images into a network model and sequentially passing through the backbone network, each attention module, the neck network, and the detection head to complete the forward operation of feature extraction, feature fusion, and prediction inference layer by layer; global pooling can refer to the pooling operation of compressing the overall dimension and aggregating global semantic information on the feature map output by the spectral adaptive channel attention module.

[0071] Optionally, the server can read sample pairs from the enhanced multi-view contrast learning sample set, uniformly perform image size normalization and pixel value normalization preprocessing, and then batch send them into the initial cylinder liner surface defect detection model to perform forward propagation calculations to obtain detection prediction results. During the network forward inference process, the server can perform global pooling operations on the output feature maps of each spectrum adaptive channel attention module to unify feature dimensions and compress redundant information, thereby extracting defect feature vectors.

[0072] S33. Based on the detection prediction results and the annotation information in the enhanced multi-view contrast learning sample set, the target detection loss is calculated using the native detection loss function of the YOLOv11 network. The supervised contrast loss is calculated based on the defect feature vector and the positive and negative sample pairs in the enhanced multi-view contrast learning sample set. The target detection loss and the supervised contrast loss are weighted and summed to obtain the joint loss value. The parameters of the initial cylinder liner surface defect detection model are updated through backpropagation based on the joint loss value.

[0073] Specifically, the native detection loss function can refer to the loss function in the YOLOv11 network used to measure the difference between the model's predicted bounding box, category, and confidence score and the real annotation; the supervised contrast loss can refer to the loss function constructed by using the constraint method of bringing positive samples closer to feature similarity and negative samples further apart to feature similarity, used to enhance the model's ability to distinguish and represent defect features across perspectives; the object detection loss can refer to the native detection loss function based on the YOLOv11 network, which is the sum of the classification loss, regression loss, and confidence loss calculated comprehensively. It is used to measure the error between the model's predicted defect category probability, bounding box coordinate position, and detection confidence score and the real annotation, directly constraining the model's detection accuracy and is the core optimization objective of model training.

[0074] Optionally, the server can align and match the detection prediction results with the real annotation information in the enhanced multi-view contrast learning sample set in terms of coordinates, category, and confidence. The server can call the native detection loss function of YOLOv11 to calculate the target detection loss. Based on the extracted defect feature vectors, the server can measure the feature distance between positive and negative sample pairs and construct the supervised contrast loss according to the preset positive and negative sample pair matching rules. The server can configure the weight ratio of the target detection loss and the supervised contrast loss according to the task training requirements and perform weighted fusion to obtain the joint loss value. The server can use the joint loss value as the optimization objective, calculate the network gradient layer by layer through the backpropagation algorithm, and use a preset optimizer to iteratively update all learnable parameters of the initial cylinder liner surface defect detection model to complete one round of model parameter iterative optimization.

[0075] S34. Use cosine annealing learning rate to schedule the training for a preset number of rounds and monitor the preset verification index. When the monitored preset verification index does not improve within the preset evaluation period, trigger early stop. Save the initial cylinder liner surface defect detection model at the time of triggering the early stop step as the optimal model and output the optimized engine cylinder liner surface defect detection model.

[0076] Specifically, cosine annealing learning rate scheduling can refer to a training scheduling strategy that periodically decays and restarts the learning rate according to the changing law of the cosine function, which can enable the model to escape local optima, accelerate convergence and improve generalization performance during training; early stopping can refer to a training control strategy that terminates training in advance when the validation metric has not improved significantly for several rounds during model training, which can effectively avoid model overfitting.

[0077] Optionally, the server can be configured with the iteration period, initial learning rate, and minimum learning rate parameters for cosine annealing learning rate scheduling, and execute the model training and validation process round by round according to the set total training rounds. After each training round, the server can calculate and record preset validation metrics on the validation set, continuously observe the trend of metric changes, and statistically analyze the metric improvement according to the preset evaluation period. When the validation metrics no longer improve within consecutive preset evaluation periods, the server can trigger an early stop mechanism to terminate subsequent training iterations, automatically save the initial cylinder liner surface defect detection model corresponding to the current iteration round as the optimal model, and output the optimized engine cylinder liner surface defect detection model.

[0078] Preferably, the formula for calculating the cosine annealing learning rate can be:

[0079]

[0080] in, The learning rate for the current iteration step. To preset the maximum learning rate, To preset the minimum learning rate, For the current iteration round, This represents the maximum number of iterations within the cosine annealing cycle.

[0081] In an exemplary embodiment, the formula for calculating the supervised contrastive loss is:

[0082]

[0083] in, To monitor and compare loss values, The index for the anchor point sample. This is the index of the defect feature vector of the positive sample. and These are the defect feature vectors corresponding to images of the same engine cylinder liner from different viewpoints. Union The defect feature vectors traversed in the process, The cosine similarity function is used. For temperature hyperparameters, For traversing the union The index of all defect feature vectors in the dataset. To and The set of all negative sample defect feature vectors belonging to different engine cylinder liners. To and The set of all positive sample defect feature vectors belonging to the same engine cylinder liner. This represents the number of defect feature vectors in the set of positive samples.

[0084] In an exemplary embodiment, a single-view image of the engine cylinder liner to be detected is acquired. This single-view image is then input into an engine cylinder liner surface defect detection model. A defect feature map is extracted from the single-view image using a channel attention pyramid. Candidate detection boxes, defect categories, and confidence scores are parsed from the defect feature map. The candidate detection boxes are deduplicated, and the defect category, bounding box, and confidence score of the engine cylinder liner are output. This process includes the following steps:

[0085] S41. Scale the single-view image of the engine cylinder liner to a preset resolution and perform normalization processing to obtain a normalized engine cylinder liner image.

[0086] Specifically, the preset resolution can be comprehensively preset based on the network input specifications of the engine cylinder liner surface defect detection model, the minimum detectable defect size, the resolution of the image acquisition equipment, and the real-time requirements of industrial inspection. Normalization processing refers to the preprocessing operation of mapping image pixel values ​​to the required numerical range of the engine cylinder liner surface defect detection model input, eliminating the interference of pixel amplitude differences on model inference.

[0087] Optionally, the server can read a single-view image of the engine cylinder liner to be inspected, obtain the original width, height, and number of channels of the single-view image, calculate a proportional scaling factor according to a preset resolution, and scale the single-view image of the engine cylinder liner proportionally according to the scaling factor to obtain a scaled image. This ensures that the maximum side length of the scaled image matches the corresponding side length of the preset resolution, avoiding the stretching and distortion of defect shapes caused by non-proportional scaling. The server can fill the empty areas of the scaled image with a solid color to pad the edges, bringing the image size to the preset resolution, thus completing the image size unification process and obtaining a size-unified image. The server can perform a pixel-by-pixel linear normalization operation on the size-unified image, mapping the original image pixel values ​​from the integer range of 0-255 to the floating-point value range of 0-1, strictly constraining the pixel values ​​to the standard input adaptation range of the engine cylinder liner surface defect detection model, and finally obtaining a normalized engine cylinder liner image.

[0088] S42. Input the normalized engine cylinder liner image into the engine cylinder liner surface defect detection model, and perform multi-level feature extraction and spectrum adaptive channel attention enhancement through the channel attention pyramid to obtain the predicted feature map.

[0089] Optionally, the server can obtain the dimensional information of the normalized engine cylinder liner image, add batch dimensions to the normalized engine cylinder liner image and adjust the channel arrangement order according to the inference input specifications of the engine cylinder liner surface defect detection model, completing the tensor format dimensionality processing to ensure that the image data fully matches the model input interface requirements. The server can input the processed image data into the engine cylinder liner surface defect detection model. The server can continuously downsample and extract features from the input image through the backbone network, sequentially outputting low-level basic features that retain edge texture information, mid-level basic features that contain local defect structure information, and high-level basic features that contain defect semantic information. The server can input the low-level, mid-level, and high-level basic features into the channel attention pyramid. Through the spectral adaptive channel attention modules embedded at each level, the features of the channel dimensions are weighted. At the same time, the high-level feature attention weights are transferred and fused to the low-level features through gated cross-scale connections, suppressing redundant interference features such as background texture and illumination noise, and focusing on strengthening the effective feature responses of minor defects such as impacts and pinholes, resulting in multi-level enhanced features. Finally, the multi-level enhanced features are fused and output to obtain the predicted feature map.

[0090] S43. Perform convolution operation on the predicted feature map to generate classification prediction tensor and regression prediction tensor; perform Softmax activation on the classification prediction tensor to obtain the class probability of each candidate detection box; decode based on the regression prediction tensor and preset anchor boxes to obtain the bounding box coordinates and confidence of each candidate detection box; combine the class probability, confidence and bounding box coordinates to obtain candidate detection boxes with class, confidence and location information.

[0091] Specifically, the classification prediction tensor can refer to a multidimensional tensor used to characterize the defect category to which each feature location belongs; the regression prediction tensor can refer to a multidimensional tensor used to characterize the offset of the detection box relative to the anchor box; the preset anchor box can refer to a pre-defined reference frame of different sizes and aspect ratios, which can be used as a reference for the regression decoding of the detection box; and the bounding box coordinates can refer to the coordinate parameters that characterize the location and range of the defect in the image.

[0092] Optionally, the server can configure dedicated convolutional kernels for defect classification and bounding box regression for the predicted feature maps. These kernels are then used to perform convolution operations on the predicted feature maps, outputting a classification prediction tensor for defect category determination and a regression prediction tensor for bounding box and confidence score prediction, ensuring feature decoupling and computational independence between the classification and regression tasks. The server can perform Softmax activation along the channel dimension of the classification prediction tensor, normalizing the original output values ​​to probability values ​​between 0 and 1, obtaining the probability distribution of each candidate detection box for the categories of impact, sand hole, and background. The category corresponding to the maximum probability is selected as the defect category of the candidate detection box. The server can read preset anchor box parameters pre-configured based on the cylinder liner defect size distribution, combine them with the center offset, width and height scaling factors, and confidence score prediction values ​​output by the regression prediction tensor, and perform inverse bounding box coordinate transformation calculation according to preset decoding rules to obtain the actual bounding box coordinates and confidence scores of each candidate detection box in the single-view image of the engine cylinder liner. The server can correlate and match the defect category probability, confidence score, and actual bounding box coordinates of each candidate detection box one by one, encapsulate them in a unified data format, and generate candidate detection boxes carrying complete category, confidence, and location information.

[0093] S44. Filter candidate detection boxes with confidence scores lower than the preset confidence threshold, calculate the overlap between the remaining candidate detection boxes and the candidate detection box with the highest confidence score, remove candidate detection boxes with overlap scores exceeding the preset overlap threshold, and obtain the defect category, bounding box, and confidence score.

[0094] Specifically, overlap can refer to the quantified value of the intersection-union ratio between two candidate detection boxes; the preset confidence threshold can be preset based on the industrial accuracy requirements of engine cylinder liner defect detection, sample distribution and model training output probability range, and prioritize the selection of critical values ​​that can effectively filter out background interference and retain real defect candidate boxes; the preset overlap threshold can be preset based on the deduplication requirements of non-maximum suppression, and is used to determine whether candidate boxes are redundant and repeated, taking into account both detection box positioning accuracy and recall rate.

[0095] Optionally, the server can iterate through all candidate detection boxes, judging the confidence value of each candidate detection box according to a preset confidence threshold. Candidate detection boxes with confidence values ​​lower than the preset confidence threshold are judged as invalid detection boxes and directly removed, completing the first round of screening and retaining valid candidate detection boxes. The server can sort the valid candidate detection boxes from high to low confidence and select the candidate detection box with the highest confidence as the reference box. The server can iterate through the remaining valid candidate detection boxes, calculate the intersection-union ratio (IU / I) between each candidate detection box and the reference box, and obtain the corresponding overlap value. The server can judge the candidate detection boxes with overlap values ​​exceeding the preset overlap threshold as redundant detection boxes and remove them one by one, retaining the valid detection boxes that do not exceed the threshold. The server can repeat the operations of selecting the reference box, calculating the IU / I, and removing redundant boxes in the remaining valid candidate detection boxes until all candidate detection boxes have been screened. Finally, the server organizes the selected and retained valid detection results and outputs the defect category, bounding box, and confidence value corresponding to the single-view image of the engine cylinder liner to be detected.

[0096] Preferably, the formula for calculating the degree of overlap can be:

[0097]

[0098] in, For the first One candidate detection box, For the first One candidate detection box, for Candidate detection boxes and The intersection area of ​​candidate detection boxes. for Candidate detection boxes and The area of ​​the union of candidate detection boxes.

[0099] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least a portion of the steps or stages of other steps.

[0100] Based on the same inventive concept, this application also provides an engine cylinder liner defect detection system based on improved YOLOv11 for implementing the aforementioned engine cylinder liner defect detection method based on improved YOLOv11. The solution provided by this system is similar to the implementation described in the above method. Therefore, the specific limitations of one or more embodiments of the engine cylinder liner defect detection system based on improved YOLOv11 provided below can be found in the limitations of the engine cylinder liner defect detection method based on improved YOLOv11 described above, and will not be repeated here.

[0101] In one exemplary embodiment, such as Figure 5 As shown, an engine cylinder liner defect detection system 500 based on an improved YOLOv11 is provided, comprising:

[0102] The multi-view dual-state image acquisition and preprocessing module 501 can be used to acquire bright-field and dark-field images of engine cylinder liners from multiple angles, annotate defects in the bright-field and dark-field images to obtain a multi-view dual-state image dataset; perform cylindrical projection correction on the bright-field and dark-field images in the multi-view dual-state image dataset to obtain a corrected dataset; construct a multi-view contrast learning sample set with positive and negative sample pairs based on the corrected dataset; and perform data augmentation on the multi-view contrast learning sample set to obtain an augmented multi-view contrast learning sample set.

[0103] The initial cylinder liner surface defect detection model construction module 502 can be used to embed a spectrum adaptive channel attention module into multiple feature levels of the backbone network of the YOLOv11 network as a baseline, and through gated cross-scale connection, multiply the channel attention weights output by the spectrum adaptive channel attention module corresponding to the higher feature level with the input features of the spectrum adaptive channel attention module corresponding to the adjacent lower feature level channel by channel after convolution and activation, so as to construct a multi-level collaborative channel attention pyramid and obtain the initial cylinder liner surface defect detection model.

[0104] The model training module 503 can be used to calculate the target detection loss and supervised contrast loss based on the enhanced multi-view contrast learning sample set, perform weighted summation on the target detection loss and supervised contrast loss to obtain the joint loss value, train the initial cylinder liner surface defect detection model through backpropagation based on the joint loss value, and adopt an early stopping mechanism to monitor the preset verification index. When the preset verification index does not improve within the preset evaluation period, the training stops and the engine cylinder liner surface defect detection model is output.

[0105] The defect detection inference module 504 can be used to acquire a single-view image of the engine cylinder liner to be detected, input the single-view image of the engine cylinder liner into the engine cylinder liner surface defect detection model, extract the defect feature map of the single-view image of the engine cylinder liner through the channel attention pyramid, parse the candidate detection box, defect category and confidence from the defect feature map, remove duplicate candidate detection boxes, and output the defect category, bounding box and confidence of the engine cylinder liner.

[0106] For the device embodiments, since they basically correspond to the method embodiments, the relevant parts can be referred to in the description of the method embodiments. The device embodiments described above are merely illustrative. The components described as separate parts may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this disclosure according to actual needs. Those skilled in the art can understand and implement this without creative effort.

[0107] The above-described embodiments are merely illustrative of several implementation methods of the embodiments of this application, and their descriptions are relatively specific and detailed. However, they should not be construed as limiting the scope of the patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of the embodiments of this application, and these modifications and improvements all fall within the protection scope of the embodiments of this application.

Claims

1. A method for detecting engine cylinder liner defects based on an improved YOLOv11, characterized in that, include: S1. Acquire bright-field and dark-field images of the engine cylinder liner from multiple angles, and annotate the defects in the bright-field and dark-field images to obtain a multi-view dual-state image dataset; perform cylindrical projection correction on the bright-field and dark-field images in the multi-view dual-state image dataset to obtain a corrected dataset; construct a multi-view contrast learning sample set with positive and negative sample pairs based on the corrected dataset; perform data augmentation on the multi-view contrast learning sample set to obtain an augmented multi-view contrast learning sample set. S2. Using the YOLOv11 network as a baseline, embed spectrum adaptive channel attention modules into multiple feature levels of the backbone network of the YOLOv11 network. Through gated cross-scale connections, the channel attention weights output by the spectrum adaptive channel attention modules corresponding to the higher feature levels are multiplied by the input features of the spectrum adaptive channel attention modules corresponding to the adjacent lower feature levels after convolution and activation. This constructs a multi-level collaborative channel attention pyramid and obtains the initial cylinder liner surface defect detection model. S3. Based on the enhanced multi-view contrast learning sample set, calculate the target detection loss and the supervised contrast loss, perform a weighted summation of the target detection loss and the supervised contrast loss to obtain a joint loss value, train the initial cylinder liner surface defect detection model through backpropagation based on the joint loss value, and adopt an early stop mechanism to monitor the preset verification index. When the preset verification index does not improve within the preset evaluation period, stop training and output the engine cylinder liner surface defect detection model. S4. Obtain a single-view image of the engine cylinder liner to be detected. Input the single-view image of the engine cylinder liner into the engine cylinder liner surface defect detection model. Extract the defect feature map of the single-view image of the engine cylinder liner through the channel attention pyramid. Parse the candidate detection box, defect category and confidence from the defect feature map. Remove duplicates from the candidate detection boxes and output the defect category, bounding box and confidence of the engine cylinder liner.

2. The method according to claim 1, characterized in that, The process involves acquiring bright-field and dark-field images of the engine cylinder liner from multiple angles, annotating defects in the bright-field and dark-field images to obtain a multi-view dual-state image dataset, performing cylindrical projection correction on the bright-field and dark-field images in the multi-view dual-state image dataset to obtain a corrected dataset, and constructing a multi-view contrast learning sample set with positive and negative sample pairs based on the corrected dataset. The multi-view contrast learning sample set is augmented to obtain an augmented multi-view contrast learning sample set, including: S11. Defect category labeling is performed on the acquired bright field image and dark field image to obtain the multi-view dual-state image dataset, wherein the defect categories include impact and pinhole; S12. Obtain the calibration parameters of the camera used to capture the bright field image and the dark field image. Based on the known radius of the engine cylinder liner and the calibration parameters, perform cylindrical projection correction on the bright field image and the dark field image in the multi-view dual-state image dataset to eliminate the defect shape distortion caused by the curved surface of the engine cylinder liner and obtain the corrected dataset. S13. The bright field images and dark field images from different shooting angles belonging to the same engine cylinder liner in the corrected dataset are combined into positive sample pairs, and the bright field images and dark field images belonging to different engine cylinder liners are combined into negative sample pairs, to obtain a multi-view contrast learning sample set with the positive sample pairs and the negative sample pairs. S14. The bright field image and the dark field image contained in the positive sample pair and the negative sample pair in the multi-view contrast learning sample set are simultaneously randomly flipped to obtain a flipped enhanced image; the flipped enhanced image is simultaneously randomly rotated to obtain a rotated enhanced image; the rotated enhanced image is simultaneously randomly scaled to obtain a scaled enhanced image; the scaled enhanced image is simultaneously adjusted for brightness and contrast to obtain a brightness and contrast enhanced image; Gaussian noise is injected into the brightness and contrast enhanced image to obtain the enhanced multi-view contrast learning sample set.

3. The method according to claim 1, characterized in that, The method uses the YOLOv11 network as a baseline, embeds spectral adaptive channel attention modules into multiple feature levels of the YOLOv11 network backbone, and uses gated cross-scale connections. The channel attention weights output by the spectral adaptive channel attention modules corresponding to higher feature levels are convolved and activated, then multiplied channel-by-channel with the input features of the spectral adaptive channel attention modules corresponding to adjacent lower feature levels to construct a multi-level collaborative channel attention pyramid, resulting in an initial cylinder liner surface defect detection model, including: S21. Insert the spectrum adaptive channel attention module after the output of the low-level feature layer, the middle-level feature layer, and the high-level feature layer of the backbone network of the YOLOv11 network, respectively; wherein the low-level feature layer, the middle-level feature layer, and the high-level feature layer are feature output layers with different downsampling ratios in the backbone network, and the spectrum adaptive channel attention module is used to adaptively adjust the cross-channel interaction range according to the spectrum information of the input features to enhance the response of the feature channels related to minor defects; S22. Establish the gated cross-scale connection between the backbone network and the neck network of the YOLOv11 network. Multiply the channel attention weights output by the spectrum adaptive channel attention module corresponding to the high-level feature layer by the input features of the spectrum adaptive channel attention module corresponding to the middle-level feature layer through 1×1 convolution and Sigmoid activation, and output the basic cylinder liner surface defect detection model. S23. Based on the basic cylinder liner surface defect detection model, the channel attention weights output by the spectrum adaptive channel attention module corresponding to the middle feature level are multiplied channel by channel by the input features of the spectrum adaptive channel attention module corresponding to the lower feature level after 1×1 convolution and Sigmoid activation, to form the multi-level collaborative channel attention pyramid, and thus obtain the initial cylinder liner surface defect detection model.

4. The method according to claim 1, characterized in that, Based on the enhanced multi-view contrastive learning sample set, the target detection loss and the supervised contrastive loss are calculated. The target detection loss and the supervised contrastive loss are weighted and summed to obtain a joint loss value. Based on this joint loss value, the initial cylinder liner surface defect detection model is trained through backpropagation. An early stopping mechanism is employed to monitor preset verification indicators. Training stops when the preset verification indicators do not improve within a preset evaluation period, and the engine cylinder liner surface defect detection model is output, including: S31. Load the pre-trained weights of the YOLOv11 network on the general object detection dataset and initialize the backbone network parameters of the initial cylinder liner surface defect detection model; S32. Input the enhanced multi-view contrast learning sample set into the initial cylinder liner surface defect detection model for forward propagation to obtain the detection prediction result, and extract the defect feature vector output by each of the spectrum adaptive channel attention modules after global pooling. S33. Based on the detection prediction results and the annotation information in the enhanced multi-view contrast learning sample set, the target detection loss is calculated using the native detection loss function of the YOLOv11 network. The supervised contrast loss is calculated based on the defect feature vector and the positive and negative sample pairs in the enhanced multi-view contrast learning sample set. The target detection loss and the supervised contrast loss are weighted and summed to obtain the joint loss value. The parameters of the initial cylinder liner surface defect detection model are updated through backpropagation based on the joint loss value. S34. Use cosine annealing learning rate to schedule the training for a preset number of rounds and monitor the preset verification index. When the monitored preset verification index does not improve within a preset evaluation period, trigger early stop. Save the initial cylinder liner surface defect detection model at the time of triggering the early stop step as the optimal model and output the optimized engine cylinder liner surface defect detection model.

5. The method according to claim 4, characterized in that, The formula for calculating the supervised comparison loss is: in, To monitor and compare loss values, The index for the anchor point sample. The index of the defect feature vector of the positive sample. and The defect feature vectors are the images of the same engine cylinder liner from different viewpoints. Union The defect feature vectors traversed in the process, The cosine similarity function is used. For temperature hyperparameters, For traversing the union The index of all defect feature vectors in the dataset. To and The set of all negative sample defect feature vectors belonging to different engine cylinder liners. To and The set of all positive sample defect feature vectors belonging to the same engine cylinder liner. The number of defect feature vectors in the set of positive samples.

6. The method according to claim 1, characterized in that, The process involves acquiring a single-view image of the engine cylinder liner to be detected, inputting the single-view image into the engine cylinder liner surface defect detection model, extracting defect feature maps from the single-view image using the channel attention pyramid, parsing candidate detection boxes, defect categories, and confidence scores from the defect feature maps, deduplicating the candidate detection boxes, and outputting the defect category, bounding box, and confidence score of the engine cylinder liner. S41. Scale the single-view image of the engine cylinder liner to a preset resolution and perform normalization processing to obtain a normalized engine cylinder liner image. S42. Input the normalized engine cylinder liner image into the engine cylinder liner surface defect detection model, and perform multi-level feature extraction and spectrum adaptive channel attention enhancement through the channel attention pyramid to obtain a predicted feature map. S43. Perform a convolution operation on the predicted feature map to generate a classification prediction tensor and a regression prediction tensor; perform Softmax activation on the classification prediction tensor to obtain the class probability of each candidate detection box; decode based on the regression prediction tensor and preset anchor boxes to obtain the bounding box coordinates and confidence scores of each candidate detection box; combine the class probability, the confidence score, and the bounding box coordinates to obtain candidate detection boxes with class, confidence, and location information; S44. Filter the candidate detection boxes whose confidence level is lower than the preset confidence threshold, calculate the overlap between the remaining candidate detection boxes and the candidate detection box with the highest confidence level, remove the candidate detection boxes whose overlap level exceeds the preset overlap threshold, and obtain the defect category, the bounding box and the confidence level.

7. An engine cylinder liner defect detection system based on an improved YOLOv11, used to implement the method described in any one of claims 1 to 6, characterized in that, include: A multi-view dual-state image acquisition and preprocessing module is used to acquire bright-field and dark-field images of the engine cylinder liner from multiple angles, annotate defects in the bright-field and dark-field images to obtain a multi-view dual-state image dataset; perform cylindrical projection correction on the bright-field and dark-field images in the multi-view dual-state image dataset to obtain a corrected dataset; and construct a multi-view contrast learning sample set with positive and negative sample pairs based on the corrected dataset. Data augmentation is performed on the multi-view contrast learning sample set to obtain an augmented multi-view contrast learning sample set. The initial cylinder liner surface defect detection model construction module is used to embed a spectrum adaptive channel attention module into multiple feature levels of the backbone network of the YOLOv11 network as a baseline. Through gated cross-scale connection, the channel attention weights output by the spectrum adaptive channel attention module corresponding to the higher feature level are multiplied by the input features of the spectrum adaptive channel attention module corresponding to the adjacent lower feature level after convolution and activation, so as to construct a multi-level collaborative channel attention pyramid and obtain the initial cylinder liner surface defect detection model. The model training module is used to calculate the target detection loss and the supervised contrast loss based on the enhanced multi-view contrast learning sample set, perform a weighted summation of the target detection loss and the supervised contrast loss to obtain a joint loss value, train the initial cylinder liner surface defect detection model through backpropagation based on the joint loss value, and adopt an early stop mechanism to monitor the preset verification index. When the preset verification index does not improve within the preset evaluation period, the training stops and the engine cylinder liner surface defect detection model is output. The defect detection inference module is used to acquire a single-view image of the engine cylinder liner to be detected, input the single-view image of the engine cylinder liner into the engine cylinder liner surface defect detection model, extract the defect feature map of the single-view image of the engine cylinder liner through the channel attention pyramid, parse the candidate detection box, defect category and confidence from the defect feature map, remove duplicates from the candidate detection boxes, and output the defect category, bounding box and confidence of the engine cylinder liner.