Adhesive width detection method and device based on template matching, computer equipment and medium

By combining template matching and deep learning, the problems of environmental interference and low accuracy in industrial adhesive width detection have been solved, achieving high-precision adhesive width measurement and improving the accuracy and efficiency of detection.

CN121998918APending Publication Date: 2026-05-08SHANGHAI SMARTMORE TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
SHANGHAI SMARTMORE TECH CO LTD
Filing Date
2026-01-08
Publication Date
2026-05-08

AI Technical Summary

Technical Problem

Existing industrial adhesive width detection methods are susceptible to environmental interference and have low detection accuracy. Traditional two-dimensional image detection methods are affected by product surface color differences and lighting fluctuations, while simple deep learning detection methods rely on complex post-processing and lack accuracy.

Method used

A template matching-based approach is adopted. By acquiring images of the same product with and without glue, and performing annotation and deep learning model processing, combined with semantic segmentation results, the target feature lines and glue width are determined.

Benefits of technology

It improves the accuracy of adhesive width detection, eliminates the influence of image capture offset, achieves high-precision adhesive width measurement, and enhances the anti-interference and efficiency of detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121998918A_ABST
    Figure CN121998918A_ABST
Patent Text Reader

Abstract

The invention relates to a glue width detection method and device based on template matching, computer equipment and a medium. The method comprises the following steps: respectively obtaining a first template drawing and a first detection drawing of the same product; the first template image is a product image without glue; the first detection image is a product image containing glue; marking the first template drawing and the first detection drawing differently to obtain a second template drawing and a second detection drawing; processing the second detection image according to a preset deep learning model to obtain a first semantic segmentation result containing feature point information and a second semantic segmentation result containing glue information; determining a target feature line coordinate sequence according to the first semantic segmentation result and the second template graph; and determining the target glue width according to the second semantic segmentation result and the target feature line coordinate sequence. According to the invention, the accuracy of glue width detection can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of adhesive width detection technology, and in particular to an adhesive width detection method, apparatus, computer equipment, and medium based on template matching. Background Technology

[0002] With the continuous development of artificial intelligence technology, visual non-contact automated industrial inspection has gradually replaced cumbersome manual inspection. Industrial automated inspection technology, based on visual algorithms, has become a key means to improve productivity and reduce labor costs in the industrial inspection field due to its advantages of high precision and high efficiency.

[0003] However, in industrial adhesive width detection scenarios, traditional two-dimensional image detection methods typically extract the adhesive contour through image binarization and edge detection before calculating the adhesive width. This method is easily affected by industrial environmental interference such as product surface color difference and light fluctuation, resulting in edge contour distortion. Furthermore, it has poor adaptability to complex curved adhesives. While detection methods based solely on deep learning have stronger environmental adaptability, they require selecting the target location with a rectangular bounding box and approximating the adhesive width with the longest side within the box. This not only relies on complex post-processing and has a long detection time, but also results in low accuracy of the detection results because it cannot adapt to the actual shape of the adhesive.

[0004] Therefore, improving the accuracy of adhesive width detection has become an urgent problem to be solved. Summary of the Invention

[0005] Therefore, it is necessary to provide a template-matching-based adhesive width detection method, apparatus, computer equipment, and medium to address the aforementioned technical problems, thereby improving the accuracy of adhesive width detection.

[0006] In a first aspect, this application provides a method for detecting adhesive width based on template matching, including: Obtain a first template image and a first inspection image of the same product; the first template image is a product image without glue; the first inspection image is a product image with glue. The first template image and the first detection image are annotated differently to obtain the second template image and the second detection image; The second detection image is processed according to the preset deep learning model to obtain a first semantic segmentation result containing feature point information and a second semantic segmentation result containing glue information. The target feature line coordinate sequence is determined based on the first semantic segmentation result and the second template image; The target adhesive width is determined based on the second semantic segmentation result and the target feature line coordinate sequence.

[0007] Secondly, this application provides a template-matching-based adhesive width detection device, comprising: The acquisition module is used to acquire a first template image and a first inspection image of the same product, respectively; the first template image is a product image without glue; the first inspection image is a product image with glue. The annotation module is used to annotate the first template image and the first detection image differently to obtain the second template image and the second detection image; The processing module is used to process the second detection map according to the preset deep learning model to obtain a first semantic segmentation result containing feature point information and a second semantic segmentation result containing glue information. The determination module is used to determine the target feature line coordinate sequence based on the first semantic segmentation result and the second template image; and to determine the target glue width based on the second semantic segmentation result and the target feature line coordinate sequence.

[0008] Thirdly, this application provides a computer device, which includes a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the steps in the method described above.

[0009] Fourthly, this application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps in the above-described method.

[0010] Fifthly, this application provides a computer program product comprising a computer program that, when executed by a processor, implements the steps of the method described above.

[0011] The aforementioned template-matching-based glue width detection method, apparatus, computer equipment, and medium combine template matching calibration with deep learning semantic segmentation. First, a baseline feature is established using a template image. Then, a deep learning model accurately extracts the semantic segmentation results from the detection image. Finally, the actual glue width is determined based on the semantic segmentation results. Compared to traditional two-dimensional image detection methods, which are susceptible to environmental interference, have low accuracy in deep learning detection results, and require complex post-processing, this application eliminates the influence of image capture offset through template feature deviation calibration, achieves high-precision extraction of feature points and glue contours through semantic segmentation, and calculates the accurate glue width based on the semantic segmentation results. This solves the problem of low detection accuracy in existing methods and improves the accuracy of glue width detection. Attached Figure Description

[0012] Figure 1 An application environment diagram for a template matching-based adhesive width detection method provided in this application embodiment; Figure 2 A schematic flowchart of a template-matching-based adhesive width detection method provided in an embodiment of this application; Figure 3This application provides a flowchart illustrating a first template diagram for annotation. Figure 4 A flowchart illustrating the process of determining a target feature line coordinate sequence, provided in an embodiment of this application; Figure 5 A structural block diagram of a glue width detection device based on template matching provided in this application embodiment; Figure 6 An internal structural diagram of a computer device provided in an embodiment of this application; Figure 7 An internal structural diagram of another computer device provided in an embodiment of this application; Figure 8 This is an internal structural diagram of a computer-readable storage medium provided in an embodiment of this application. Detailed Implementation

[0013] 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.

[0014] In this document, the term "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of this application. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.

[0015] Please see Figure 1 , Figure 1 This diagram illustrates an application environment for a template-matching-based adhesive width detection method provided in this application embodiment. The terminal 102 communicates with the server 104 via a communication network. A data storage system can store the data that the server 104 needs to process. The data storage system can be integrated onto the server 104 or located in the cloud or on other network servers. The terminal 102 can be, but is not limited to, various personal computers, laptops, smartphones, tablets, IoT devices, and portable wearable devices. IoT devices can include smart speakers, smart TVs, smart air conditioners, smart vehicle devices, etc. Portable wearable devices can include smartwatches, smart bracelets, head-mounted devices, etc. The server 104 can be implemented using a standalone server or a server cluster consisting of multiple servers.

[0016] like Figure 2 As shown in the embodiment of this application, a method for detecting adhesive width based on template matching is provided, which is applied to... Figure 1The method will be illustrated using terminal 102 or server 104 as examples. It is understood that the computer device may include at least one of a terminal and a server. The method includes the following steps: S101. Obtain the first template image and the first inspection image of the same product respectively.

[0017] The first template image is a product image without glue, while the first detection image is a product image with glue. It should be noted that the first template image and the first detection image are acquired using the same industrial imaging equipment, and the imaging parameters are completely identical, including the shooting angle, light intensity, image resolution, camera focal length, and shooting distance. Before acquisition, the product is fixed in position to ensure that the physical posture and placement of the product in the first template image and the first detection image meet the preset overlap requirements, thereby reducing initial deviations in subsequent feature matching. The product includes, but is not limited to, 3C electronic components, automotive manufacturing components, new energy equipment components, and general mechanical components, without specific limitations. Specifically, 3C electronic components include: mobile phone frames, laptop shells, and camera module brackets; automotive manufacturing components include: door sealing strip substrates, engine cylinder head sealing surfaces, and power battery shell components; new energy equipment components include: photovoltaic module frames, energy storage battery pack housings, and charging pile housing seals; and general mechanical components include: hydraulic valve block sealing surfaces, pneumatic component cavities, and precision gearbox housings, without specific limitations. It should be noted that the uniform characteristics of the products are that the quality of the adhesive application directly affects the sealing and bonding performance, and the product surface has identifiable fixed feature points (such as screw holes, corners, and locating pin holes).

[0018] S102. The first template image and the first detection image are annotated differently to obtain the second template image and the second detection image.

[0019] In some embodiments, S102, different annotations are applied to the first template image and the first detection image to obtain a second template image and a second detection image, including: A1. Label the first template image with feature points and feature lines to obtain the second template image; A2. Mark the feature points and glue outlines on the first detection image to obtain the second detection image.

[0020] The process involves identifying product feature points and reference feature lines in the first template image, and then annotating these features to obtain the second template image. Specifically, firstly, feature points corresponding to the second template image are identified in the first detection image, and their pixel coordinates are annotated. Next, the complete adhesive coverage area is identified in the first detection image, and a continuous sequence of pixels is extracted along the edge of the adhesive area to form a pixel coordinate sequence of the adhesive outline. Finally, the pixel coordinates of the feature points and the pixel coordinate sequence of the adhesive outline are associated and stored with the first detection image to obtain the second detection image containing structured annotation data.

[0021] It is evident that by aligning the structured annotations of the template image and the detection image, accurate benchmark data support is provided for subsequent feature matching and glue width calculation based on semantic segmentation, effectively improving the anti-interference capability and measurement accuracy of the detection algorithm.

[0022] like Figure 3 As shown in the figure, this application embodiment provides a flowchart for annotating a first template image. A1. Annotating feature points and feature lines on the first template image to obtain a second template image includes: B1. Obtain the coordinates of the feature points of the product in the first template image to get the coordinates of the feature points in the template image; B2. Obtain the coordinate sequence of the reference feature line associated with the feature point from the first template image to obtain the reference feature line coordinate sequence; B3. Based on the coordinate sequence of feature points and reference feature lines in the template image, feature points and feature lines are labeled in the first template image to obtain the second template image.

[0023] The feature point is a non-volatile, fixed physical marker on the product. For example, it could be the center point of a screw, the center of a product assembly hole, or the vertex of a product part; no specific limitations are made here. This feature point is characterized by its unique location and fixed structure, and it will not change with glue application or production batch variations. Furthermore, it is easily identifiable and marked in product images, serving as a stable benchmark for template matching.

[0024] Specifically, a unified pixel coordinate reference system can be established for the first template image and the first detection image to ensure that the origin, coordinate axis direction, and pixel scale of the two images are completely consistent. Then, the positions of feature points in the first template image are identified by manual annotation or semi-automatic annotation tools, and the pixel coordinates of the feature points are recorded to obtain the feature point coordinates of the template image.

[0025] The reference feature line is associated with the feature point. This reference feature line can be a sequence of continuous pixels extracted along the baseline contour edge that matches the product and the feature point, or it can be a sequence of continuous pixels corresponding to a pre-defined baseline contour edge in the product; no specific limitation is made here. The reference feature line coordinate sequence can be obtained from the first template image by coordinate sampling, thus obtaining the pixel coordinate sequence corresponding to the reference feature line.

[0026] Specifically, the coordinates of feature points and reference feature lines in the template image can be associated and bound to the first template image in a structured data format. The positions of feature points and the direction of feature lines are visualized on the image interface of the first template image, and the bound image data and annotation data are stored to form a second template image containing complete reference annotation information.

[0027] As can be seen, by extracting fixed feature points and associated reference feature lines of the product and performing structured annotation, a second template image with accurate benchmark information is generated, providing a reliable reference for subsequent deviation calibration and feature matching of the detection image.

[0028] S103. The second detection map is processed according to the preset deep learning model to obtain a first semantic segmentation result containing feature point information and a second semantic segmentation result containing glue information.

[0029] The process involves preprocessing the second detection image, including but not limited to image denoising, grayscale normalization, and size standardization. The preprocessed second detection image is then converted into a tensor format that meets the input requirements of the deep learning model and input into the model for processing. It should be noted that this deep learning model is a semantic segmentation model based on the HRNet or U-Net architecture, and it has been trained and validated using a dataset containing feature point images and glue contour images of products from multiple batches and scenarios. The feature extraction module of the deep learning model performs multi-scale feature fusion on the second detection image, identifying and locating feature point regions and glue contour regions within the second detection image, thereby outputting a first semantic segmentation result containing feature point information and a second semantic segmentation result containing glue information. The first semantic segmentation result is a pixel-level segmentation mask for the feature point regions in the second detection image, and the second semantic segmentation result is a pixel-level segmentation mask for the glue contour regions in the second detection image.

[0030] S104. Determine the target feature line coordinate sequence based on the first semantic segmentation result and the second template image.

[0031] like Figure 4As shown in the figure, this application embodiment provides a flowchart for determining the target feature line coordinate sequence. S104: Determining the target feature line coordinate sequence based on the first semantic segmentation result and the second template image includes: C1. Based on the first semantic segmentation result, determine the coordinates of the feature points in the detection map corresponding to the feature points of the product in the second detection map; C2. Calculate the coordinate deviation between the feature point coordinates of the detection image and the feature point coordinates of the template image to obtain the target coordinate deviation; C3. Determine the target feature line coordinate sequence based on the target coordinate deviation and the reference feature line coordinate sequence.

[0032] Specifically, from the pixel-level segmentation mask of the feature point region corresponding to the first semantic segmentation result, the pixel region corresponding to the feature point is extracted, and then the mean pixel coordinates of the pixel region are calculated to obtain the coordinates of the feature point in the detection map corresponding to the feature point. Assume the coordinates of the feature point in the template image are ( , The coordinates of the feature points in the detection map are ( , Then, calculate the coordinate deviation between the feature point coordinates of the detection image and the feature point coordinates of the template image, and obtain the target coordinate deviation as ( , ),in, = - , = - Finally, the target coordinate deviation is superimposed on the coordinates of each pixel in the reference feature line coordinate sequence to obtain the target feature line coordinate sequence.

[0033] As can be seen, by accurately extracting the coordinates of feature points in the detection image through semantic segmentation, calculating the coordinate deviation between the feature points in the detection image and the template image, and calibrating the reference feature line, a precise baseline matching the physical position of the detection image is provided for subsequent glue width calculation, effectively eliminating the measurement error caused by image acquisition offset.

[0034] In some embodiments, C3, determining the target feature line coordinate sequence based on the target coordinate deviation and the reference feature line coordinate sequence, includes: D1. Determine the horizontal and vertical coordinate deviations corresponding to the target coordinate deviations; D2. Superimpose the horizontal and vertical coordinate deviations on the coordinates of each pixel in the reference feature line coordinate sequence to obtain the target feature line coordinate sequence.

[0035] Among them, the target coordinate deviation ( , ) components Defined as horizontal coordinate deviation, it characterizes the translational offset of feature points in the detection image relative to feature points in the template image along the x-axis. Defined as vertical coordinate deviation, it characterizes the translational offset of a feature point in the detection image relative to a feature point in the template image along the y-axis. A positive deviation indicates a shift of the feature point in the detection image relative to a feature point in the template image along the positive direction of the corresponding coordinate axis, while a negative deviation indicates a shift of the feature point in the detection image relative to a feature point in the template image along the negative direction of the corresponding coordinate axis. Assume the reference feature line coordinate sequence is... Then, the horizontal coordinate deviation is superimposed on the coordinates of each pixel in the reference feature line coordinate sequence. and vertical coordinate deviation The target feature line coordinate sequence is obtained. The calculation formula is as follows: = + ; = + ;in, = .

[0036] As can be seen, by splitting the horizontal and vertical components of the target coordinate deviation, the pixels of the reference feature line are precisely calibrated point by point, generating a target feature line that matches the position of the detection map, thus ensuring the accuracy of subsequent glue width calculation.

[0037] S105. Determine the target adhesive width based on the second semantic segmentation result and the target feature line coordinate sequence.

[0038] In some embodiments, S105, determining the target adhesive width based on the second semantic segmentation result and the target feature line coordinate sequence, includes: E1. Based on the second semantic segmentation result, determine the glue contour coordinate sequence corresponding to the glue contour in the second detection image; E2. Use the midpoint coordinates corresponding to the target feature line coordinate sequence as the coordinates of the specified point; E3. Perform linear fitting on the target feature line coordinate sequence to obtain the target straight line equation; E4. Determine the equation of the target perpendicular line based on the target line equation and the coordinates of the specified point; E5. Obtain the coordinates of the intersection point between the target vertical line equation and the glue contour coordinate sequence, and obtain the coordinates of the first intersection point and the second intersection point. E6. Determine the target adhesive width based on the coordinates of the first and second intersection points.

[0039] Specifically, from the pixel-level segmentation mask of the glue contour region corresponding to the second semantic segmentation result, the set of edge pixels corresponding to the glue contour region is extracted. This set of edge pixels is then sampled in an ordered manner in either a clockwise or counterclockwise direction to obtain a continuous glue contour coordinate sequence. The mean of the abscissa and ordinate of all pixel coordinates in the target feature line coordinate sequence is calculated to obtain the midpoint coordinates. , ), and use the coordinates of the midpoint as the coordinates of the specified point.

[0040] Among these methods, a preset least squares method can be used to linearly fit the target feature line coordinate sequence to obtain the target straight line equation. = Then, based on the slope k of the target line equation, calculate the slope of the target perpendicular line equation. The slope of the target straight line equation multiplied by the slope of the target perpendicular line equation equals -1. Then, the coordinates of the specified point ( , Substituting the preset expression for the slope of the perpendicular line, we obtain the equation of the target perpendicular line, as shown below:

[0041] To avoid the vertical slope being meaningless, 0.0001 can be introduced to prevent infinity when the denominator is 0 (i.e., to avoid the case where the vertical slope is 0 or does not exist).

[0042] The line can be extended along the perpendicular line equation of the target to intersect at two points in the glue contour coordinate sequence, thus obtaining the coordinates of the first intersection point ( , ) and the coordinates of the second intersection point ( , Then, for the coordinates of the first intersection point ( , ) and the coordinates of the second intersection point ( , The target adhesive width is obtained by calculation.

[0043] As can be seen, by extracting the glue contour through semantic segmentation, fitting feature lines and generating perpendicular lines, and calculating the distance between the intersection of the perpendicular lines and the glue contour, the glue width can be automatically and quantitatively measured with high precision, which effectively improves the efficiency and accuracy of industrial glue coating quality inspection.

[0044] In some embodiments, E6, determining the target adhesive width based on the coordinates of the first intersection point and the second intersection point includes: F1. Calculate the pixel distance between the coordinates of the first intersection point and the coordinates of the second intersection point according to the preset distance calculation formula to obtain the target pixel distance; F2. Determine the target adhesive width based on the preset pixel precision and target pixel distance.

[0045] The coordinates of the first intersection point can be calculated using the Euclidean distance formula. , ) and the coordinates of the second intersection point ( , The distance between target pixels is calculated as follows: The Euclidean distance is calculated using the formula shown below:

[0046] in, Indicates the distance to the target pixel.

[0047] The target adhesive width can be obtained by calculating the product of the preset pixel precision and the target pixel distance. The calculation formula is as follows: *

[0048] in, Indicates the target adhesive width; Pixel precision refers to the actual physical length (usually in millimeters) corresponding to a single pixel in an image. It is the core parameter for converting image pixel distances into actual physical dimensions.

[0049] It is evident that by combining pixel distance calculation with physical mapping of pixel precision, a precise conversion from image pixel scale to actual physical size is achieved, ensuring the industrial applicability of adhesive width measurement results.

[0050] It should be understood that although the steps in the flowcharts of the above embodiments 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 above embodiments 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 some of the steps or stages in other steps.

[0051] Based on the same inventive concept, this application also provides a glue width detection device based on template matching. The solution provided by this device is similar to the solution described in the above method. Therefore, the specific limitations of one or more embodiments of the glue width detection device based on template matching provided below can be found in the limitations of the glue width detection method based on template matching above, and will not be repeated here.

[0052] like Figure 5 As shown, this application provides a template-matching adhesive width detection device 500, comprising: The acquisition module 501 is used to acquire a first template image and a first inspection image of the same product respectively; the first template image is a product image without glue; the first inspection image is a product image with glue. The annotation module 502 is used to perform different annotations on the first template image and the first detection image respectively to obtain the second template image and the second detection image; The processing module 503 is used to process the second detection map according to the preset deep learning model to obtain a first semantic segmentation result containing feature point information and a second semantic segmentation result containing glue information. The determination module 504 is used to determine the target feature line coordinate sequence based on the first semantic segmentation result and the second template image; and to determine the target glue width based on the second semantic segmentation result and the target feature line coordinate sequence.

[0053] In some embodiments, in obtaining a second template image and a second detection image by performing different annotations on the first template image and the first detection image respectively, the annotation module 502 is specifically used for: The first template image is labeled with feature points and feature lines to obtain the second template image; Feature points and glue outlines are annotated on the first detection image to obtain the second detection image.

[0054] In some embodiments, in obtaining a second template image by annotating feature points and feature lines on the first template image, the annotation module 502 is specifically used for: Obtain the coordinates of the feature points of the product in the first template image to get the coordinates of the feature points in the template image; Obtain the coordinate sequence of the reference feature line associated with the feature point from the first template image to obtain the reference feature line coordinate sequence; Based on the coordinate sequence of feature points and reference feature lines in the template image, feature points and feature lines are labeled in the first template image to obtain the second template image.

[0055] In some embodiments, in determining the target feature line coordinate sequence based on the first semantic segmentation result and the second template map, the determining module 504 is specifically used for: Based on the first semantic segmentation result, determine the coordinates of the feature points in the detection map corresponding to the feature points of the product in the second detection map; Calculate the coordinate deviation between the feature point coordinates of the detection image and the feature point coordinates of the template image to obtain the target coordinate deviation; The target feature line coordinate sequence is determined based on the target coordinate deviation and the reference feature line coordinate sequence.

[0056] In some embodiments, in determining the target feature line coordinate sequence based on the target coordinate deviation and the reference feature line coordinate sequence, the determining module 504 is specifically used for: Determine the horizontal and vertical coordinate deviations corresponding to the target coordinate deviations; The horizontal and vertical coordinate deviations are superimposed on the coordinates of each pixel in the reference feature line coordinate sequence to obtain the target feature line coordinate sequence.

[0057] In some embodiments, in determining the target adhesive width based on the second semantic segmentation result and the target feature line coordinate sequence, the determining module 504 is specifically used for: Based on the second semantic segmentation result, determine the glue contour coordinate sequence corresponding to the glue contour in the second detection image; Use the midpoint coordinates corresponding to the target feature line coordinate sequence as the coordinates of the specified point; By performing linear fitting on the target feature line coordinate sequence, the target straight line equation is obtained; Determine the equation of the target perpendicular line based on the target line equation and the coordinates of the specified point; Obtain the coordinates of the intersection point between the target vertical line equation and the glue contour coordinate sequence, and obtain the coordinates of the first intersection point and the second intersection point; The target adhesive width is determined based on the coordinates of the first and second intersection points.

[0058] In some embodiments, in determining the target adhesive width based on the coordinates of the first intersection point and the second intersection point, the determining module 504 is specifically used for: The pixel distance between the coordinates of the first intersection point and the coordinates of the second intersection point is calculated according to the preset distance calculation formula to obtain the target pixel distance; The target adhesive width is determined based on the preset pixel precision and target pixel distance.

[0059] Each module in the template-matching adhesive width detection device 500 described above can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device in hardware form, or stored in the memory of a computer device in software form, so that the processor can call and execute the operations corresponding to each module.

[0060] In some embodiments, a computer device is provided, which may be a server, and its internal structure diagram may be as follows: Figure 6As shown, the computer device includes a processor, memory, input / output (I / O) interfaces, and a communication interface. The processor, memory, and I / O interfaces are connected via a system bus, and the communication interface is also connected to the system bus via the I / O interfaces. The processor provides computational and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and a database. The internal memory provides the environment for the operating system and computer programs in the non-volatile storage media to run. The database stores data related to the template-matching-based adhesive width detection method. The I / O interfaces are used for exchanging information between the processor and external devices. The communication interface is used for communicating with external terminals via a network connection. When the computer program is executed by the processor, it implements the steps in the template-matching-based adhesive width detection method described above.

[0061] In some embodiments, a computer device is provided, which may be a terminal, and its internal structure diagram may be as follows: Figure 7 As shown, the computer device includes a processor, memory, input / output interface, communication interface, display unit, and input device. The processor, memory, and input / output interface are connected via a system bus, and the communication interface, display unit, and input device are also connected to the system bus via the input / output interface. The processor provides computing and control capabilities. The memory includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium. The input / output interface is used for exchanging information between the processor and external devices. The communication interface is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, mobile cellular networks, NFC (Near Field Communication), or other technologies. When the computer program is executed by the processor, it implements the steps in the template-matching-based adhesive width detection method described above. The display unit is used to form a visually visible image and can be a display screen, a projection device, or a virtual reality imaging device. The display screen can be an LCD screen or an e-ink screen; the input device of the computer device can be a touch layer covering the display screen, or buttons, trackballs or touchpads set on the casing of the computer device, or external keyboards, touchpads or mice, etc.

[0062] Those skilled in the art will understand that Figure 6 or Figure 7The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0063] In some embodiments, a computer device is provided, the computer device including a memory and a processor, the memory storing a computer program, the processor executing the computer program to implement the steps in the above method embodiments.

[0064] In some embodiments, such as Figure 8 The diagram shows the internal structure of a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps described in the above-described method embodiments.

[0065] In some embodiments, a computer program product is provided, which includes a computer program that, when executed by a processor, implements the steps in the above method embodiments.

[0066] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of the relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions.

[0067] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.

[0068] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

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

Claims

1. A method for detecting adhesive width based on template matching, characterized in that, include: A first template image and a first inspection image of the same product are obtained respectively; the first template image is a product image without glue. The first detection image is a product image containing adhesive; The first template image and the first detection image are annotated differently to obtain the second template image and the second detection image; The second detection map is processed according to a preset deep learning model to obtain a first semantic segmentation result containing feature point information and a second semantic segmentation result containing glue information. Based on the first semantic segmentation result and the second template image, determine the target feature line coordinate sequence; The target adhesive width is determined based on the second semantic segmentation result and the target feature line coordinate sequence.

2. The method according to claim 1, characterized in that, The step of separately annotating the first template image and the first detection image to obtain the second template image and the second detection image includes: The first template image is annotated with feature points and feature lines to obtain the second template image; The first detection image is annotated with feature points and glue outlines to obtain the second detection image.

3. The method according to claim 2, characterized in that, The step of annotating the first template image with feature points and feature lines to obtain the second template image includes: Obtain the coordinates of the feature points of the product in the first template image to get the coordinates of the feature points in the template image; Obtain the coordinate sequence of the reference feature line associated with the feature point from the first template image to obtain the reference feature line coordinate sequence; Based on the coordinates of the feature points in the template image and the coordinate sequence of the reference feature lines, the first template image is labeled with feature points and feature lines to obtain the second template image.

4. The method according to claim 3, characterized in that, The step of determining the target feature line coordinate sequence based on the first semantic segmentation result and the second template image includes: Based on the first semantic segmentation result, determine the coordinates of the feature points in the detection map corresponding to the feature points of the product in the second detection map; Calculate the coordinate deviation between the feature point coordinates of the detected image and the feature point coordinates of the template image to obtain the target coordinate deviation; The target feature line coordinate sequence is determined based on the target coordinate deviation and the reference feature line coordinate sequence.

5. The method according to claim 4, characterized in that, Determining the target feature line coordinate sequence based on the target coordinate deviation and the reference feature line coordinate sequence includes: Determine the horizontal and vertical coordinate deviations corresponding to the target coordinate deviations; The horizontal coordinate deviation and the vertical coordinate deviation are superimposed on the coordinates of each pixel in the reference feature line coordinate sequence to obtain the target feature line coordinate sequence.

6. The method according to any one of claims 1-5, characterized in that, The step of determining the target adhesive width based on the second semantic segmentation result and the target feature line coordinate sequence includes: Based on the second semantic segmentation result, determine the glue contour coordinate sequence corresponding to the glue contour in the second detection image; Use the midpoint coordinates corresponding to the target feature line coordinate sequence as the coordinates of the specified point; The target feature line coordinate sequence is linearly fitted to obtain the target straight line equation; Determine the equation of the target perpendicular line based on the equation of the target line and the coordinates of the specified point; Obtain the coordinates of the intersection point between the target vertical line equation and the glue contour coordinate sequence to obtain the coordinates of the first intersection point and the second intersection point. The target adhesive width is determined based on the coordinates of the first intersection point and the second intersection point.

7. The method according to claim 6, characterized in that, The step of determining the target adhesive width based on the coordinates of the first intersection point and the coordinates of the second intersection point includes: The pixel distance between the coordinates of the first intersection point and the coordinates of the second intersection point is calculated according to the preset distance calculation formula to obtain the target pixel distance; The target adhesive width is determined based on the preset pixel precision and the target pixel distance.

8. A glue width detection device based on template matching, characterized in that, include: The acquisition module is used to acquire the first template image and the first inspection image of the same product, respectively. The first template image is a product image without glue; The first detection image is a product image containing adhesive; The annotation module is used to annotate the first template image and the first detection image differently to obtain the second template image and the second detection image; The processing module is used to process the second detection map according to a preset deep learning model to obtain a first semantic segmentation result containing feature point information and a second semantic segmentation result containing glue information. The determination module is used to determine the target feature line coordinate sequence based on the first semantic segmentation result and the second template image; The target adhesive width is determined based on the second semantic segmentation result and the target feature line coordinate sequence.

9. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 7.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 7.