Automatic laser marking quality evaluation method based on machine vision

By using image segmentation and coding networks FastSAM and EfficientViT, combined with ArcFace angular interval classification, the accuracy and real-time performance issues of laser marking quality inspection are solved, achieving efficient character region extraction and defect recognition, suitable for high-precision, high-throughput laser marking production scenarios.

CN121962031APending Publication Date: 2026-05-01ZHEJIANG INNOVATION LASER EQUIP CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
ZHEJIANG INNOVATION LASER EQUIP CO LTD
Filing Date
2025-12-29
Publication Date
2026-05-01

AI Technical Summary

Technical Problem

Existing laser marking quality inspection methods are insufficient in terms of accuracy, automation level, real-time processing capability, and defect expression capability, making it difficult to meet the needs of high-precision, fast-paced, and diverse industrial applications. In particular, there are technical bottlenecks in complex structure extraction, fine-grained defect discrimination, and adaptive quality expression.

Method used

A FastSAM-based image segmentation network is used for region segmentation. Combined with the EfficientViT image coding network and the ArcFace angular interval classification module, a unified automatic evaluation method for labeled images is constructed to achieve accurate extraction of character regions, defect identification, and quality level scoring. Standardized results are output through multi-dimensional scoring indicators.

Benefits of technology

It significantly improves the accuracy and robustness of area detection, enhances the ability to recognize character structures under complex working conditions, reduces the false judgment rate, supports real-time online detection, and is suitable for high-precision, high-throughput laser marking production scenarios, achieving stable and rapid character quality detection and evaluation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121962031A_ABST
    Figure CN121962031A_ABST
Patent Text Reader

Abstract

The invention discloses a laser marking quality automatic evaluation method based on machine vision. The method comprises the following steps of S1, collecting a laser marking image and performing preprocessing; s2, inputting the preprocessed image into an image segmentation network constructed based on FastSAM to generate a segmentation mask image; s3, extracting a marking area communication block according to the segmented mask image, and constructing an image sub-area set; s4, normalizing the sizes of the image sub-regions, constructing three-channel enhanced input, inputting the three-channel enhanced input into an image coding network constructed based on the OfficientViT, and extracting an image-level feature vector; s5, inputting the image-level feature vector into an ArcFace angle interval classification module, and outputting a defect type classification result; s6, calculating a multi-dimensional quality scoring index; and S7, inputting the multi-dimensional quality scoring indexes into a weighting function to generate a comprehensive scoring result, comparing the comprehensive scoring result with a qualified threshold, and outputting an evaluation result. According to the method, a region perception image segmentation strategy and a lightweight feature coding mechanism are combined, and automatic identification and quality evaluation of character defects in the laser marking image are realized.
Need to check novelty before this filing date? Find Prior Art

Description

An Automatic Quality Assessment Method for Laser Marking Based on Machine Vision Technical Field

[0001] This invention relates to the fields of machine vision and intelligent quality inspection technology, and in particular to an automatic quality assessment method for laser marking based on machine vision. Background Technology

[0002] With the development of intelligent manufacturing and industrial automation, laser marking, as a highly efficient and non-contact precision processing method, has been widely used in various fields such as electronics, automobiles, medical devices, and consumer goods. Laser marking equipment can quickly mark information such as QR codes, characters, patterns, and serial numbers on the surfaces of different materials such as metals, plastics, glass, and ceramics. However, although the laser marking process itself has matured, the inspection of marking quality still heavily relies on manual visual inspection or traditional image processing algorithms, which has gradually exposed several bottlenecks and problems in high-throughput production scenarios.

[0003] Currently, mainstream marking quality inspection methods include manual sampling, image template matching-based judgment mechanisms, and simple grayscale / edge threshold analysis. These methods typically rely on comparing a set reference template image with the actual image or using edge detection operators to detect the contours of characters. However, their accuracy is severely limited for complex marking patterns, low-contrast characters, or images with interference such as light spots or deformation. Especially in scenarios with fine character strokes and large font scaling variations, traditional methods struggle to cover all variations with static templates, resulting in low defect recognition rates and high false positive rates. Manual visual inspection is prone to visual fatigue and inconsistent judgment standards when facing high-intensity continuous production, leading to increased missed detection rates and inspection efficiency limited by the pace of manual processing. Furthermore, traditional quality inspection systems generally lack adaptive capabilities, failing to dynamically adjust the recognition model based on product batch differences or environmental changes. They also struggle to record defect types, scoring standards, and real-time traceability information, affecting the system's versatility and factory integration level.

[0004] On the other hand, in existing visual quality inspection systems, the image processing module often separates the detection of marked regions from subsequent defect identification and quality assessment processes, lacking unified modeling and semantic coordination between modules. Insufficient segmentation accuracy leads to incomplete character region extraction or the inclusion of redundant background information, affecting the accuracy of subsequent feature extraction and classification. Furthermore, most existing systems rely on shallow image descriptors (such as grayscale statistics, edge density, and region mean) for feature modeling, lacking deep semantic perception mechanisms for structural defects (such as broken strokes, ghosting, and unprinted areas). Even when some systems introduce deep neural networks for feature extraction, their network structures are often lengthy and computationally intensive, unsuitable for real-time online quality inspection scenarios. In addition, classifiers often use traditional softmax layers or fully connected layers for output, failing to effectively distinguish the boundaries between highly similar categories, thus affecting the accurate classification of ambiguous or abnormal characters.

[0005] To address the aforementioned issues, this invention proposes an automatic quality assessment method for laser marking based on machine vision. The system designs the entire process from image preprocessing, region segmentation, feature encoding to quality scoring, and constructs a unified modeling framework from character localization to defect identification. In the image region extraction stage, an image segmentation network based on FastSAM is employed. Through a multi-scale attention mechanism and category query vectors, a segmentation mask is jointly generated, enabling accurate identification of marking regions in complex materials and low-contrast images, while eliminating background interference regions and improving character segmentation accuracy. In the feature modeling stage, an image encoding network based on EfficientViT is introduced, combining local attention and hierarchical feature fusion mechanisms to preserve character structure and edge details while maintaining computational efficiency, constructing highly expressive image-level feature vectors. For defect classification, this invention further introduces an ArcFace angular interval classification module, constructing the classification boundary in the feature vector angular space. By adjusting the angular interval to adjust the separation of different category centers, the ability to distinguish between similar categories (such as slightly broken strokes and blurred characters) is significantly enhanced, improving classification robustness.

[0006] Furthermore, during the quality assessment phase, this invention constructs multi-dimensional scoring indicators for each character region, including edge contrast, structural integrity, center offset, and region density. A weighted scoring function outputs a comprehensive quality score, which is then compared with a set threshold to achieve character-level and image-level quality judgment and result feedback. The entire system supports standardized output of defect types, locations, and scoring records, facilitating integration with MES systems for quality traceability. The system as a whole possesses adaptive capabilities, high module integration, and low computational resource requirements, making it suitable for the real-time online inspection needs of industrial production lines.

[0007] In summary, existing laser marking quality inspection methods have significant shortcomings in terms of accuracy, automation level, real-time processing capability, and defect representation ability, making it difficult to meet the demands of high-precision, fast-paced, and diverse industrial applications. The method proposed in this invention optimizes and innovates key aspects such as image segmentation accuracy, structural feature representation, defect classification and discrimination boundaries, and multi-dimensional scoring models, constructing a unified automatic evaluation technology path for marked images. This method has clear specificity and strong practical engineering feasibility. Summary of the Invention

[0008] One objective of this invention is to propose an automatic quality assessment method for laser marking based on machine vision. This invention integrates region-aware segmentation modeling, edge-guided feature enhancement, a lightweight attention encoding mechanism, and angular interval classification, systematically achieving accurate extraction of laser-marked character regions, defect identification, and quality level scoring. It constructs an integrated intelligent assessment system of "localization-modeling-discrimination-scoring." This method boasts advantages such as high recognition accuracy, strong real-time performance, and low false positive rate, overcoming the technical bottlenecks of traditional quality inspection methods in complex structure extraction, fine-grained defect discrimination, and adaptive quality expression. It is suitable for high-precision, high-throughput laser marking production scenarios, enabling stable, rapid, and standardized detection and evaluation of character quality.

[0009] An automatic quality assessment method for laser marking based on machine vision according to an embodiment of the present invention includes the following steps: S1, acquiring image data after laser marking using an industrial camera and preprocessing it; S2, inputting the preprocessed image data into an image segmentation network constructed based on FastSAM to generate a segmentation mask image, wherein the segmentation mask image contains the marking region; S3, extracting connected components of the marking region from the segmentation mask image to construct a set of marking region images; S4, normalizing the size of the set of marking region images, calculating the edge response map and the inverse edge response map, constructing a three-channel enhanced input, and inputting based on E... The fficientViT image coding network extracts the final coding feature vector and constructs a set of image-level feature vectors for all image sub-regions; S5, the constructed set of image-level feature vectors is input into the ArcFace angular interval classification module to calculate the cosine similarity between the image feature vectors and each preset defect center vector, and outputs the defect type classification result; S6, a multi-dimensional quality score index is calculated based on the defect type classification result and the labeled area image; S7, the multi-dimensional quality score index is input into the weighted scoring function to generate a comprehensive quality score result, which is compared with a preset qualified threshold to output the labeling quality evaluation result.

[0010] Optionally, the preprocessing specifically includes performing grayscale normalization, adaptive histogram equalization, and Gaussian filtering denoising on the acquired image data in sequence.

[0011] Optionally, the image segmentation network based on FastSAM consists of an image block partitioning layer, an attention calculation layer, and a mask generation layer. The image block partitioning layer is used to divide the preprocessed laser marking image into multiple image blocks to form an input sequence. The attention calculation layer performs attention update operations on the value vectors of the image blocks based on a lightweight Transformer structure to obtain the output feature vectors of the image blocks. The mask generation layer generates a segmentation mask image based on the output feature vectors of the image blocks and the category query vector. The segmentation mask image has the same pixel count as the input image and is used to indicate the position of the image sub-region corresponding to the marking area.

[0012] Optionally, S2 specifically includes: S21, processing the preprocessed image data... Input is an image segmentation network built based on FastSAM, where, For the height of the image, S22, Image block division layers divide image data into widths; Divided into Non-overlapping image patches , where each image block Using linear embedding to obtain the first Query vector of image patches , No. Key vectors of image patches and the Value vector of image patches S23, Based on query vector and key vector Dot product calculation of attention weights To measure the degree of correlation between image patches: S24. The attention calculation layer performs the attention update operation based on the attention weights. Perform weighted aggregation on the value vector to generate the updated value vector. Each image patch outputs a feature vector. : S25. Output feature vector The input mask generation layer generates a segmentation mask image with the same pixel count as the input image. ,in This indicates that the pixel belongs to the laser marking area. This indicates that the pixel belongs to the background area.

[0013] Optionally, S3 specifically includes: S31, segmenting the mask image. Perform connected component analysis to extract connected components from all labeled regions. And calculate the minimum bounding rectangle of the connected components of each marked region: ;in, For the first The coordinates of the minimum bounding rectangle of a connected component. For the first The minimum x-coordinate in a connected component. For the first The minimum value of the ordinate in a connected component. For the first The maximum value of the x-coordinate in each connected component. For the first The maximum value of the y-coordinate in each connected component. S32 represents the total number of connected components; S32 represents the boundary coordinates corresponding to each minimum bounding rectangle. Cropping image sub-regions from the original image within the specified range The set of images representing the marked regions .

[0014] Optionally, the image coding network based on EfficientViT consists of an image segmentation layer, a local attention calculation layer, and a feature fusion layer.

[0015] Optionally, S4 specifically includes: S41, processing the set of images of the marked area. Each image sub-region Perform size adaptive padding to meet the uniform input size. Obtain the size-normalized image. ,in, , These are the normalized height and width of the image, respectively. S42, the number of image sub-regions; normalized image size. Calculate the edge response map: ;in, For the first Each image sub-region at pixel point The edge response amplitude at a given point represents the edge sharpness, and is calculated using a Sobel lateral convolution kernel. Each image sub-region at pixel point lateral gradient value at With longitudinal gradient value S43. Normalize the image size. Edge response map With reverse edge response map Perform channel-level fusion to construct a three-channel enhanced input: ;in, S44, will The image is fed into an image coding network built on EfficientViT, and the image partitioning layer will... Divided into Image blocks Each image patch is sized as follows: And mapped to an embedding vector ,in, The image patch size; S45, the local attention computation layer performs attention mechanism updates on the embedding vector: ;in, This is the intermediate representation of the embedded vector after the attention mechanism update. Attention weights: ;in, , , These are the weight matrices for query, key, and value mapping, respectively; S46, feature fusion layer pairs. Applying depthwise separable convolution operations yields convolution-enhanced feature vectors. ,Will With embedding vector Perform residual connections to obtain image sub-regions. The Middle The final encoded feature vector of each image patch : S47. The final encoded feature vector set Restored to a two-dimensional feature map ,right Perform global average pooling and max pooling operations, and then stitch them together to form image sub-regions. Corresponding image-level feature vector : Construct a set of image-level feature vectors for all image sub-regions. .

[0016] Optionally, the ArcFace angular interval classification module introduces an angular interval parameter between the image-level feature vector of the image sub-region and the center vector of each defect category to construct a classification boundary with angular interval constraints, so that different defect types can form a greater class separation in the feature angle space.

[0017] Optionally, S5 specifically includes: S51, on... Image-level feature vectors of each image sub-region Input is fed into the ArcFace angular interval classification module, and then... Perform normalization to obtain a unit vector representation. S52. Preset the category center vector corresponding to each defect type. Normalize it to satisfy S53. Calculate the unit eigenvector. With each category center vector Cosine similarity between them: S54, Regarding the category of belonging Corresponding angle Introducing angular intervals and combined with scaling factor Generate a dataset with discriminative boundaries. value: S55, Constructing a system that introduces angular interval terms. The classification structure yields the probability output of the image sub-region under all preset defect types: ;in, For the first The image sub-region was determined to be the... Predicted probability of each defect type , S56. Output the number of defect types based on the category index corresponding to the highest probability. Defect type classification results for each image sub-region.

[0018] Optionally, the multidimensional quality scoring indicators include sharpness score, outline integrity score, character offset score, and local contrast score.

[0019] The beneficial effects of this invention are as follows: First, by constructing an evaluation process integrating image segmentation, edge enhancement, deep coding, and feature classification, this invention solves key problems in existing laser marking quality inspection systems, such as template-dependent region extraction, unclear boundary recognition, and insufficient feature representation capabilities. Especially under complex conditions such as morphological changes, edge breaks, and low-contrast interference in the marked characters, this invention effectively identifies and extracts valid character structures in the marked region by introducing an image segmentation network with category guidance capabilities. This significantly improves the accuracy and robustness of region detection, avoids the positioning errors of traditional static template matching under different materials or complex backgrounds, and provides high-quality region input support for subsequent feature modeling.

[0020] Secondly, this invention explicitly enhances the structural information in image sub-regions by constructing edge response maps and inverse response maps and performing three-channel fusion. It is particularly sensitive to the expression of local texture details such as character edges and stroke directions, enabling the encoding network to extract discriminative deep feature representations while maintaining a lightweight computational structure. The local attention mechanism and hierarchical fusion strategy introduced in the image encoding stage further improve the model's adaptability to local morphological changes and scale differences in characters, solving the problems of poor stability and weak generalization ability of existing feature extraction schemes in encoding characters with weak boundaries and characters of varying sizes.

[0021] Furthermore, the angular interval classification module proposed in this invention effectively solves the problem of blurred classification boundaries between highly similar categories by constructing classification boundaries in the feature angle space. Based on feature vector normalization and category center constraints, the angular interval parameter is introduced to adjust the category interval, constructing a discrete angular distribution boundary. This enables the model to have higher discriminative ability when handling similar defect types such as blurriness, broken strokes, and slight stretching. Compared with the traditional softmax classifier, this structure exhibits superior category separation performance in practical deployments, with a significantly reduced false positive rate, making it suitable for high-precision recognition scenarios where multiple minor anomalies coexist.

[0022] Furthermore, this invention constructs a scoring system in the quality scoring module that includes multiple quality dimensions such as edge sharpness, structural integrity, regional symmetry, and character centroid offset. A unified weighted scoring function is used to achieve both character-level quality scoring and image-level comprehensive evaluation. This mechanism not only outputs standardized scoring results, facilitating internal quality control audits and defect tracing, but also supports flexible setting of scoring thresholds to adapt to different application standards. This enables a continuous, automated process from "defect identification" to "quality judgment," overcoming the limitation of existing systems that can only perform binary judgments and cannot measure quality levels.

[0023] Finally, the system of this invention has a simple overall computational structure, high edge inference efficiency, and supports seamless integration with MES systems or equipment control modules, making it well-suited for industrial engineering deployment. In a 30-day continuous production line test, the system maintained an average processing time of less than 45 milliseconds, an accuracy rate exceeding 96%, a significant reduction in rework rate, and a reduction in manpower input for quality inspection exceeding 30%. Overall, this invention achieves intelligent transformation of the entire process from image acquisition, region extraction, feature modeling, defect identification to quality scoring, promoting the upgrade of laser marking quality inspection from traditional experience-based manual judgment to structured, quantifiable, and automated intelligent evaluation, demonstrating good engineering adaptability and industrial application value. Attached Figure Description

[0024] The accompanying drawings are provided to further illustrate the invention and form part of the specification. They are used in conjunction with embodiments of the invention to explain the invention and do not constitute a limitation thereof. In the drawings:

[0025] Figure 1 is an overall flowchart of an automatic laser marking quality evaluation method based on machine vision proposed in this invention; Figure 2 is a schematic diagram of the image segmentation network based on FastSAM in the automatic laser marking quality evaluation method based on machine vision proposed in this invention; Figure 3 is a schematic diagram of the image coding network based on EfficientViT in the automatic laser marking quality evaluation method based on machine vision proposed in this invention. Detailed Implementation

[0026] The present invention will now be described in further detail with reference to the accompanying drawings. These drawings are simplified schematic diagrams, illustrating only the basic structure of the invention, and therefore only show the components relevant to the invention.

[0027] Referring to Figures 1-3, an automatic quality assessment method for laser marking based on machine vision includes the following steps: S1, acquiring image data after laser marking using an industrial camera and preprocessing it; S2, inputting the preprocessed image data into an image segmentation network based on FastSAM to generate a segmentation mask image, wherein the segmentation mask image contains the marking region; S3, extracting connected components of the marking region from the segmentation mask image to construct a set of marking region images; S4, normalizing the size of the set of marking region images and calculating the edge response map and the inverse edge response map to construct a three-channel enhanced input, the input being based on Ef... The ficientViT-built image coding network extracts the final coding feature vector and constructs a set of image-level feature vectors for all image sub-regions; S5, the constructed set of image-level feature vectors is input into the ArcFace angular interval classification module to calculate the cosine similarity between the image feature vectors and each preset defect center vector, and outputs the defect type classification result; S6, a multi-dimensional quality scoring index is calculated based on the defect type classification result and the labeled area image; S7, the multi-dimensional quality scoring index is input into the weighted scoring function to generate a comprehensive quality score result, which is compared with a preset qualified threshold to output the labeling quality evaluation result.

[0028] In this embodiment, the preprocessing specifically includes performing grayscale normalization, adaptive histogram equalization, and Gaussian filtering noise reduction on the acquired image data in sequence.

[0029] By sequentially performing grayscale normalization, adaptive histogram equalization, and Gaussian filtering on the acquired image data, the contrast consistency and edge detail discernibility of the original image are significantly improved. Grayscale normalization eliminates grayscale shifts caused by different lighting conditions, resulting in a more uniform grayscale distribution. Adaptive histogram equalization enhances local contrast, especially in low-brightness areas, helping subsequent algorithms to more clearly separate character and background regions. Gaussian filtering effectively suppresses random noise interference while preserving the overall smoothness of the image structure, preventing noise from misleading edge detection or segmentation judgments. This combined preprocessing scheme provides a stable and clear input foundation for the image segmentation and feature extraction modules, enhances the system's robustness under different shooting conditions, improves the stability and accuracy of subsequent segmentation and encoding networks, and effectively solves the interference caused by uneven lighting and high noise in the original image on the overall quality assessment process.

[0030] In this embodiment, the image segmentation network based on FastSAM consists of an image block partitioning layer, an attention calculation layer, and a mask generation layer. The image block partitioning layer is used to divide the preprocessed laser marking image into multiple image blocks to form an input sequence. The attention calculation layer performs attention update operations on the value vectors of the image blocks based on a lightweight Transformer structure to obtain the output feature vectors of the image blocks. The mask generation layer generates a segmentation mask image based on the output feature vectors of the image blocks and the category query vector. The segmentation mask image has the same pixels as the input image and is used to indicate the position of the image sub-region corresponding to the marking area.

[0031] By deeply integrating image segmentation, attention computation, and mask generation into an image segmentation network based on FastSAM, the accuracy and adaptability of target region extraction in laser-marked images are significantly improved. The image block segmentation layer structures the original image into a continuous input sequence, enhancing the model's ability to perceive spatial context. The attention computation layer introduces a lightweight Transformer structure, achieving joint modeling of local and global features while maintaining computational efficiency, effectively capturing the semantic relationships between character regions. The mask generation layer introduces a category query vector to achieve precise mapping from the output feature vector to the segmentation mask, enhancing the model's ability to recognize the boundaries of the marked region. The overall network maintains pixel-level mask alignment accuracy while possessing good generalization ability and structural constraints, overcoming the sensitivity of traditional template matching and edge detection methods to character morphology, illumination changes, and background interference, providing a stable input foundation for subsequent high-quality feature extraction and defect classification of character regions.

[0032] In this embodiment, S2 specifically includes: S21, processing the preprocessed image data... Input is an image segmentation network built based on FastSAM, where, For the height of the image, S22, Image block division layers divide image data into widths; Divided into Non-overlapping image patches , where each image block Using linear embedding to obtain the first Query vector of image patches , No. Key vectors of image patches and the Value vector of image patches S23, Based on query vector and key vector Dot product calculation of attention weights To measure the degree of correlation between image patches: S24. The attention calculation layer performs the attention update operation based on the attention weights. Perform weighted aggregation on the value vector to generate the updated value vector. Each image patch outputs a feature vector. : S25. Output feature vector The input mask generation layer generates a segmentation mask image with the same pixel count as the input image. ,in This indicates that the pixel belongs to the laser marking area. This indicates that the pixel belongs to the background area.

[0033] By inputting preprocessed laser-marked images into an image segmentation network based on FastSAM, a segmentation mask image containing the marked regions is generated, achieving high-precision automatic extraction of target character regions. This segmentation network utilizes a multi-scale attention mechanism and a category-guided query strategy, independent of manually set templates or fixed thresholds, and can flexibly adapt to marked images under different materials, lighting conditions, and background interference. Compared to traditional edge detection or region growing methods, this network possesses stronger context modeling and boundary representation capabilities, maintaining stable region recognition performance even in scenarios with blurred character edges and complex background textures. The segmentation output mask image is pixel-aligned with the original image, ensuring the positioning accuracy of subsequent cropping operations, thus providing an accurate spatial basis for further analysis and feature extraction of character regions. This method effectively overcomes the shortcomings of existing marked region extraction methods in terms of transferability, stability, and accuracy, establishing a high-quality input guarantee for subsequent defect identification and quality assessment.

[0034] In this embodiment, S3 specifically includes: S31, segmenting the mask image. Perform connected component analysis to extract connected components from all labeled regions. And calculate the minimum bounding rectangle of the connected components of each marked region: ;in, For the first The coordinates of the minimum bounding rectangle of a connected component. For the first The minimum x-coordinate in a connected component. For the first The minimum value of the ordinate in a connected component. For the first The maximum value of the x-coordinate in each connected component. For the first The maximum value of the y-coordinate in each connected component. S32 represents the total number of connected components; S32 represents the boundary coordinates corresponding to each minimum bounding rectangle. Cropping image sub-regions from the original image within the specified range The set of images representing the marked regions .

[0035] By extracting connected components of the labeled regions from the segmented mask image and constructing a set of image sub-regions, the system effectively achieves precise segmentation from image-level mask to character-level image sub-regions. By analyzing the connected regions in the mask image, the system can automatically identify multiple independent character or pattern structures, avoiding the uncertainty and poor adaptability issues caused by manually setting cropping rules. This processing method not only improves the integrity and separation of character regions but also adaptively adjusts the cropping quantity and position according to the actual character arrangement, adapting to layout changes of different types of labeled content. Furthermore, this method preserves the original image resolution and position information during region extraction, ensuring spatial consistency in subsequent normalization and feature encoding stages. Compared to traditional cropping methods based on fixed-window or sliding-window strategies, this step possesses higher positioning accuracy and structural adaptability, significantly improving the system's discrimination foundation in fine-grained character defect analysis scenarios.

[0036] In this embodiment, the image coding network based on EfficientViT consists of an image segmentation layer, a local attention calculation layer, and a feature fusion layer.

[0037] The image coding network based on EfficientViT consists of an image partitioning layer, a local attention computation layer, and a feature fusion layer. This design maintains a lightweight model while balancing image detail representation and spatial context modeling capabilities, demonstrating significant engineering practicality and performance advantages. The image partitioning layer divides the standardized image into fixed-size image blocks, enabling the model to perceive local structural information within character regions with finer granularity, providing a stable distribution foundation for subsequent feature modeling. The local attention computation layer captures feature dependencies between local regions using a windowing approach, avoiding the computational bottleneck of global attention mechanisms in high-resolution image processing, while effectively preserving key details such as character edges and transitions. The feature fusion layer enhances the spatial consistency and representational ability of features through multi-scale context fusion and cross-layer residual connections, improving the model's ability to distinguish minor defects such as complex character structures, broken strokes, and blurring. Overall, this network structure exhibits low computational consumption and high classification accuracy in practical deployments, making it suitable for real-time quality assessment tasks in high-throughput pipeline environments.

[0038] In this embodiment, S4 specifically includes: S41, processing the set of images of the marked area. Each image sub-region Perform size adaptive padding to meet the uniform input size. Obtain the size-normalized image. ,in, , These are the normalized height and width of the image, respectively. S42, the number of image sub-regions; normalized image size. Calculate the edge response map: ;in, For the first Each image sub-region at pixel point The edge response amplitude at a given point represents the edge sharpness, and is calculated using a Sobel lateral convolution kernel. Each image sub-region at pixel point lateral gradient value at With longitudinal gradient value S43. Normalize the image size. Edge response map With reverse edge response map Perform channel-level fusion to construct a three-channel enhanced input: ;in, S44, will The image is fed into an image coding network built on EfficientViT, and the image partitioning layer will... Divided into Image blocks Each image patch is sized as follows: And mapped to an embedding vector ,in, The image patch size; S45, the local attention computation layer performs attention mechanism updates on the embedding vector: ;in, This is the intermediate representation of the embedded vector after the attention mechanism update. Attention weights: ;in, , , These are the weight matrices for query, key, and value mapping, respectively; S46, feature fusion layer pairs. Applying depthwise separable convolution operations yields convolution-enhanced feature vectors. ,Will With embedding vector Perform residual connections to obtain image sub-regions. The Middle The final encoded feature vector of each image patch : S47. The final encoded feature vector set Restored to a two-dimensional feature map ,right Perform global average pooling and max pooling operations, and then stitch them together to form image sub-regions. Corresponding image-level feature vector : Construct a set of image-level feature vectors for all image sub-regions. .

[0039] By normalizing the size of sub-regions in the labeled image and introducing edge response maps and inverse response maps to construct a three-channel enhanced input, the structural details and boundary features of the character regions can be explicitly enhanced, effectively improving the information density of the image before encoding. Subsequently, this enhanced input is fed into an image encoding network based on EfficientViT. The network structure consists of an image segmentation layer, a local attention computation layer, and a feature fusion layer, possessing strong spatial detail modeling capabilities and lightweight computational advantages. During the encoding process, the local attention mechanism can focus on key character regions, avoiding background interference. The feature fusion layer further enhances the model's ability to express subtle defects such as broken strokes, blurring, and missing edges by integrating multi-scale contextual information. Overall, this step achieves efficient encoding from image sub-regions to image-level features, providing stable and discriminative feature representations for subsequent defect classification and quality scoring, significantly enhancing the system's adaptability and recognition accuracy for complex character images.

[0040] In this embodiment, the ArcFace angular interval classification module introduces an angular interval parameter between the image-level feature vector of the image sub-region and the center vector of each defect category to construct a classification boundary with angular interval constraints, so that different defect types can form a greater class separation in the feature angle space.

[0041] By introducing an angular interval parameter between the image-level feature vectors of image sub-regions and the center vectors of each defect category, a discrete classification boundary can be formed in the feature angle space, thereby improving the discrimination ability between highly similar defect categories. Compared with the traditional softmax classification method, this module has higher discrimination accuracy for defect types with blurred boundaries such as blurry, broken strokes, and misalignments, effectively reducing the false positive rate and enhancing classification robustness. This method is particularly suitable for complex marking and quality inspection scenarios with similar character structures and a large number of categories, significantly improving the overall recognition accuracy and usability of the system.

[0042] In this embodiment, S5 specifically includes: S51, ... Image-level feature vectors of each image sub-region Input is fed into the ArcFace angular interval classification module, and then... Perform normalization to obtain a unit vector representation. S52. Preset the category center vector corresponding to each defect type. Normalize it to satisfy S53. Calculate the unit eigenvector. With each category center vector Cosine similarity between them: S54, Regarding the category of belonging Corresponding angle Introducing angular intervals and combined with scaling factor Generate a dataset with discriminative boundaries. value: S55, Constructing a system that introduces angular interval terms. The classification structure yields the probability output of the image sub-region under all preset defect types: ;in, For the first The image sub-region was determined to be the... Predicted probability of each defect type , S56. Output the number of defect types based on the category index corresponding to the highest probability. Defect type classification results for each image sub-region.

[0043] An ArcFace angular interval classification module is employed to classify defect types from image-level feature vectors. By introducing an angular interval mechanism into the feature space to construct a discrimination boundary, the model's ability to distinguish between similar defect categories is significantly enhanced. Compared to traditional softmax classification methods, this module first normalizes the input features and category center vectors, and uses a cosine angle to measure the relative distance between categories, effectively avoiding classification instability caused by fluctuations in feature amplitude. Introducing the angular interval parameter allows for artificial expansion of the discrimination interval in the direction corresponding to the target category, improving the discreteness of feature distribution in the angular space. This results in clearer classification boundaries for different defect types at the feature level, reducing the risk of misclassification between highly similar categories. Furthermore, this classification module possesses good interpretability and adjustability, allowing for flexible setting of the interval parameter and scaling coefficient according to actual applications, improving the model's accuracy and controllability in recognizing multiple minor defects in industrial scenarios. Overall, the ArcFace angular interval classification structure not only improves classification accuracy but also enhances the model's robustness to abnormal feature distributions, making it suitable for high-standard, low-fault-tolerance automated quality inspection tasks.

[0044] In this embodiment, the multidimensional quality scoring indicators include sharpness score, outline integrity score, character offset score, and local contrast score.

[0045] A multi-dimensional quality scoring system is introduced, covering key visual dimensions such as sharpness, outline integrity, character offset, and local contrast, comprehensively reflecting the imaging quality and structural stability of marked characters. By quantifying the scoring of different types of defects, not only is the identification of single defects shifted to fine-grained quality judgment, but the interpretability and traceability of quality assessment results are also improved. This scoring system can flexibly adapt to different process standards and application requirements, supporting automatic threshold setting and multi-level graded output, providing a data foundation and decision support for building a highly consistent, low-false-judgment-rate automated quality inspection system.

[0046] Example 1: To verify the feasibility and application effect of the present invention in a real industrial scenario, the automatic quality assessment method for laser marking based on machine vision proposed in this invention was deployed on an automated marking production line of a laser equipment manufacturing company in South China. This production line serves the customized marking needs of multiple customers. Typical marking objects include character areas on the surfaces of smart electronic product casings, metal nameplates, lithium battery casings, medical device components, and small molds. These characters include various formats such as QR codes, English letters, numbers, production batch numbers, and icons. The character height ranges from 1.2mm to 6.5mm, with clear edges and an error control within ±0.3mm. The marking system completes an average of approximately 45 marking tasks per minute, and the equipment operates continuously for more than 18 hours per day, placing high demands on the real-time performance, accuracy, and stability of the online quality inspection system.

[0047] This company had long relied on manual sampling combined with a fixed-threshold image processing strategy for product marking quality inspection. Manual inspection methods suffer from low accuracy under complex conditions such as small characters, weak edges, and uneven lighting, and are particularly ineffective at promptly capturing minute defects such as broken strokes, overflows, elongations, and positional misalignments. Furthermore, frequent misjudgments and missed inspections due to operator fatigue led to a persistently high rework rate, severely impacting production line continuity and product consistency, resulting in a monthly increase in customer complaints. To address these issues, the company collaborated with the provider of this technology solution to deploy an automated marking quality assessment system based on depth visual analysis.

[0048] During implementation, the system uses a customized high-frame-rate industrial camera (model FLIR BFS-U3-50S5C) as the image acquisition unit, installed at the automatic inspection station at the laser marking exit. The acquired images have a resolution of 1920×1080 and a sampling frequency of 30 frames per second. Each acquired frame undergoes adaptive histogram equalization, noise suppression, and illumination normalization preprocessing before being input into an image segmentation network built on the FastSAM framework. This segmentation network integrates a multi-scale attention mechanism and a category query vector generation module, enabling it to identify the marking region based on contextual relationships, separate background regions, non-target textures, and light spot interference information, and output a binary segmentation mask image of consistent size.

[0049] By extracting connected components and cropping coordinates from the masked image, the system automatically constructs a set of character-level image sub-regions, dividing each image into an average of 15 to 22 character sub-images. To enhance the representation of character structure during the encoding stage, the system performs size normalization (unified to 64×64) and three-channel enhancement operations on each image sub-region. The enhancement input includes the original image, edge response map (extracted by the Sobel operator), and inverse edge map, which are combined to form a standardized input tensor. The above inputs are fed into an image encoding network based on EfficientViT. The network integrates a local window attention mechanism and a hierarchical feature fusion strategy, preserving character edge features and shape texture information while maintaining high processing speed, and outputting image-level feature vectors.

[0050] The feature vectors are input into the ArcFace angular interval classification structure and matched with the pre-defined 10 types of defect center vectors at different angles. The final classification results in 10 types of labeled character defects, including blurriness, broken strokes, unprinted areas, ghosting, light spots, overprinting, offset, blurred edges, structural deformation, and stretching misalignment. After classification, the system further evaluates the multi-dimensional quality factors for each character sub-region, including edge sharpness, structural integrity, area deviation ratio, center centroid offset, pixel density, background contrast, and feature retention rate, totaling 7 dimensions, to construct a multi-dimensional quality scoring index vector.

[0051] The scoring results are input into a weighted scoring function jointly defined by engineering experience and data-driven approaches. After normalization and weighting, the final comprehensive score is output and compared with a set pass / fail threshold (e.g., 0.76). If the score is below the threshold, the system marks the character as unqualified and records its defect type and location index. If any character is judged as unqualified, the entire image is rated as unqualified, and the evaluation results are uploaded to the MES system via the OPC-UA interface. At the same time, a defect record file is generated for subsequent traceability.

[0052] The system has been running continuously for 30 days since its deployment, covering product categories including metal nameplates (such as stainless steel), injection-molded plastic shells, and multi-layer composite PET labels. A total of 23,100 image samples were inspected, containing 402,136 character sub-regions. No major anomalies or false triggers occurred. The results compared with manual visual inspection are as follows:

[0053] Table 1. Comparison of Quality Assessment Data between the Invention Solution and Manual Inspection

[0054] As can be seen from the performance data comparison listed in Table 1, the automatic quality evaluation method for laser marking proposed in this invention shows significant advantages over traditional manual inspection methods in several key quality control indicators.

[0055] Firstly, regarding defect identification accuracy, the method of this invention achieves average identification accuracies of 98.4%, 97.1%, and 96.3% for metal nameplates, plastic shells, and composite labels, respectively, significantly outperforming manual inspection's 91.2%, 89.7%, and 87.5%. Taking composite labels as an example, despite their complex marking materials and significant surface reflection interference, this method still maintains a high identification rate of 96.3%, demonstrating the system's good adaptability to characters with blurred boundaries and low contrast. This result indicates that combining attention-based segmentation and local structure encoding strategies can effectively improve the accuracy of character defect identification and reduce the probability of missed detections.

[0056] In terms of processing efficiency, the average single-image processing time of the system of this invention is maintained within 45ms, which is significantly lower than the 160ms to 198ms range required for manual inspection, with the highest efficiency improvement exceeding 4 times. This low-latency, high-concurrency processing capability makes the system suitable for high-speed marking production lines, without accumulation or delay during continuous operation, which helps to ensure stable cycle time and synchronous connection with the downstream packaging process.

[0057] The character-level false positive rate difference, a core indicator for measuring system robustness, showed a reduction of over 7% across all products, with a particularly significant decrease of 8.8% for composite tag categories. This demonstrates that the system effectively addresses issues such as complex background textures, character breaks, and light spot occlusion. By employing deep feature modeling and classification, the system enhances its error suppression capabilities, reducing false rejections and false releases caused by minor interference.

[0058] In actual deployment, the system's accompanying image acquisition and processing framework supports stable operation 24 / 7, featuring breakpoint recovery and image caching mechanisms to ensure data integrity. The system can interface with a Manufacturing Execution System (MES) to achieve automatic tagging, data traceability, and statistical analysis, demonstrating strong feasibility for factory-level deployment. Subsequent feedback from enterprises indicates that after implementing this method, the demand for quality inspection labor decreased by approximately 30%, rework batches were reduced by 4–6 times per day, the production pass rate increased by approximately 4.2%, and the average monthly number of customer complaints decreased by over 40%.

[0059] Therefore, it can be seen that, based on a comprehensive evaluation of multiple dimensions such as defect identification accuracy, processing speed, misjudgment control capability, continuous operation stability and system integration capability, the automatic laser marking quality evaluation method constructed in this invention can effectively solve the long-standing problems of consistency, efficiency and standardization in traditional manual quality inspection, and has a good foundation for industrialization and engineering application value.

[0060] The above description is only a preferred embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any equivalent substitutions or modifications made by those skilled in the art within the scope of the technology disclosed in the present invention, based on the technical solution and inventive concept of the present invention, should be covered within the scope of protection of the present invention.

Claims

1. A machine vision-based automatic quality assessment method for laser marking, characterized in that, The process includes the following steps: S1, acquiring image data after laser marking using an industrial camera and preprocessing it; S2, inputting the preprocessed image data into an image segmentation network based on FastSAM to generate a segmentation mask image, wherein the segmentation mask image contains the marking region; S3, extracting the connected components of the marking region from the segmentation mask image to construct a set of marking region images. S4. Normalize the size of the image set of the marked area, calculate the edge response map and the reverse edge response map, construct a three-channel enhanced input, input it into the image coding network based on EfficientViT, extract the final coding feature vector, and construct the image-level feature vector set of all image sub-regions; S5. Input the constructed image-level feature vector set into the ArcFace angular interval classification module, calculate the cosine similarity between the image feature vector and each preset defect center vector, and output the defect type classification result; S6. Calculate the multi-dimensional quality scoring index based on the defect type classification result and the marked area image; S7. Input the multi-dimensional quality scoring index into the weighted scoring function, generate the comprehensive quality score result, compare it with the preset qualified threshold, and output the marking quality evaluation result.

2. The automatic quality evaluation method for laser marking based on machine vision according to claim 1, characterized in that, The preprocessing specifically includes performing grayscale normalization, adaptive histogram equalization, and Gaussian filtering noise reduction on the acquired image data in sequence.

3. The automatic quality evaluation method for laser marking based on machine vision according to claim 1, characterized in that, The image segmentation network based on FastSAM consists of an image block partitioning layer, an attention calculation layer, and a mask generation layer. The image block partitioning layer divides the preprocessed laser marking image into multiple image blocks to form an input sequence. The attention calculation layer performs attention update operations on the value vectors of the image blocks based on a lightweight Transformer structure to obtain the output feature vectors of the image blocks. The mask generation layer generates a segmentation mask image based on the output feature vectors of the image blocks and the category query vector. The segmentation mask image has the same pixel count as the input image and is used to indicate the position of the image sub-region corresponding to the marking area.

4. The automatic quality evaluation method for laser marking based on machine vision according to claim 1, characterized in that, S2 specifically includes: S21, processing the preprocessed image data... Input is an image segmentation network built based on FastSAM, where, For the height of the image, S22, Image block division layers divide image data into widths; Divided into Non-overlapping image patches , where each image block Using linear embedding to obtain the first Query vector of image patches , the Key vectors of image patches and the Value vector of image patches S23, Based on query vector and key vector Dot product calculation of attention weights To measure the degree of correlation between image patches: S24. The attention calculation layer performs the attention update operation based on the attention weights. Perform weighted aggregation on the value vector to generate the updated value vector. Each image patch outputs a feature vector. : S25. Output feature vector The input mask generation layer generates a segmentation mask image with the same pixel count as the input image. ,in This indicates that the pixel belongs to the laser marking area. This indicates that the pixel belongs to the background area.

5. The automatic quality evaluation method for laser marking based on machine vision according to claim 1, characterized in that, S3 specifically includes: S31, segmenting the mask image. Perform connected component analysis to extract connected components from all labeled regions. And calculate the minimum bounding rectangle of the connected components of each marked region: ;in, For the first The coordinates of the minimum bounding rectangle of a connected component. For the first The minimum x-coordinate in a connected component. For the first The minimum value of the ordinate in a connected component. For the first The maximum value of the x-coordinate in each connected component. For the first The maximum value of the y-coordinate in each connected component. S32 represents the total number of connected components; S32 represents the boundary coordinates corresponding to each minimum bounding rectangle. Cropping image sub-regions from the original image within the specified range The set of images representing the marked regions 。 6. The automatic quality evaluation method for laser marking based on machine vision according to claim 1, characterized in that, The image coding network based on EfficientViT consists of an image segmentation layer, a local attention calculation layer, and a feature fusion layer.

7. The automatic quality evaluation method for laser marking based on machine vision according to claim 1, characterized in that, S4 specifically includes: S41, setting up the image set of the marked area. Each image sub-region Perform size adaptive padding to meet the uniform input size. Obtain the size-normalized image. ,in, 、 These are the normalized height and width of the image, respectively. S42, the number of image sub-regions; normalized image size. Calculate the edge response map: ;in, For the first Each image sub-region at pixel point The edge response amplitude at a given point represents the edge sharpness, and is calculated using a Sobel lateral convolution kernel. Each image sub-region at pixel point lateral gradient value at With longitudinal gradient value S43. Normalize the image size. Edge response map Reverse edge response map Perform channel-level fusion to construct a three-channel enhanced input: ;in, S44, will The image is fed into an image coding network built on EfficientViT, and the image partitioning layer will... Divided into Image blocks Each image patch is sized as follows: And mapped to an embedding vector ,in, The image patch size; S45, the local attention computation layer performs attention mechanism updates on the embedding vector: ;in, This is the intermediate representation of the embedded vector after the attention mechanism update. Attention weights: ;in, 、 、 These are the weight matrices for query, key, and value mapping, respectively; S46, feature fusion layer pairs. Applying depthwise separable convolution operations yields convolution-enhanced feature vectors. ,Will With embedding vector Perform residual connections to obtain image sub-regions. The Middle The final encoded feature vector of each image patch : S47. The final encoded feature vector set Restored to a two-dimensional feature map ,right Perform global average pooling and max pooling operations, and then stitch them together to form image sub-regions. Corresponding image-level feature vector : Construct a set of image-level feature vectors for all image sub-regions. 。 8. The automatic quality evaluation method for laser marking based on machine vision according to claim 1, characterized in that, The ArcFace angular interval classification module introduces an angular interval parameter between the image-level feature vector of the image sub-region and the center vector of each defect category to construct a classification boundary with angular interval constraints, so that different defect types can form a greater class separation in the feature angle space.

9. The automatic quality evaluation method for laser marking based on machine vision according to claim 1, characterized in that, S5 specifically includes: S51, and... Image-level feature vectors of each image sub-region Input is fed into the ArcFace angular interval classification module, and then... Perform normalization to obtain a unit vector representation. S52. Preset the category center vector corresponding to each defect type. Normalize it to satisfy S53. Calculate the unit eigenvector. With each category center vector Cosine similarity between them: S54, Regarding the category of belonging Corresponding angle Introducing angular intervals and combined with scaling factor Generate a class with discriminative boundaries value: S55, Constructing a system that introduces angular interval terms The classification structure yields the probability output of the image sub-region under all preset defect types: ;in, For the first The image sub-region was determined to be the... Predicted probability of each defect type , S56. Output the number of defect types based on the category index corresponding to the highest probability. Defect type classification results for each image sub-region.

10. The automatic quality evaluation method for laser marking based on machine vision according to claim 1, characterized in that, The multidimensional quality scoring indicators include sharpness score, outline integrity score, character offset score, and local contrast score.

Citation Information

Cited By

  • Domain generalization pedestrian re-identification method based on frequency domain enhancement and dynamic convolution cooperation

    CN122244910A