Time-sharing stroboscopic multi-image defect detection method, device, electronic equipment and medium
By acquiring and processing multiple defect images under different exposure conditions, generating target feature matrix and defect weight matrix, the problem of low defect detection efficiency and accuracy in the prior art is solved, and fast and accurate defect detection of product images in industrial production is achieved.
Patent Information
- Application Number
- CN202411915946.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-24
- Publication Date
- 2025-04-08
AI Technical Summary
The prior art has low defect detection efficiency and accuracy of product images in industrial production, which affects production efficiency and accuracy.
By acquiring multiple defect images of the target detection product under different exposure conditions, determining the defect information and texture characteristics of the image, generating the target feature matrix and defect weight matrix, and achieving fast and accurate defect detection of the target image.
Fast and accurate defect detection of defect images is achieved, and the efficiency and accuracy of production operations are improved.
Smart Images

Figure CN119784720A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image processing technology, and in particular to a time-sharing stroboscopic multi-image defect detection method, device, electronic equipment and medium. Background Art
[0002] With the development of the times, intelligent production in the industrial field is becoming more and more important. At present, visual inspection equipment is mainly used to collect images of produced products, and the collected images are processed separately to determine the defect information of the produced products. This method is inefficient and has low accuracy, which affects the efficiency and accuracy of industrial production.
[0003] How to quickly and accurately determine the defect information of each product and improve the efficiency and accuracy of production operations is a key research issue in the industry. Summary of the invention
[0004] The present invention provides a time-sharing stroboscopic multi-image defect detection method, device, electronic equipment and medium to quickly and accurately detect defects in defective images, providing a basis for improving the operating efficiency and accuracy of production work.
[0005] According to one aspect of the present invention, a time-sharing stroboscopic multi-image defect detection method is provided, the method comprising:
[0006] Acquire multiple defect images of each target inspection product under different exposure conditions;
[0007] Determining defect information of each defect image, and determining texture features of each defect image based on each defect information and a gray level co-occurrence matrix;
[0008] Generating a target feature matrix matching each of the defect images based on each of the texture features, and generating a defect weight matrix based on each of the target feature matrices;
[0009] In response to a defect detection instruction of a target image, a target defect image matching the target image is generated based on the defect weight matrix, and defects of the target image are determined according to the target defect image.
[0010] According to another aspect of the present invention, a time-sharing stroboscopic multi-image defect detection device is provided, the device comprising:
[0011] A defect image acquisition module, used to acquire multiple defect images of each target detection product under different exposure conditions;
[0012] A texture feature determination module, used to determine defect information of each defect image, and determine a texture feature of each defect image based on each defect information and a gray level co-occurrence matrix;
[0013] A defect weight matrix generation module, used to generate a target feature matrix matching each of the defect images based on each of the texture features, and to generate a defect weight matrix based on each of the target feature matrices;
[0014] The defect generation module is used to respond to the defect detection instruction of the target image, generate a target defect image matching the target image based on the defect weight matrix, and determine the defect of the target image according to the target defect image.
[0015] According to another aspect of the present invention, there is provided an electronic device, the electronic device comprising:
[0016] at least one processor; and
[0017] a memory communicatively connected to the at least one processor; wherein,
[0018] The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the time-sharing stroboscopic multi-image defect detection method described in any embodiment of the present invention.
[0019] According to another aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the time-sharing stroboscopic multi-image defect detection method described in any embodiment of the present invention when executed.
[0020] According to another aspect of the present invention, a computer program product is provided, comprising a computer program, wherein when the computer program is executed by a processor, the computer program implements the time-sharing stroboscopic multi-image defect detection method described in any embodiment of the present invention.
[0021] The scheme of the embodiment of the present invention obtains multiple defect images of each target detection product under different exposure conditions; determines the defect information of each defect image, and determines the texture features of each defect image based on each defect information and a grayscale co-occurrence matrix; generates a target feature matrix matching each defect image based on each texture feature, and generates a defect weight matrix based on each target feature matrix; in response to a defect detection instruction of a target image, generates a target defect image matching the target image based on the defect weight matrix, and determines the defects of the target image according to the target defect image, so as to quickly and accurately perform defect detection on the defect image, and provide a basis for improving the operating efficiency and accuracy of production work.
[0022] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0024] Figure 1 is a flow chart of a time-sharing stroboscopic multi-image defect detection method provided according to the first embodiment of the present invention;
[0025] Figure 2 is a flow chart of a time-sharing stroboscopic multi-image defect detection method provided according to the second embodiment of the present invention;
[0026] Figure 3 It is a structural schematic diagram of a time-sharing stroboscopic multi-image defect detection device provided according to Embodiment 3 of the present invention;
[0027] Figure 4 It is a structural schematic diagram of an electronic device for implementing the time-sharing stroboscopic multi-image defect detection method of an embodiment of the present invention. DETAILED DESCRIPTION
[0028] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0029] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0030] Embodiment 1
[0031] Figure 1 This is a flow chart of a time-sharing stroboscopic multi-image defect detection method provided according to the first embodiment of the present invention. This embodiment is applicable to the case of detecting various defects of different objects to be detected. The method can be executed by a time-sharing stroboscopic multi-image defect detection device. The time-sharing stroboscopic multi-image defect detection device can be implemented in the form of hardware and / or software. The time-sharing stroboscopic multi-image defect detection device can be configured in electronic devices such as computers, servers or tablet computers. Figure 1 As shown, the method includes:
[0032] Step 110: Acquire multiple defect images of each target inspection product under different exposure conditions.
[0033] The target detection product may be a metal part, such as an engine component; or an electronic component, cloth, packaging material, food, body panel, glass or tire, etc., which is not limited in this embodiment.
[0034] In this embodiment, the exposure conditions can be changed by controlling parameters such as the number, intensity, angle or distance of light sources. In this embodiment, the specific values of parameters such as the specific number of light sources, the intensity, angle and distance of each light source are not limited.
[0035] Optionally, in this embodiment, the image of the target detection product can be acquired through a time-sharing line scan camera, or through other high-resolution cameras, which are not limited in this embodiment. Exemplarily, in this embodiment, 20, 50 or 200 defect images of the body panel can be collected under different exposure conditions through a time-sharing line scan camera.
[0036] In an optional implementation of the present embodiment, after acquiring an image of the target inspection product, it is possible to further determine whether each acquired image is a defect image. If the target image contains defects, that is, the target image is a defect image, then the target image can be retained and subsequently processed; if the target image does not contain defects, that is, the target image is a non-defective image, then the target image can be deleted and no further processing is performed on the target image.
[0037] Step 120: Determine defect information of each defect image, and determine texture features of each defect image based on the defect information and a gray level co-occurrence matrix.
[0038] The defect information of the defect image may include: the number of defects, the type of each defect, and the coordinate information of each defect in the image; illustratively, if the defect image is a defect image of a vehicle body panel, the defect information may be: the number of defects is 1, the defect type is a scratch, and the coordinate information of the defect in the image may be (A1, B1), (A2, B2), (A3, B3) and (A4, B4), wherein (A1, B1), (A2, B2), (A3, B3) and (A4, B4) represent different pixel points in the image, which together form a rectangular area containing the defect. In this embodiment, the coordinate information of the defect in the image may also be (A, B), which may be the coordinate information of the center point of the defect area.
[0039] In an optional implementation of the present embodiment, the number of defects and the type of each defect in the defect image can be determined manually; further, the coordinate information of each defect can be determined by image detection. For example, the area where the defect is located can be determined as the area of interest, and further, the coordinate information of each vertex of the area of interest can be determined as the coordinate information of the defect.
[0040] In another optional implementation of this embodiment, the input values of each defect image may be pre-trained into a target recognition model, and further, the number of defects contained in each defect image, the type of defects, and the coordinate information of each defect may be obtained through the output of the target recognition model.
[0041] Optionally, in this embodiment, after determining the defect information of each defect image, the texture features of each defect image can be further obtained based on the defect information and the gray-level co-occurrence matrix; wherein the texture features of each defect image may include at least one of the following: contrast, autocorrelation, entropy, homogeneity and second-order moment, which are not limited in this embodiment.
[0042] In an optional implementation of the present embodiment, after determining the defect information of each defect image, a target grayscale co-occurrence matrix of the target defect in the target defect image can be constructed. For example, the target grayscale co-occurrence matrix can be constructed based on the defect area of the target defect (which can be determined based on the coordinate information of the target defect). Furthermore, the contrast, autocorrelation, entropy, homogeneity and second-order moment in the target grayscale co-occurrence matrix can be extracted to obtain the texture features of the target defect image; wherein the target defect image can be any defect image collected; the target defect can be one or more defects in the target defect image, which is not limited in the present embodiment.
[0043] In this embodiment, for the same defect area, different directions or distances can be selected to obtain multiple gray level co-occurrence matrices of the defect area. Furthermore, each gray level co-occurrence matrix can be normalized or averaged to obtain the gray level co-occurrence matrix of the defect area.
[0044] Optionally, in this embodiment, for the target gray level co-occurrence matrix, the corresponding texture features can be extracted by the following formula:
[0045] Contrast ratio:
[0046] Homogeneity:
[0047] Dissimilarity:
[0048] entropy:
[0049] Angular second moment:
[0050] Relevance: in, Variance = ∑ i,j (i-mean) 2 p(i,j).
[0051] Step 130: Generate a target feature matrix matching each of the defect images based on each of the texture features, and generate a defect weight matrix based on each of the target feature matrices.
[0052] In an optional implementation of this embodiment, after determining the texture features of each defect image, further, a target feature matrix matching each defect image can be generated based on each texture feature, and further, a defect weight matrix can be generated based on each target feature matrix.
[0053] Optionally, in this embodiment, after determining the texture features of the target defect image, the texture features may be combined to obtain a target feature matrix that matches the target defect image; illustratively, the target feature matrix of the target defect image may be as follows:
[0054]
[0055] Among them, each row in the target feature matrix can represent a feature vector, and the combination of feature vectors can obtain the target feature matrix.
[0056] Furthermore, the mean vector can be determined based on the target feature matrix of each defect image, and the reference feature matrix can be determined based on the difference between the target feature matrix and the mean vector; further, the defect weight matrix involved in this embodiment can be determined based on the reference feature matrix.
[0057] Step 140 : In response to a defect detection instruction of a target image, a target defect image matching the target image is generated based on the defect weight matrix, and defects of the target image are determined according to the target defect image.
[0058] The target defect image displays defect information of each target defect of the target image; illustratively, the defect type of the target defect and the coordinates of the vertices or the center point of the defect area may be displayed.
[0059] Among them, the target image can be a newly collected image of the target detection product, or a newly collected image of a new object of the same type as the target detection product; illustratively, if the target detection product is cloth, then the target image can be an image of newly produced cloth collected by a time-sharing line scan camera; in this embodiment, the target image can be understood as a test image, and the number of target images can be one or more, which is not limited in this embodiment.
[0060] Optionally, in this embodiment, after receiving a defect detection instruction for a target image, a target defect image matching the target image can be further generated based on the defect weight matrix determined in the above steps. Furthermore, each defect information of the target image can be determined based on the target defect image to obtain the defects of the target image.
[0061] In an optional implementation of this embodiment, the target image can be linearly stretched to obtain a stretching matrix that matches the target image. For example, the target image can be stretched to the same dimension as the defect weight matrix. Furthermore, a target shape matrix that matches the target defect image can be generated based on the stretching matrix and the defect weight matrix.
[0062] The scheme of this embodiment obtains multiple defect images of each target detection product under different exposure conditions; determines the defect information of each defect image, and determines the texture features of each defect image based on each defect information and a grayscale co-occurrence matrix; generates a target feature matrix matching each defect image based on each texture feature, and generates a defect weight matrix based on each target feature matrix; in response to a defect detection instruction of a target image, generates a target defect image matching the target image based on the defect weight matrix, and determines the defects of the target image according to the target defect image, so as to quickly and accurately perform defect detection on the defect image, and provide a basis for improving the operating efficiency and accuracy of production work.
[0063] Embodiment 2
[0064] Figure 2 1 is a flow chart of a time-sharing stroboscopic multi-image defect detection method provided according to the second embodiment of the present invention. This embodiment is a further refinement of the above technical solution. The technical solution in this embodiment can be combined with various optional solutions in one or more of the above embodiments. Figure 2 As shown, the method includes:
[0065] Step 210: Acquire multiple defect images of each target inspection product under different exposure conditions.
[0066] Optionally, in the present embodiment, obtaining multiple defect images of each target detection product under different exposure conditions may include: configuring light sources of different brightness at different positions in the target detection area, and synchronously controlling a time-sharing line scan camera and each of the light sources; obtaining multiple acquired images of each target detection product under different exposure conditions based on the synchronized time-sharing line scan camera and each of the light sources; and screening each of the acquired images to obtain each of the defect images.
[0067] Among them, the target detection area can be a link in the production line of producing the target detection product. For example, if the target detection product is a body panel, then the target detection area can be a link in the production process of the body panel (for example, the inspection link after the production of the body panel), or it can be a link in the vehicle assembly process (for example, the component inspection link before obtaining the overall structure of the vehicle based on each body panel). This is not limited in this embodiment.
[0068] In an optional implementation of the present embodiment, light sources of different brightness may be installed above the target detection area or at different edge points (the installation angle of each light source is not fixed), and the time-sharing line scan camera and each light source may be controlled synchronously, thereby ensuring the time synchronization between the exposure of the time-sharing line scan camera and the flashing of the light source.
[0069] Furthermore, images of the target inspection product under different exposure conditions can be collected based on the synchronized time-sharing line scan camera and each light source, and then each image can be screened to obtain a defect image. Exemplarily, the collected unclear images, incomplete images or images without defects can be filtered out to obtain the final defect image; in this embodiment, the number of defect images can be 10, 20, 50 or 100, etc., which is not limited in this embodiment.
[0070] The advantage of this setting is that defect images under different exposure conditions can be obtained, providing a basis for the subsequent production of defect weight matrices; compared with the large model solution, this embodiment can also obtain the defect weight matrix through fewer defect images, providing a basis for the subsequent high-precision image defects.
[0071] Step 220 , determining a target defect area in the target defect image; identifying the target defect area to obtain the defect type of the target defect area and coordinate information of the defect area.
[0072] The target defect image may be any defect image collected, and the target defect area may be any one or more defects in the target defect image, which are not limited in this embodiment.
[0073] Optionally, in this embodiment, after each defect image is determined, a target defect area in the target defect image can be further determined; further, the target defect area can be identified to obtain the defect type of the target defect area and the coordinate information of the defect area.
[0074] The defect type may be scratches, dirt or damage, etc. The coordinate information of the defect area may be the coordinates of each vertex of the defect area, or the coordinates of the center point of the defect area, which is not limited in this embodiment.
[0075] In an optional implementation of the present embodiment, the target defect image can be threshold segmented to obtain a target defect area. Furthermore, the coordinates of each vertex of the target defect area can be obtained and used as the target area coordinate information. At the same time, the defect type of the target defect area can be identified. Exemplarily, the defect type of the target area can be determined manually, or the target area can be compared with various known types of defects to determine the defect type of the target area.
[0076] The advantage of such a setting is that the defect information in the defect image can be obtained quickly.
[0077] Step 230, construct reference gray-level co-occurrence matrices for each defect area respectively, and normalize each reference gray-level co-occurrence matrix to obtain each target gray-level co-occurrence matrix; extract texture features of each target gray-level co-occurrence matrix, and determine the texture features as the texture features of each defect image.
[0078] Optionally, in this embodiment, after obtaining the defect information of each defect image, the reference gray-level co-occurrence matrix of each defect area can be further constructed. For example, for each pixel (i, j) in the defect image, if the given distance and angle conditions are met and they are all located in the defect area, then the elements in the corresponding gray-level co-occurrence matrix are updated; it can be understood that the gray-level co-occurrence matrix is a two-dimensional array, and its size depends on the grayscale level of the image. For example, for an 8-bit grayscale image, the grayscale level is 256, and the size of the gray-level co-occurrence matrix is 256x256.
[0079] Furthermore, each reference gray-level co-occurrence matrix may be normalized to obtain a target gray-level co-occurrence matrix associated with each reference co-occurrence matrix; this may facilitate faster extraction of texture features later.
[0080] Further, the texture features of each target gray-level co-occurrence matrix can be extracted. It can be understood that the extracted texture features are the texture features of each defect area in each defect image. In this embodiment, each element in the target gray-level co-occurrence matrix can be processed based on the formula of each texture feature involved in the above embodiment to obtain each texture feature. This will not be described in detail in this embodiment, and it is not a limitation of this embodiment.
[0081] Step 240, generating a target feature matrix matching the target defect image based on each texture feature of the target defect area of the target defect image; determining the mean vector of each target feature matrix, and determining a reference feature matrix based on the difference between the target feature matrix and the mean vector; and determining the defect weight matrix according to each reference feature matrix.
[0082] Optionally, in this embodiment, after extracting the texture features of each defect area in each defect image, a target feature matrix of the target defect image can be further generated based on each texture feature of the target defect area of the target defect image; illustratively, each texture feature of the target defect area can be combined to obtain a target feature matrix; further, the mean vector of each target feature matrix of each defect image can be determined; in this embodiment, the mean vector can be determined based on the following formula:
[0083]
[0084] Where num is the number of defective images; X iis the target feature matrix of each defect image.
[0085] Furthermore, the reference feature matrix may be determined based on the difference between the target feature matrix and the mean vector; illustratively, the reference feature matrix may be determined based on the following formula:
[0086] X′=X-μ 均值向量 ;
[0087] Among them, X′ is the reference feature matrix; X is the target feature matrix.
[0088] Further, a defect weight matrix can be determined according to each reference feature matrix; optionally, in this embodiment, determining the defect weight matrix according to each reference feature matrix may include: determining an associated feature matrix of the reference feature matrix; and determining the defect weight matrix based on the reference feature matrix and the associated feature matrix.
[0089] The correlation matrix of the reference feature matrix may be a transposed matrix of the reference feature matrix or an inverse matrix of the reference feature matrix, which is not limited in this embodiment.
[0090] In an optional implementation of this embodiment, after obtaining the reference feature matrix, the transposed matrix of the reference feature matrix can be further obtained, and the final defect weight matrix can be obtained according to the reference feature matrix and the transposed matrix of the reference feature matrix; illustratively, the defect weight matrix can be determined based on the following formula:
[0091]
[0092] Among them, X ′T is the transposed matrix of the reference feature matrix.
[0093] Step 250, determine a target difference matrix that matches the target image, and generate a target stretching matrix that matches the target image based on the target difference matrix; obtain a target shape matrix that matches the target image based on the product of the target stretching matrix and the defect weight matrix.
[0094] Wherein, the target shape matrix matches the target defect image.
[0095] Optionally, in this embodiment, after receiving a defect detection instruction for a target image, a target difference matrix matching the target image can be further determined, and a target stretching matrix matching the target image can be generated based on the target difference matrix; further, a target shape matrix matching the target image can be obtained based on the product of the target stretching matrix and the defect weight matrix, that is, a target defect image matching the target image can be obtained.
[0096] In an optional implementation of this embodiment, the threshold value may be obtained based on the two images with the highest and lowest brightness in the target image:
[0097]
[0098] Among them, the target difference matrix is the cumulative sum of each difference matrix.
[0099]
[0100] Furthermore, the target stretching matrix can be determined based on the following formula:
[0101]
[0102] The target stretching matrix is the cumulative sum of each stretching matrix.
[0103] Furthermore, the target shape matrix can be obtained by multiplying the target stretching matrix and the defect weight matrix:
[0104] ∑ 形状矩阵 = target stretch matrix · target shape matrix;
[0105] in,
[0106] The target shape matrix is the cumulative sum of each shape matrix.
[0107] Step 260: Determine defects of the target image according to the target defect image.
[0108] Optionally, in this embodiment, after the target defect image is obtained, the defect of the target image may be further determined based on the target defect image.
[0109] The solution of this embodiment, after obtaining the texture features of each defect image, can quickly determine the defect weight matrix based on each texture feature, provide a basis for the subsequent rapid determination of the defects of each image, and perform efficient calculations in actual production work.
[0110] Embodiment 3
[0111] Figure 3 1 is a schematic diagram of the structure of a time-sharing stroboscopic multi-image defect detection device according to Embodiment 3 of the present invention. Figure 3 As shown, the device includes: a defect image acquisition module 310, a texture feature determination module 320, a defect weight matrix generation module 330 and a defect generation module 340.
[0112] Among them, the defect image acquisition module 310 is used to acquire multiple defect images of each target detection product under different exposure conditions;
[0113] A texture feature determination module 320, used to determine defect information of each defect image, and determine a texture feature of each defect image based on each defect information and a gray level co-occurrence matrix;
[0114] A defect weight matrix generating module 330 is used to generate a target feature matrix matching each of the defect images based on each of the texture features, and to generate a defect weight matrix based on each of the target feature matrices;
[0115] The defect generation module 340 is used to respond to the defect detection instruction of the target image, generate a target defect image matching the target image based on the defect weight matrix, and determine the defect of the target image according to the target defect image.
[0116] The solution of this embodiment is to obtain multiple defect images of each target detection product under different exposure conditions through a defect image acquisition module; determine the defect information of each defect image through a texture feature determination module, and determine the texture features of each defect image based on each defect information and a grayscale co-occurrence matrix; generate a target feature matrix matching each defect image based on each texture feature through a defect weight matrix generation module, and generate a defect weight matrix based on each target feature matrix; respond to the defect detection instruction of the target image through a defect generation module, generate a target defect image matching the target image based on the defect weight matrix, and determine the defects of the target image according to the target defect image, so as to quickly and accurately perform defect detection on the defect image, and provide a basis for improving the work efficiency and accuracy of production work.
[0117] In an optional implementation of this embodiment, the defect image acquisition module 310 is specifically used to configure light sources with different brightness at different positions in the target detection area, and synchronously control the time-sharing line scanning camera and each of the light sources;
[0118] Acquire multiple collected images of each target detection product under different exposure conditions based on the synchronized time-sharing line scan camera and each of the light sources;
[0119] The collected images are screened to obtain the defect images.
[0120] In an optional implementation of this embodiment, the defect information includes the defect type of each defect and the coordinate information of each defect in the image;
[0121] Accordingly, the texture feature determination module 320 is specifically used to determine the target defect area in the target defect image;
[0122] The target defect area is identified to obtain the defect type of the target defect area and the coordinate information of the defect area.
[0123] In an optional implementation of this embodiment, the texture feature determination module 320 is further specifically used to construct reference gray-level co-occurrence matrices of each defect area, and normalize each reference gray-level co-occurrence matrix to obtain each target gray-level co-occurrence matrix;
[0124] Extracting texture features of each of the target gray-level co-occurrence matrices, and determining the texture features as texture features of each of the defect images;
[0125] The texture feature includes at least one of the following: contrast, autocorrelation, entropy, homogeneity and second-order moment.
[0126] In an optional implementation of this embodiment, the defect weight matrix generation module 330 is specifically used to generate a target feature matrix matching the target defect image based on each texture feature of the target defect area of the target defect image;
[0127] Determine the mean vector of each target feature matrix, and determine the reference feature matrix based on the difference between the target feature matrix and the mean vector;
[0128] The defect weight matrix is determined according to each of the reference feature matrices.
[0129] In an optional implementation of this embodiment, the defect weight matrix generation module 330 is further specifically used to determine the associated feature matrix of the reference feature matrix;
[0130] The defect weight matrix is determined based on the reference feature matrix and the associated feature matrix.
[0131] In an optional implementation of this embodiment, the defect generation module 340 is specifically used to determine a target difference matrix matching the target image, and generate a target stretching matrix matching the target image according to the target difference matrix;
[0132] Obtaining a target shape matrix matching the target image according to the product of the target stretching matrix and the defect weight matrix;
[0133] Wherein, the target shape matrix matches the target defect image.
[0134] The time-sharing stroboscopic multi-image defect detection device provided in the embodiment of the present invention can execute the time-sharing stroboscopic multi-image defect detection method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.
[0135] Embodiment 4
[0136] Figure 4 A schematic diagram of the structure of an electronic device 10 that can be used to implement an embodiment of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.
[0137] like Figure 4 As shown, the electronic device 10 includes at least one processor 11, and a memory connected to the at least one processor 11, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 to the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0138] A number of components in the electronic device 10 are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0139] The processor 11 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The processor 11 executes the various methods and processes described above, such as a time-sharing stroboscopic multi-image defect detection method, which includes: obtaining multiple defect images of each target detection product under different exposure conditions; determining the defect information of each defect image, and determining the texture features of each defect image based on each defect information and a grayscale co-occurrence matrix; generating a target feature matrix matching each defect image based on each texture feature, and generating a defect weight matrix based on each target feature matrix; in response to a defect detection instruction of a target image, generating a target defect image matching the target image based on the defect weight matrix, and determining the defect of the target image according to the target defect image.
[0140] In some embodiments, the time-sharing stroboscopic multi-image defect detection method may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the time-sharing stroboscopic multi-image defect detection method described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to perform the time-sharing stroboscopic multi-image defect detection method in any other appropriate manner (e.g., by means of firmware).
[0141] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0142] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0143] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in combination with an instruction execution system, device or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0144] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).
[0145] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.
[0146] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.
[0147] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.
[0148] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A time-sharing stroboscopic multi-image defect detection method, characterized in that: include: Acquire multiple defect images of each target inspection product under different exposure conditions; Determining defect information of each defect image, and determining texture features of each defect image based on each defect information and a gray level co-occurrence matrix; Generating a target feature matrix matching each of the defect images based on each of the texture features, and generating a defect weight matrix based on each of the target feature matrices; In response to a defect detection instruction of a target image, a target defect image matching the target image is generated based on the defect weight matrix, and defects of the target image are determined according to the target defect image.
2. The time-sharing stroboscopic multi-image defect detection method according to claim 1 is characterized in that: The obtaining of multiple defect images of each target detection product under different exposure conditions includes: Disposing light sources of different brightness at different positions in the target detection area, and synchronously controlling the time-sharing line scan camera and each of the light sources; Acquire multiple collected images of each target detection product under different exposure conditions based on the synchronized time-sharing line scan camera and each of the light sources; The collected images are screened to obtain the defect images.
3. The time-sharing stroboscopic multi-image defect detection method according to claim 1, characterized in that: The defect information includes the defect type of each defect and the coordinate information of each defect in the image; Correspondingly, the determining the defect information of each defect image includes: determining a target defect area in a target defect image; The target defect area is identified to obtain the defect type of the target defect area and the coordinate information of the defect area.
4. The time-sharing stroboscopic multi-image defect detection method according to claim 3 is characterized in that: The determining of the texture features of each defect image based on each defect information and the gray level co-occurrence matrix includes: Constructing reference gray-level co-occurrence matrices for each defect region respectively, and normalizing each reference gray-level co-occurrence matrix to obtain each target gray-level co-occurrence matrix; Extracting texture features of each of the target gray-level co-occurrence matrices, and determining the texture features as texture features of each of the defect images; The texture feature includes at least one of the following: Contrast, autocorrelation, entropy, homogeneity, and second-order moments.
5. The time-sharing stroboscopic multi-image defect detection method according to claim 1, characterized in that: The generating target feature matrices matching the defect images based on the texture features respectively, and generating defect weight matrices based on the target feature matrices, comprises: Generate a target feature matrix matching the target defect image based on each texture feature of the target defect area of the target defect image; Determine the mean vector of each target feature matrix, and determine the reference feature matrix based on the difference between the target feature matrix and the mean vector; The defect weight matrix is determined according to each of the reference feature matrices.
6. The time-sharing stroboscopic multi-image defect detection method according to claim 5, characterized in that: Determining the defect weight matrix according to each of the reference feature matrices includes: Determining a correlation feature matrix of the reference feature matrix; The defect weight matrix is determined based on the reference feature matrix and the associated feature matrix.
7. The time-sharing stroboscopic multi-image defect detection method according to claim 1, characterized in that: The step of generating a target defect image matching the target image based on the defect weight matrix includes: Determining a target difference matrix that matches the target image, and generating a target stretching matrix that matches the target image according to the target difference matrix; Obtaining a target shape matrix matching the target image according to the product of the target stretching matrix and the defect weight matrix; Wherein, the target shape matrix matches the target defect image.
8. A time-sharing stroboscopic multi-image defect detection device, characterized in that: include: A defect image acquisition module, used to acquire multiple defect images of each target detection product under different exposure conditions; A texture feature determination module, used to determine defect information of each defect image, and determine the texture feature of each defect image based on each defect information and a gray level co-occurrence matrix; A defect weight matrix generation module, used to generate a target feature matrix matching each of the defect images based on each of the texture features, and to generate a defect weight matrix based on each of the target feature matrices; The defect generation module is used to respond to the defect detection instruction of the target image, generate a target defect image matching the target image based on the defect weight matrix, and determine the defect of the target image according to the target defect image.
9. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the time-sharing stroboscopic multi-image defect detection method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the time-sharing stroboscopic multi-image defect detection method according to any one of claims 1 to 7 when executed.