Image recognition-based magnetic stripe appearance defect automatic detection method and system

By combining structured light projection and line scan camera image acquisition devices, along with geometric distortion and brightness gradient analysis, and using a generative restoration model for defect repair, the problems of low efficiency and insufficient accuracy of traditional detection methods are solved, achieving efficient and reliable magnetic strip appearance defect detection.

CN120471904BActive Publication Date: 2025-11-11XUZHOU XIANGSHUN ELECTRONIC TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510704084.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-05-29
Publication Date
2025-11-11
Estimated Expiration
2045-05-29

AI Technical Summary

Technical Problem

Traditional manual visual inspection methods are inefficient and highly subjective, making them difficult to adapt to the needs of high-speed continuous production. Automated inspection systems based on a single image acquisition method have insufficient accuracy and poor robustness when faced with complex background interference and diverse defect morphologies.

Method used

A first image acquisition device consisting of a structured light projector and an industrial camera is used to acquire geometric interference images. A line scan camera is used to acquire line scan images. Defects are identified by calculating geometric distortion and spatial brightness gradient. A pre-trained generative restoration model is used for defect repair and residual detection.

Benefits of technology

It improves the accuracy and reliability of magnetic strip appearance defect detection, can effectively identify various defect morphologies in complex backgrounds, and realizes automated detection for high-speed continuous production.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120471904B_ABST
    Figure CN120471904B_ABST
Patent Text Reader

Abstract

This invention discloses an automatic detection method and system for magnetic strip appearance defects based on image recognition, belonging to the field of image recognition technology. The method includes: acquiring geometrically disturbed images of the target magnetic strip to generate first image data; acquiring line-scan images of the target magnetic strip to generate second image data; performing image recognition based on geometric distortion on the first image data to generate a first defect detection result; performing image recognition based on spatial brightness gradient calculation on multiple consecutive frames of the second image data to generate a second defect detection result; analyzing the first and second defect detection results for defect cross-verification; and based on the defect cross-verification results, calling a pre-trained generative restoration model to perform residual detection under defect repair to generate a third defect detection result. This solves the technical problem of low accuracy in magnetic strip appearance defect detection in existing technologies, achieving the technical effect of improving the accuracy and reliability of magnetic strip appearance defect detection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of image recognition technology, and more specifically to an automatic detection method and system for magnetic strip appearance defects based on image recognition. Background Technology

[0002] In the manufacturing process of magnetic stripe products, their appearance quality directly affects the product's performance and reliability, especially in applications requiring high precision and stability, such as financial cards, access control cards, and industrial sensing equipment. However, magnetic stripes are susceptible to interference from factors such as mechanical vibration, uneven coating, material defects, and environmental pollution during production, leading to various types of defects on their surface, including scratches, bubbles, peeling, and discoloration. Traditional manual visual inspection methods are inefficient and highly subjective, making them unsuitable for high-speed continuous production. Automated inspection systems based on single image acquisition methods often exhibit insufficient accuracy and poor robustness when faced with complex background interference and diverse defect morphologies. Summary of the Invention

[0003] This application provides an automatic detection method and system for magnetic strip appearance defects based on image recognition, which solves the technical problem of low accuracy in the detection of magnetic strip appearance defects in the prior art.

[0004] The first aspect of this application provides an automatic detection method for appearance defects of magnetic strips based on image recognition, the method comprising:

[0005] The first image acquisition device on the magnetic strip production line is activated to acquire geometric interference images of the target magnetic strip moving on the production line, generating first image data. The second image acquisition device on the magnetic strip production line is activated to acquire line scan images of the target magnetic strip moving on the production line, generating second image data. Image recognition based on geometric distortion is performed on the first image data to generate a first defect detection result. Image recognition based on spatial brightness gradient calculation is performed on multiple consecutive frames of images in the second image data to generate a second defect detection result. The first defect detection result and the second defect detection result are analyzed for defect cross-verification. Based on the defect cross-verification result, a pre-trained generative restoration model is called to perform residual detection under defect repair, generating a third defect detection result.

[0006] A second aspect of this application provides an automatic detection system for magnetic strip appearance defects based on image recognition, the system comprising:

[0007] First image acquisition module: Activates the first image acquisition device on the magnetic strip production line to acquire geometric interference images of the target magnetic strip moving on the production line, generating first image data; Second image acquisition module: Activates the second image acquisition device on the magnetic strip production line to acquire line scan images of the target magnetic strip moving on the production line, generating second image data; First image recognition module: Performs image recognition based on geometric distortion on the first image data to generate a first defect detection result; Second image recognition module: Performs image recognition based on spatial brightness gradient calculation on multiple consecutive frames in the second image data to generate a second defect detection result; Detection module: Analyzes the first defect detection result and the second defect detection result for defect cross-verification, and calls a pre-trained generative restoration model based on the defect cross-verification result to perform residual detection under defect repair, generating a third defect detection result.

[0008] One or more technical solutions provided in this application have at least the following technical effects or advantages:

[0009] First, the first image acquisition device on the magnetic strip production line is activated to acquire geometric interference images of the target magnetic strip moving on the production line, generating first image data. Then, the second image acquisition device on the magnetic strip production line is activated to acquire line scan images of the target magnetic strip moving on the production line, generating second image data. Next, image recognition based on geometric distortion is performed on the first image data to generate a first defect detection result. Image recognition based on spatial brightness gradient calculation is performed on multiple consecutive frames in the second image data to generate a second defect detection result. Finally, the first and second defect detection results are analyzed for defect cross-verification. Based on the defect cross-verification results, a pre-trained generative restoration model is called to perform residual detection under defect repair, generating a third defect detection result. This solves the technical problem of low accuracy in magnetic strip appearance defect detection in existing technologies, achieving the technical effect of improving the accuracy and reliability of magnetic strip appearance defect detection. Attached Figure Description

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

[0011] Figure 1 A schematic flowchart of an automatic detection method for magnetic strip appearance defects based on image recognition provided in an embodiment of this application;

[0012] Figure 2 A schematic diagram of the structure of an automatic detection system for magnetic strip appearance defects based on image recognition provided in an embodiment of this application.

[0013] Explanation of reference numerals in the attached drawings: First image acquisition module 11, Second image acquisition module 12, First image recognition module 13, Second image recognition module 14, Detection module 15. Detailed Implementation

[0014] This application provides an automatic detection method and system for magnetic strip appearance defects based on image recognition, which solves the technical problem of low accuracy in the detection of magnetic strip appearance defects in the prior art.

[0015] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of them. All other embodiments obtained by those skilled in the art based on the embodiments of this application without creative effort are within the scope of protection of this application.

[0016] It should be noted that the terms "comprising" and "having" are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or server that includes a series of steps or units is not necessarily limited to those steps or units that are explicitly listed, but may include other steps or modules that are not explicitly listed or that are inherent to these processes, methods, products, or devices.

[0017] Example 1, as Figure 1 As shown, this application provides an automatic detection method for magnetic strip appearance defects based on image recognition, wherein the method includes:

[0018] The first image acquisition device on the magnetic strip production line is activated to acquire geometric interference images of the target magnetic strip that is moving on the production line, generating the first image data.

[0019] Furthermore, the first image acquisition device is a structured light-assisted vision device, including a structured light projector and an industrial camera.

[0020] In this embodiment, a first image acquisition device installed on the magnetic strip production line is used to acquire geometric interference images of a moving target magnetic strip on the production line, generating first image data. The first image acquisition device includes a structured light projector and an industrial camera; the structured light projector projects a regular striped light pattern onto the surface of the moving target magnetic strip, the striped light pattern being a periodic linear structured light, used to form a stable geometric interference pattern on the magnetic strip surface; the industrial camera images the magnetic strip surface at a fixed angle, and when the target magnetic strip passes through the structured light projection area, it acquires images of its surface after being interfered with by the structured light in real time.

[0021] The second image acquisition device on the magnetic strip production line is activated to perform line scan image acquisition on the target magnetic strip that is moving on the production line, generating second image data.

[0022] Furthermore, the second image acquisition device is a line scan camera, and the frame rate of the line scan camera is matched with the moving speed of the target magnetic strip.

[0023] In this embodiment, a second image acquisition device installed on the magnetic strip production line performs line scan image acquisition on the target magnetic strip moving on the production line, generating second image data, wherein the second image data includes multiple consecutive frames of images. The second image acquisition device is a line scan camera, which is based on the line scan imaging principle. It acquires image data of the magnetic strip surface line by line and stitches the images line by line to generate a complete image as the magnetic strip moves continuously along the production direction, thereby achieving continuous high-resolution image acquisition of the entire magnetic strip surface.

[0024] Furthermore, the first image acquisition device and the second image acquisition device are subject to distance constraints; these distance constraints are determined by the influence range of the structured light projector within the first image acquisition device, the frame rate of the second image acquisition device, and the speed configuration of the target magnetic strip on the production line.

[0025] The first and second image acquisition devices are subject to a fixed distance constraint on the magnetic stripe production line to ensure the temporal and spatial correspondence of the image data. This distance constraint is determined by several factors, including the effective influence range of the structured light projector in the first image acquisition device, the frame rate setting of the second image acquisition device, and the running speed of the target magnetic stripe on the production line. Specifically, the structured light projector needs to achieve stable projection of the stripe pattern within its uniform projection area, and the first image acquisition device must be positioned within this area to accurately acquire distortion information. Simultaneously, to ensure that the line-scanned image does not experience stretching or compression, the frame rate of the second image acquisition device must be strictly matched to the magnetic stripe's moving speed; therefore, this device must maintain a certain physical distance from the first image acquisition device during installation.

[0026] The magnetic strip runs at a constant or quasi-constant speed. To ensure that the first image data and the second image data are collected from the same batch and the same physical area, a reasonable device spacing D needs to be calculated based on the production line speed V and the structured light imaging and line scan delay compensation time Δt, satisfying the formula D=V⋅Δt.

[0027] Perform geometric distortion-based image recognition on the first image data to generate a first defect detection result.

[0028] The standard structured light pattern model projected by the structured light projector is compared with the first image data. Image processing algorithms are used to analyze the deformation of the structured light stripes in the image, including but not limited to gradient abrupt changes in the stripes (detecting areas of abnormal gradient changes in the direction of the light stripe, which can reflect surface undulations or protrusions), stripe breaks (detecting interruptions or missing parts of the light stripe, usually indicating scratches, paint peeling, or foreign object obstruction), and stripe distortion or offset (judging the degree to which the stripes deviate from the reference position, used to identify defects such as warping, dents, or surface edge curling). Based on the distribution pattern, range, and intensity of the distortion features, a preliminary defect type judgment (such as scratches, deformation, indentations, contamination, etc.) and its spatial location are performed. The identified defect information is formatted and the final output is the first defect detection result, including but not limited to the location coordinates, size parameters, distortion feature values, and preliminary classification labels of the defect area.

[0029] Furthermore, performing geometric distortion-based image recognition on the first image data to generate a first defect detection result includes:

[0030] A preset structured light pattern of the first image acquisition device is acquired; based on the preset structured light pattern, stripe distortion is identified in the first image data, including gradient abrupt changes, stripe breaks, and distorted regions, and distortion feature information is determined; based on the distortion features, surface defect type analysis is performed, and the distortion location is mapped and associated to generate the first defect detection result.

[0031] First, a preset structured light pattern projected by the structured light projector in the first image acquisition device is acquired. This preset structured light pattern is a regular and uniform periodic stripe pattern formed on the surface of an ideal, defect-free magnetic stripe, serving as the benchmark for subsequent distortion identification. In the acquired first image data, the stripe pattern exhibits significant geometric distortion due to various defects on the magnetic stripe surface, specifically manifested as abrupt gradient changes, breaks, and twists in the stripes. By comparing the acquired image with the preset pattern, edge gradient detection operators such as the Sobel operator are used to extract stripe gradient changes and identify gradient abrupt change regions. These regions typically correspond to scratches, peeling, or other defects with clear boundaries. Connected component analysis and void filling techniques are used to detect broken segments in the stripes, reflecting surface particle contamination or localized material defects. Simultaneously, curve fitting methods are used to analyze the stripe direction, detecting stripe twisting phenomena caused by surface warping, depressions, or stress deformation, thereby determining the twisted regions. The distortion features extracted by the above image processing method include information such as the spatial location, size, shape and distortion intensity of the defect area. Based on these distortion features, and combined with the preset defect type discrimination rules, the specific type of defect is analyzed, such as scratches, warping, indentations or contaminant adhesion, and the defect type is mapped and associated with its corresponding distortion location to form a structured first defect detection result.

[0032] Image recognition based on spatial brightness gradient calculation is performed on multiple consecutive frames of images in the second image data to generate a second defect detection result.

[0033] For the consecutive multi-frame images in the second image data, pixel-level alignment of the magnetic stripe regions in each frame is first performed to eliminate displacement errors caused by magnetic stripe movement or acquisition device jitter, ensuring the continuity of pixels at the same spatial location over time. Then, for the aligned pixel sequence, the brightness value of each pixel changing over time is extracted to form a brightness variation sequence. Based on this brightness variation sequence, the spatial brightness gradient of each pixel is calculated, i.e., the rate of change of brightness value in spatial location is analyzed to further capture details of abrupt brightness changes and texture variations. By analyzing the spatial brightness gradient maps of all pixels, a set of pixels with consistent gradient changes is identified. These pixels satisfy adjacency relationships in space, forming continuous gradient-consistent regions. Based on the information from these gradient-consistent regions, combined with spatial connectivity analysis, a second defect detection result is generated. This result includes information such as the spatial location, size, and morphological characteristics of the defect, providing an important basis for subsequent defect cross-verification and comprehensive judgment.

[0034] Furthermore, image recognition based on spatial brightness gradient calculation is performed on multiple consecutive frames of images in the second image data to generate a second defect detection result, including:

[0035] After performing pixel alignment processing on the magnetic stripe region in the continuous multi-frame images, the sequence of brightness value changes of each pixel over time is calculated and extracted to generate a brightness change sequence of each pixel; brightness change gradient calculation is performed on the brightness change sequence of each pixel to generate a gradient change map of each pixel; consistent pixels are extracted based on the gradient change map of each pixel and connected according to the adjacency relationship to generate the second defect detection result.

[0036] First, pixel alignment is performed on the magnetic stripe region in multiple consecutive frames. This process uses an image registration algorithm to eliminate image displacement caused by magnetic stripe movement or camera shake, ensuring accurate temporal correspondence between pixels at the same spatial location. After alignment, the brightness value of each pixel in consecutive frames is extracted, forming a brightness change sequence for that pixel over time. Based on these brightness change sequences, brightness change gradient calculation is performed. By calculating the rate of change of brightness values ​​in the spatial dimension, a gradient change map for each pixel is generated. This gradient change map reflects the local brightness variation characteristics of the magnetic stripe surface and is sensitive to brightness unevenness or texture changes caused by defects. Subsequently, based on the gradient change map, according to preset gradient consistency judgment constraints, a set of pixels with similar and continuous gradient changes is extracted, and these pixels are connected into continuous regions based on their spatial adjacency. By analyzing these continuous regions, abnormal brightness change areas are identified, ultimately forming a second defect detection result containing the location, size, and morphological features of the defect. This result provides accurate reference data for subsequent defect cross-verification and defect repair.

[0037] Furthermore, based on the gradient change maps of each pixel, consistent pixels are extracted and connected according to their adjacency relationships to generate the second defect detection result, including:

[0038] Construct gradient consistency judgment constraints, including continuous gradient deviation thresholds; extract consistent pixels from the gradient change map of each pixel using the gradient consistency judgment constraints to generate an extracted pixel set; connect the similarity of the extracted pixel set that satisfies the preset adjacency relationship to generate the second defect detection result.

[0039] Specifically, by setting a threshold to limit the maximum allowable deviation of adjacent pixels in gradient values, it ensures that only pixels with similar gradient change amplitudes are extracted as consistent pixels. Using this gradient consistency constraint, the gradient change map of each pixel is analyzed point by point, and a set of pixels that meet the gradient consistency condition is selected, i.e., the extracted pixel set. Subsequently, for this pixel set, according to preset spatial adjacency rules (such as four-neighbor or eight-neighbor connection rules), pixels that are spatially adjacent and have similar gradient changes are connected to form several continuous gradient consistent regions. Finally, these regions are identified as potential defect regions and integrated to form a second defect detection result, containing information such as the spatial location, size, and morphological characteristics of the defect, providing accurate and reliable data support for defect detection.

[0040] The first defect detection result and the second defect detection result are analyzed for defect cross-verification. Based on the defect cross-verification result, a pre-trained generative restoration model is called to perform residual detection under defect repair, and a third defect detection result is generated.

[0041] When performing cross-validation between the first and second defect detection results, the defect regions in the two sets of detection results are first compared and matched according to their spatial location and morphological features. The consistency and cross-validation degree of the defect information are determined by calculating the overlap, distance difference, and morphological similarity of the defect regions. If both sets of results detect defects in the same region and the features match well, the defect is confirmed as a valid defect, and the cross-validation result passes. Conversely, if there are significant differences between the two sets of results or the defect information does not match, the cross-validation result fails. Based on the cross-validation result, if the cross-validation fails, a pre-trained generative reconstruction model is invoked to repair the target defect image region identified in the second defect detection. The generative reconstruction model learns the texture and structural features of a large number of defect-free magnetic stripe images to generate a repaired image version. Subsequently, pixel-level difference analysis is performed between the repaired image and the original defect image to extract residual information. Based on the spatial distribution and intensity of the residuals, the defect region is relocated and finely detected. Finally, by combining the defect information obtained from mutual inspection and residual detection, a third defect detection result with higher accuracy and completeness is generated to support subsequent production quality control and judgment.

[0042] Furthermore, the first defect detection result and the second defect detection result are analyzed for defect cross-verification. Based on the defect cross-verification result, a pre-trained generative restoration model is called to perform residual detection under defect repair, generating a third defect detection result, including:

[0043] The defect region correspondence is compared between the first defect detection result and the second defect detection result to generate the defect cross-verification result; if the defect cross-verification result passes, the first defect detection result is output as the final defect detection result.

[0044] When performing defect cross-verification between the first and second defect detection results, the system first compares the spatial location and morphological features of the defect regions in the two sets of defect detection results. Specifically, this includes calculating the spatial overlap rate between defect regions and assessing the degree of positional overlap by judging the ratio of the intersection to the union of the two defect regions (i.e., the Intersection over Union, IoU); simultaneously, it analyzes the similarity of defect morphology, such as contour shape, size ratio, and edge features. Based on the above comparison results, a defect cross-verification result is generated to determine whether the two sets of detection results detect the same defect in the same region. If the defect cross-verification result shows that the correspondence between the two sets of detection results in the defect region meets a preset consistency threshold (e.g., IoU greater than a certain threshold and morphological similarity exceeding a certain proportion), then the defect cross-verification is deemed successful. At this point, the system outputs the first defect detection result as the final defect detection result, ensuring the accuracy and consistency of the defect detection results.

[0045] Furthermore, after generating the defect verification results, the process also includes:

[0046] If the defect cross-validation result fails, the target image with the highest detection value is extracted from the second image data; the generative restoration model is called to perform defect repair processing on the target image to generate a repaired image; the pixel-level residual information of the repaired image and the target image is compared; the defect region is relocated using the pixel-level residual information to generate the third defect detection result.

[0047] If the defect cross-verification result fails, meaning a stable and consistent correspondence cannot be established between the first and second defect detection results, the system initiates a residual detection process to improve detection accuracy. First, the target image with the highest detection value is extracted from the second image data. The value of the target image is jointly evaluated by multiple image quality indicators, specifically including image contrast (i.e., brightness difference intensity), edge sharpness (based on edge gradient change rate or Laplacian operator response), information entropy (reflecting the detail complexity and information content of the image), and texture sharpness (extracted by methods such as gray-level co-occurrence matrix or local binary pattern LBP). The system performs a weighted scoring of these indicators and selects the frame with the highest score as the target image. Subsequently, the system calls a pre-trained generative restoration model to perform defect repair processing on the target image. This generative restoration model is built based on defect-free magnetic stripe images and trained using a generative adversarial network (GAN) structure, enabling it to learn the distribution characteristics of normal magnetic stripe texture, structure, and background. After inputting a defective image, the model outputs a repaired image, i.e., a repaired image where the defective region in the target image is predicted to be in a normal state. Next, the repaired image and the original target image are compared at the pixel level to extract pixel-level residual information. This residual information reflects the differences in how the repair model repairs the defect area. Using this pixel-level residual information, the defect area is accurately relocated. Combining the spatial distribution and intensity features of the residual, the specific location and extent of the defect are redefined. Finally, a third defect detection result is generated based on this relocation result, significantly improving the accuracy and reliability of defect detection.

[0048] Furthermore, the generative restoration model is trained on a generative network using images of defect-free magnetic stripes to repair defects and generate the texture and structure of defect-free magnetic stripes.

[0049] Generative restoration models are image inpainting models based on generative neural network architectures. Their training data consists of a large number of defect-free magnetic stripe images. During training, the model learns the texture arrangement patterns, edge structure features, and background continuity information of these normal magnetic stripe images, gradually building its ability to generate "ideal magnetic stripe images." Since the training samples do not contain any defect-type data, such as scratches, stains, foreign object occlusion, or localized peeling, the model does not establish generation paths for defect features during parameter convergence. Therefore, during the model inference phase, even if the input image contains such defect information, the model automatically ignores these areas, treating them as "outliers" that do not conform to its learned patterns. This allows the model to reconstruct the image in a manner closest to the training distribution, outputting an idealized magnetic stripe image with the defects repaired.

[0050] The core capability of generative reconstruction models lies in reconstructing anomalous regions using normal image distributions, thereby indirectly exposing defective regions in the original image. Specifically, by calculating pixel-level differences between the original image and the model's output image, a residual map is obtained. This map reflects areas that the model cannot reconstruct, which are usually the actual defects in the image. Regions with significantly deviated pixel values ​​in the residual map are considered high-confidence defect candidate regions, providing a data foundation for subsequent defect relocalization and classification.

[0051] In summary, the embodiments of this application have at least the following technical effects:

[0052] First, the first image acquisition device on the magnetic strip production line is activated to acquire geometric interference images of the target magnetic strip moving on the production line, generating first image data. Then, the second image acquisition device on the magnetic strip production line is activated to acquire line scan images of the target magnetic strip moving on the production line, generating second image data. Next, image recognition based on geometric distortion is performed on the first image data to generate a first defect detection result. Image recognition based on spatial brightness gradient calculation is performed on multiple consecutive frames in the second image data to generate a second defect detection result. Finally, the first and second defect detection results are analyzed for defect cross-verification. Based on the defect cross-verification results, a pre-trained generative restoration model is called to perform residual detection under defect repair, generating a third defect detection result. This solves the technical problem of low accuracy in magnetic strip appearance defect detection in existing technologies, achieving the technical effect of improving the accuracy and reliability of magnetic strip appearance defect detection.

[0053] Example 2 is based on the same inventive concept as the image recognition-based automatic detection method for magnetic strip appearance defects in the foregoing examples, such as... Figure 2 As shown, this application provides an automatic detection system for magnetic strip appearance defects based on image recognition, wherein the system includes:

[0054] First image acquisition module 11: Activates the first image acquisition device on the magnetic strip production line, performs geometric interference image acquisition on the target magnetic strip moving on the production line, and generates first image data; Second image acquisition module 12: Activates the second image acquisition device on the magnetic strip production line, performs line scan image acquisition on the target magnetic strip moving on the production line, and generates second image data; First image recognition module 13: Performs image recognition based on geometric distortion on the first image data, and generates a first defect detection result; Second image recognition module 14: Performs image recognition based on spatial brightness gradient calculation on multiple consecutive frames of images in the second image data, and generates a second defect detection result; Detection module 15: Analyzes the first defect detection result and the second defect detection result for defect cross-verification, calls a pre-trained generative restoration model based on the defect cross-verification result to perform residual detection under defect repair, and generates a third defect detection result.

[0055] Furthermore, the first image acquisition module 11 is used to perform the following method:

[0056] The first image acquisition device is a structured light-assisted vision device, including a structured light projector and an industrial camera.

[0057] Furthermore, the second image acquisition module 12 is used to perform the following method:

[0058] The second image acquisition device is a line scan camera, and the frame rate of the line scan camera is matched with the moving speed of the target magnetic strip.

[0059] Furthermore, the second image acquisition module 12 is used to perform the following method:

[0060] The first image acquisition device and the second image acquisition device are subject to distance constraints; the distance constraints are determined by the influence range of the structured light projector in the first image acquisition device, the frame rate of the second image acquisition device, and the speed configuration of the target magnetic strip on the production line.

[0061] Furthermore, the first image recognition module 13 is used to perform the following method:

[0062] A preset structured light pattern of the first image acquisition device is acquired; based on the preset structured light pattern, stripe distortion is identified in the first image data, including gradient abrupt changes, stripe breaks, and distorted regions, and distortion feature information is determined; based on the distortion features, surface defect type analysis is performed, and the distortion location is mapped and associated to generate the first defect detection result.

[0063] Furthermore, the second image recognition module 14 is used to perform the following method:

[0064] After performing pixel alignment processing on the magnetic stripe region in the continuous multi-frame images, the sequence of brightness value changes of each pixel over time is calculated and extracted to generate a brightness change sequence of each pixel; brightness change gradient calculation is performed on the brightness change sequence of each pixel to generate a gradient change map of each pixel; consistent pixels are extracted based on the gradient change map of each pixel and connected according to the adjacency relationship to generate the second defect detection result.

[0065] Furthermore, the second image recognition module 14 is used to perform the following method:

[0066] Construct gradient consistency judgment constraints, including continuous gradient deviation thresholds; extract consistent pixels from the gradient change map of each pixel using the gradient consistency judgment constraints to generate an extracted pixel set; connect the similarity of the extracted pixel set that satisfies the preset adjacency relationship to generate the second defect detection result.

[0067] Furthermore, the detection module 15 is used to perform the following method:

[0068] The defect region correspondence is compared between the first defect detection result and the second defect detection result to generate the defect cross-verification result; if the defect cross-verification result passes, the first defect detection result is output as the final defect detection result.

[0069] Furthermore, the detection module 15 is used to perform the following method:

[0070] If the defect cross-validation result fails, the target image with the highest detection value is extracted from the second image data; the generative restoration model is called to perform defect repair processing on the target image to generate a repaired image; the pixel-level residual information of the repaired image and the target image is compared; the defect region is relocated using the pixel-level residual information to generate the third defect detection result.

[0071] Furthermore, the detection module 15 is used to perform the following method:

[0072] The generative restoration model is trained on defect-free magnetic stripe images using a generative network to repair defects and generate the texture and structure of defect-free magnetic stripes.

[0073] It should be noted that the order of the embodiments described above is merely for descriptive purposes and does not represent the superiority or inferiority of the embodiments. Furthermore, the above description focuses on specific embodiments of this specification. The processes depicted in the accompanying drawings do not necessarily require a specific or sequential order to achieve the desired results. In some implementations, multitasking and parallel processing are possible or may be advantageous.

[0074] The above description is only a preferred embodiment of this application and is not intended to limit this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.

[0075] This specification and accompanying drawings are merely illustrative examples of this application and are intended to cover any and all modifications, variations, combinations, or equivalents within the scope of this application. Clearly, those skilled in the art can make various alterations and modifications to this application without departing from its scope. Therefore, if such modifications and modifications fall within the scope of this application and its equivalents, this application intends to include such modifications and modifications.

Claims

1. An automatic detection method for appearance defects of magnetic strips based on image recognition, characterized in that, The methods include: Activate the first image acquisition device on the magnetic strip production line to acquire geometric interference images of the target magnetic strip that is moving on the production line and generate the first image data. Activate the second image acquisition device on the magnetic strip production line to perform line scan image acquisition on the target magnetic strip that is moving on the production line and generate second image data; Perform geometric distortion-based image recognition on the first image data to generate a first defect detection result; Perform image recognition based on spatial brightness gradient calculation on multiple consecutive frames of images in the second image data to generate a second defect detection result; The first defect detection result and the second defect detection result are analyzed for defect cross-verification. Based on the defect cross-verification result, a pre-trained generative restoration model is called to perform residual detection under defect repair, and a third defect detection result is generated. Specifically, the process involves analyzing the first defect detection result and the second defect detection result for cross-verification, then using a pre-trained generative restoration model based on the cross-verification result to perform residual detection under defect repair, generating a third defect detection result, including: Based on the first defect detection result and the second defect detection result, the correspondence between defect regions is compared to generate the defect cross-verification result. If the defect cross-verification result passes, the first defect detection result is output as the final defect detection result; After generating the defect verification results, the process also includes: If the defect cross-verification result fails, the target image with the highest detection value is extracted from the second image data; The generative restoration model is invoked to perform defect repair processing on the target image, generating a repaired image; Compare the pixel-level residual information between the repaired image and the target image; The defect region is relocated using the pixel-level residual information to generate the third defect detection result.

2. The automatic detection method for magnetic strip appearance defects based on image recognition as described in claim 1, characterized in that, The first image acquisition device is a structured light-assisted vision device, including a structured light projector and an industrial camera; the second image acquisition device is a line scan camera, the frame rate of which is matched with the moving speed of the target magnetic strip.

3. The automatic detection method for magnetic strip appearance defects based on image recognition as described in claim 2, characterized in that, The first image acquisition device and the second image acquisition device are subject to distance constraints; The distance constraint is determined by the influence range of the structured light projector in the first image acquisition device, the frame rate of the second image acquisition device, and the speed configuration of the target magnetic strip on the production line.

4. The automatic detection method for magnetic strip appearance defects based on image recognition as described in claim 1, characterized in that, Performing geometric distortion-based image recognition on the first image data to generate a first defect detection result includes: Acquire the preset structured light pattern of the first image acquisition device; Based on the preset structured light pattern, stripe distortion is identified in the first image data, including gradient abrupt changes, stripe breaks, and distorted regions, to determine distortion feature information; Surface defect type analysis is performed based on the distortion features, and the distortion location is mapped and associated to generate the first defect detection result.

5. The automatic detection method for magnetic strip appearance defects based on image recognition as described in claim 1, characterized in that, Perform image recognition based on spatial brightness gradient calculation on multiple consecutive frames of the second image data to generate a second defect detection result, including: After performing pixel alignment processing on the magnetic stripe region in the continuous multi-frame images, the sequence of brightness value changes of each pixel over time is calculated and generated as a sequence of brightness changes of each pixel. Calculate the brightness change gradient using the brightness change sequence of each pixel to generate a gradient change map for each pixel. Based on the gradient change map of each pixel, consistent pixels are extracted and connected according to the adjacency relationship to generate the second defect detection result.

6. The automatic detection method for magnetic strip appearance defects based on image recognition as described in claim 5, characterized in that, Based on the gradient change maps of each pixel, consistent pixels are extracted and connected according to their adjacency relationships to generate the second defect detection result, including: Construct gradient consistency judgment constraints, including continuous gradient deviation thresholds; The gradient consistency judgment constraint is used to extract consistent pixels from the gradient change map of each pixel to generate an extracted pixel set. The extracted pixels are connected by similarity that satisfy a preset adjacency relationship to generate the second defect detection result.

7. The automatic detection method for magnetic strip appearance defects based on image recognition as described in claim 1, characterized in that, The generative restoration model is trained on defect-free magnetic stripe images using a generative network to repair defects and generate the texture and structure of defect-free magnetic stripes.

8. An automatic detection system for magnetic strip appearance defects based on image recognition, characterized in that, For implementing the automatic detection method for magnetic strip appearance defects based on image recognition as described in any one of claims 1-7, the system comprises: First image acquisition module: Activates the first image acquisition device on the magnetic strip production line, performs geometric interference image acquisition on the target magnetic strip that is moving on the production line, and generates first image data; Second image acquisition module: Activates the second image acquisition device on the magnetic strip production line to perform line scan image acquisition on the target magnetic strip that is moving on the production line and generate second image data; First image recognition module: Performs geometric distortion-based image recognition on the first image data to generate a first defect detection result; Second image recognition module: Performs image recognition based on spatial brightness gradient calculation on multiple consecutive frames of images in the second image data to generate a second defect detection result; Detection module: Analyzes the first defect detection result and the second defect detection result for defect cross-verification, calls the pre-trained generative restoration model based on the defect cross-verification result to perform residual detection under defect repair, and generates a third defect detection result.

Citation Information

Patent Citations

  • Image processing device for defect inspection and image processing method for defect inspection

    CN102630299A

  • Device and method for detecting and measuring surface defects of products

    CN115201202A