Product defect detection methods, related devices and computer-readable storage media
By employing segmentation, feature extraction, clustering, and neural network model splicing of salient features, the problem of low accuracy in traditional detection methods is solved, achieving more efficient identification of product surface defects.
Patent Information
- Application Number
- CN202310458754.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-04-25
- Publication Date
- 2025-11-14
- Estimated Expiration
- 2043-04-25
AI Technical Summary
Traditional surface inspection methods have low accuracy and are difficult to effectively identify product surface defects.
By acquiring product images, segmenting them into sub-images, extracting low-level and high-level features of RGB color and contrast information, performing clustering and saliency calculations, and using a neural network model to stitch together saliency features to identify surface defects.
It improves the accuracy of product defect detection, enabling better differentiation between similar and different areas and enhancing detection effectiveness.
Smart Images

Figure CN117115076B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of surface defect detection technology, and in particular to a product defect detection method, related apparatus and computer-readable storage medium. Background Technology
[0002] With the rapid development of science and technology, the requirements for processed products in industrial production are becoming increasingly stringent. Enterprises and users are also demanding stricter standards for product surface quality. Therefore, in actual industrial production, after the products are finished, surface quality defects are detected and analyzed.
[0003] Traditional surface inspection methods primarily identify surface defects by analyzing structural features such as texture, skeleton, edges, and spectrum in surface defect images. This approach is prone to technical problems related to low detection accuracy. Summary of the Invention
[0004] This application provides a product defect detection method, related apparatus, and computer-readable storage medium, which can improve the accuracy of product defect detection.
[0005] In a first aspect, embodiments of this application provide a product defect detection method, which may include the following steps:
[0006] Obtain an image of the target product;
[0007] The image of the target product is segmented to obtain multiple sub-images;
[0008] Features are extracted from each sub-image to obtain at least one low-level feature and at least one high-level feature, wherein the at least one low-level feature indicates the RGB color information of the sub-image; and the at least one high-level feature indicates the contrast information between the product and the background contained in the sub-image.
[0009] Clustering is performed on the at least one low-level feature and the at least one high-level feature to obtain multiple clustering diagrams;
[0010] For each cluster graph, a significance calculation is performed to obtain the significance sub-features corresponding to each cluster graph;
[0011] The salient features are obtained by concatenating the salient sub-features corresponding to each cluster graph.
[0012] The surface defects of the target product are identified based on the at least one low-level feature, the at least one high-level feature, and the salient feature.
[0013] Implementing the embodiments of this application, on the one hand, the obtained saliency features are related to low-level features and high-level features. The low-level features indicate the RGB color information of the image, while the high-level features indicate the contrast information between the product and the background contained in the image. Furthermore, the contrast information reflects the saliency of the object and the background, which can effectively distinguish between similar and different areas. On the other hand, when identifying surface defects of a target product through low-level features, high-level features, and saliency features, a better saliency map can be obtained by fully considering the characteristics between different features. In this way, the detection accuracy of product defects can be improved.
[0014] In one possible implementation, the concatenation of the salient sub-features corresponding to each cluster graph to obtain salient features includes:
[0015] Based on the weights corresponding to each salient sub-feature, the salient sub-features corresponding to each cluster graph are concatenated using a neural network model to obtain the salient features.
[0016] In one possible implementation, the weight corresponding to each saliency sub-feature is obtained by training the neural network model based on the difference between the saliency map of the sample image and the reference saliency map corresponding to the sample image.
[0017] In one possible implementation, the neural network model includes a hidden layer.
[0018] In one possible implementation, the number of low-level features is three, including color information from the R channel, the G channel, and the B channel; the number of high-level features is two, including global contrast features and background contrast features; identifying surface defects of the target product based on at least one low-level feature, at least one high-level feature, and the saliency feature includes:
[0019] The surface defects of the target product are identified based on the color information of the R channel, the color information of the G channel, the color information of the B channel, the global contrast feature, the background contrast feature, and the saliency feature.
[0020] In summary, the product defect detection method proposed in this application first segments an image to obtain multiple sub-images. Then, it extracts features from each sub-image to obtain three low-level features and two high-level features. The three low-level features include color information from the R channel, G channel, and B channel, while the two high-level features include global contrast features and background contrast features. Subsequently, the three low-level features and two high-level features are clustered to obtain multiple cluster maps. The saliency of each cluster map is calculated, and the multiple saliency maps are merged into a single saliency map using a neural network model. Thus, surface defects of the target product can be identified based on the obtained three low-level features, two high-level features, and saliency features. On the one hand, the acquired saliency features are related to low-level features and high-level features. Low-level features indicate the RGB color information of the image, while high-level features indicate the contrast information between the product and the background contained in the image. Furthermore, the contrast information reflects the saliency of the object and the background, which can effectively distinguish between similar and different areas. On the other hand, when identifying surface defects of target products through low-level features, high-level features, and saliency features, a better saliency map can be obtained by fully considering the characteristics between different features. In this way, the detection accuracy of product defects can be improved.
[0021] Secondly, embodiments of this application provide a product defect detection device, which may include:
[0022] The image acquisition module is used to acquire images of the target product;
[0023] The segmentation module is used to segment the image of the target product to obtain multiple sub-images;
[0024] A feature extraction module is used to extract features from each sub-image to obtain at least one low-level feature and at least one high-level feature, wherein the at least one low-level feature indicates the RGB color information of the sub-image; and the at least one high-level feature indicates the contrast information between the product and the background contained in the sub-image.
[0025] A clustering module is used to cluster the at least one low-level feature and the at least one high-level feature to obtain multiple clustering graphs;
[0026] The saliency calculation module is used to calculate the saliency of each cluster graph and obtain the saliency sub-features corresponding to each cluster graph.
[0027] The feature splicing module is used to splice the salient sub-features corresponding to each cluster graph to obtain salient features;
[0028] The identification module is used to identify surface defects of the target product based on the at least one low-level feature, the at least one high-level feature, and the salient feature.
[0029] In one possible implementation, the clustering module is specifically used for:
[0030] Based on the weights corresponding to each salient sub-feature, the salient sub-features corresponding to each cluster graph are concatenated using a neural network model to obtain the salient features.
[0031] In one possible implementation, the weight corresponding to each saliency sub-feature is obtained by training the neural network model based on the difference between the saliency map of the sample image and the reference saliency map corresponding to the sample image.
[0032] In one possible implementation, the neural network model includes a hidden layer.
[0033] In one possible implementation, the number of low-level features is three, including color information from the R channel, the G channel, and the B channel; the number of high-level features is two, including global contrast features and background contrast features; the recognition module is specifically used for:
[0034] The surface defects of the target product are identified based on the color information of the R channel, the color information of the G channel, the color information of the B channel, the global contrast feature, the background contrast feature, and the saliency feature.
[0035] Thirdly, embodiments of this application provide an electronic device including a processor and a memory interconnected thereto. The memory is used to store a computer program that supports a server in executing the above-described method. The computer program includes program instructions, and the processor is configured to invoke the program instructions to execute the method described in the first aspect.
[0036] Fourthly, embodiments of this application provide a computer-readable storage medium storing a computer program, the computer program including program instructions, which, when executed by a processor, cause the processor to perform the method described in the first aspect.
[0037] Fifthly, embodiments of this application also provide a computer program, the computer program including program instructions, which, when executed by a processor, cause the processor to perform the method described in the first aspect. Attached Figure Description
[0038] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below.
[0039] Figure 1 This is a schematic diagram of the structure of a surface defect detection system 11 provided in an embodiment of this application;
[0040] Figure 2 This is a schematic flowchart of a product defect detection method provided in an embodiment of this application;
[0041] Figure 3 This is a schematic diagram of the structure of a product defect detection device provided in an embodiment of this application;
[0042] Figure 4 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0043] The technical solutions in the embodiments of this application will now be described with reference to the accompanying drawings.
[0044] The terms "first," "second," "third," and "fourth," etc., used in the specification, claims, and accompanying drawings of this application are used to distinguish different objects, not to describe a specific order. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or apparatus that includes a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units not listed, or may optionally include other steps or units inherent to these processes, methods, products, or apparatuses.
[0045] In this document, the term "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of this application. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.
[0046] See Figure 1This is a schematic diagram of the structure of a surface defect detection system 11 provided in an embodiment of this application. It includes an image acquisition module 111, a signal control module 112, and a defect detection module 113. The image acquisition module 111 consists of two sets of CCDs, one for acquiring images of the upper surface and the other for acquiring images of the lower surface. The number of cameras in each CCD set is determined according to the acquisition range and the width of the strip. Each CCD is equipped with an image processing card and a high-intensity light source to acquire images of the wire surface in real time. The signal control module 112 is a hardware control module, composed of a PLC or control hardware. Its main function is to control and transmit the speed, production data, and information from the image processing card required for detection to the defect detection module 113. Simultaneously, the parameters in the defect detection module 113 are transmitted to the image acquisition module 111. The defect detection module 113 can be composed of a computer. Its main function is to isolate discontinuous parts or parts significantly inconsistent with the background in the captured images to determine whether they are suspected defects. It also controls the cameras to acquire and display defect images or provides defect images to other production stages.
[0047] by Figure 1 Taking the surface defect detection system shown below as an example, the following details how it identifies surface defects in a target product. Figure 2 As shown, the steps may include, but are not limited to, the following:
[0048] Step S201: Obtain an image of the target product.
[0049] Step S202: Segment the image of the target product to obtain multiple sub-images.
[0050] For example, the gRGBSLLC superpixel algorithm can be used to segment an image of a target product, resulting in multiple sub-images. This algorithm uses the similarity between adjacent pixels to group pixels and uses the statistical features of pixels within a group to replace the pixels in the entire region.
[0051] Step S203: Extract features from each sub-image to obtain at least one low-level feature and at least one high-level feature, wherein the at least one low-level feature indicates the RGB color information of the sub-image; and the at least one high-level feature indicates the contrast information between the product and the background contained in the sub-image.
[0052] For example, the number of low-level features is three, including color information of the R channel, color information of the G channel, and color information of the B channel.
[0053] For example, the number of high-level features is two, including global contrast features and background contrast features. In general, contrast features reflect the salience of objects and backgrounds, effectively distinguishing similar and dissimilar areas. Specifically, global contrast features comprehensively consider both regional contrast and spatial features. Background contrast features comprehensively consider boundary information in the image, highlighting areas in the center of the image. Using this information, the background and salient objects can be effectively distinguished.
[0054] For example, the values of the three RGB channels of each superpixel can be averaged to obtain the color information of the R channel, the G channel, and the B channel.
[0055] In this way, the next clustering algorithm can better cluster the background into one category and the salient objects into another category.
[0056] Step S204: Cluster the at least one low-level feature and the at least one high-level feature to obtain multiple clustering diagrams.
[0057] In one embodiment, clustering can be performed using the three low-level features and two high-level features to obtain multiple cluster diagrams.
[0058] Step S205: Calculate the significance of each cluster graph to obtain the significance sub-features corresponding to each cluster graph.
[0059] Step S206: Concatenate the salient sub-features corresponding to each cluster graph to obtain salient features.
[0060] In one embodiment, concatenating the salient sub-features corresponding to each cluster graph to obtain salient features can be achieved by: concatenating the salient sub-features corresponding to each cluster graph using a neural network model based on the weights corresponding to each salient sub-feature. The neural network model includes a hidden layer. It should be understood that concatenating the salient sub-features corresponding to each cluster graph using a neural network model can be achieved by multiplying the weights corresponding to each salient sub-feature by the pixel values of each cluster graph, then summing the results, and using the summed pixel values as the pixel values of the salient graph, thereby obtaining the salient features.
[0061] It should be understood that the reference saliency map corresponding to the aforementioned sample image can be a manually labeled saliency map or a saliency map with good machine recognition performance. The difference between the saliency map of the aforementioned sample image and the reference saliency map corresponding to the sample image can be represented by the function value of the loss function. During the training of the weights, the magnitude of the loss function value can be backpropagated in the convolutional neural network, and each weight can be adjusted. Specifically, when adjusting the weights, the adjustment can be made in the direction that reduces the function value of the loss function until a global optimum is reached (the final adjustment result can be that the function value of the loss function is minimized or the function value of the loss function is less than a certain threshold). It should be understood that the weight corresponding to each saliency sub-feature is obtained by training the neural network model based on the difference between the saliency map of the sample image and the reference saliency map corresponding to the sample image.
[0062] Step S207: Identify the surface defects of the target product based on the at least one low-level feature, the at least one high-level feature, and the salient feature.
[0063] In one embodiment, the process of identifying surface defects of the target product based on at least one low-level feature, at least one high-level feature, and the saliency feature includes: identifying surface defects of the target product based on color information of the R channel, color information of the G channel, color information of the B channel, global contrast feature, background contrast feature, and saliency feature.
[0064] In one embodiment, after obtaining a saliency image of the target product based on the color information of the R channel, the color information of the G channel, the color information of the B channel, the global contrast feature, the background contrast feature, and the saliency feature, guided filtering can be applied to the saliency image to obtain a segmentation image. It should be understood that the segmentation image can also be a type of saliency distribution map. Guided filtering can further optimize the image segmentation edges in the saliency map, resulting in a better segmentation image, thereby enabling the identification of surface defects of the target product in the segmented image.
[0065] It should be understood that the product defect detection method proposed in this application embodiment can segment objects in images in various scenarios to identify surface defects of products.
[0066] In summary, the product defect detection method proposed in this application first segments an image to obtain multiple sub-images. Then, it extracts features from each sub-image to obtain three low-level features and two high-level features. The three low-level features include color information from the R channel, G channel, and B channel, while the two high-level features include global contrast features and background contrast features. Subsequently, the three low-level features and two high-level features are clustered to obtain multiple cluster maps. The saliency of each cluster map is calculated, and the multiple saliency maps are merged into a single saliency map using a neural network model. Thus, surface defects of the target product can be identified based on the obtained three low-level features, two high-level features, and saliency features. On the one hand, the acquired saliency features are related to low-level features and high-level features. Low-level features indicate the RGB color information of the image, while high-level features indicate the contrast information between the product and the background contained in the image. Furthermore, the contrast information reflects the saliency of the object and the background, which can effectively distinguish between similar and different areas. On the other hand, when identifying surface defects of target products through low-level features, high-level features, and saliency features, a better saliency map can be obtained by fully considering the characteristics between different features. In this way, the detection accuracy of product defects can be improved.
[0067] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that this disclosure is not limited to the described order of actions, as some steps may be performed in other orders or simultaneously according to this disclosure. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are optional embodiments, and the actions and modules involved are not necessarily essential to this disclosure.
[0068] It should be further explained that, although Figure 2 The steps in the flowchart are shown sequentially as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order in which these steps are executed, and they can be performed in other orders. Figure 2 At least some of the steps in the process may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least some of the sub-steps or stages of other steps.
[0069] The above text combined Figures 1-2 The product defect detection method of this application embodiment has been described in detail below, in conjunction with Figure 3 The product defect detection device described in this application embodiment should be understood as follows: Figure 3 The device in the document is capable of performing the corresponding steps of the product defect detection method described above.
[0070] Figure 3 This is a schematic diagram of the structure of a product defect detection device 30 provided in an embodiment of this application, which may include:
[0071] Image acquisition module 301 is used to acquire images of the target product;
[0072] The segmentation module 302 is used to segment the image of the target product to obtain multiple sub-images;
[0073] The feature extraction module 303 is used to extract features from each sub-image to obtain at least one low-level feature and at least one high-level feature, wherein the at least one low-level feature indicates the RGB color information of the sub-image; and the at least one high-level feature indicates the contrast information between the product and the background contained in the sub-image.
[0074] Clustering module 304 is used to cluster the at least one low-level feature and the at least one high-level feature to obtain multiple clustering graphs;
[0075] The significance calculation module 305 is used to perform significance calculation on each cluster graph to obtain the significance sub-features corresponding to each cluster graph.
[0076] The feature splicing module 306 is used to splice the salient sub-features corresponding to each clustering graph to obtain salient features;
[0077] The identification module 307 is used to identify surface defects of the target product based on the at least one low-level feature, the at least one high-level feature, and the salient feature.
[0078] In one possible implementation, the clustering module 304 is specifically used for:
[0079] Based on the weights corresponding to each salient sub-feature, the salient sub-features corresponding to each cluster graph are concatenated using a neural network model to obtain the salient features.
[0080] In one possible implementation, the weight corresponding to each saliency sub-feature is obtained by training the neural network model based on the difference between the saliency map of the sample image and the reference saliency map corresponding to the sample image.
[0081] In one possible implementation, the neural network model includes a hidden layer.
[0082] In one possible implementation, the number of low-level features is three, including color information from the R channel, the G channel, and the B channel; the number of high-level features is two, including global contrast features and background contrast features; the recognition module 307 is specifically used for:
[0083] The surface defects of the target product are identified based on the color information of the R channel, the color information of the G channel, the color information of the B channel, the global contrast feature, the background contrast feature, and the saliency feature.
[0084] It should be noted that the various devices in the above system may also include other units. The specific implementation of each device and unit can be found in the relevant descriptions in the above method embodiments, and will not be repeated here.
[0085] To facilitate better implementation of the above-described solutions in the embodiments of this application, this application also provides an electronic device 40, which will be described in detail below with reference to the accompanying drawings:
[0086] like Figure 4 The illustrated schematic diagram of the electronic device provided in this application embodiment shows that the electronic device 400 may include a processor 401, a memory 404, and a communication module 405. The processor 401, memory 404, and communication module 405 can be interconnected via a bus 406. The memory 404 may be a high-speed random access memory (RAM) or a non-volatile memory, such as at least one disk storage device. Optionally, the memory 404 may also be at least one storage system located remotely from the aforementioned processor 401. The memory 404 is used to store application code and may include an operating system, a network communication module, a user interface module, and a data processing program. The communication module 405 is used for information interaction with external devices. The processor 401 is configured to call the program code and execute the following steps:
[0087] Obtain an image of the target product;
[0088] The image of the target product is segmented to obtain multiple sub-images;
[0089] Features are extracted from each sub-image to obtain at least one low-level feature and at least one high-level feature, wherein the at least one low-level feature indicates the RGB color information of the sub-image; and the at least one high-level feature indicates the contrast information between the product and the background contained in the sub-image.
[0090] Clustering is performed on the at least one low-level feature and the at least one high-level feature to obtain multiple clustering diagrams;
[0091] For each cluster graph, a significance calculation is performed to obtain the significance sub-features corresponding to each cluster graph;
[0092] The salient features are obtained by concatenating the salient sub-features corresponding to each cluster graph.
[0093] The surface defects of the target product are identified based on the at least one low-level feature, the at least one high-level feature, and the salient feature.
[0094] The processor 401 concatenates the salient sub-features corresponding to each cluster graph to obtain salient features, including:
[0095] Based on the weights corresponding to each salient sub-feature, the salient sub-features corresponding to each cluster graph are concatenated using a neural network model to obtain the salient features.
[0096] The weights corresponding to each saliency sub-feature are obtained by training the neural network model based on the difference between the saliency map of the sample image and the reference saliency map corresponding to the sample image.
[0097] The neural network model contains a hidden layer.
[0098] The processor 401 identifies surface defects of the target product based on at least one low-level feature, at least one high-level feature, and the saliency feature, including: (The low-level features include three low-level features, which in turn include color information from the R channel, G channel, and B channel; the high-level features include two high-level features, which in turn include global contrast features and background contrast features; the processor 401 identifies surface defects of the target product based on at least one low-level feature, at least one high-level feature, and the saliency feature, including:)
[0099] The surface defects of the target product are identified based on the color information of the R channel, the color information of the G channel, the color information of the B channel, the global contrast feature, the background contrast feature, and the saliency feature.
[0100] This application also provides a computer storage medium storing instructions that, when executed on a computer or processor, cause the computer or processor to perform one or more steps of the method described in any of the above embodiments. If the constituent modules of the above-described apparatus are implemented as software functional units and sold or used as independent products, they can be stored in the computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product, which is stored in a computer-readable storage medium.
[0101] The aforementioned computer-readable storage medium can be an internal storage unit of the device described in the foregoing embodiments, such as a hard disk or memory. The aforementioned computer-readable storage medium can also be an external storage device of the device, such as an external hard disk, a Smart Media Card (SMC), a Secure Digital (SD) card, a Flash Card, etc. Furthermore, the aforementioned computer-readable storage medium may include both internal storage units and external storage devices of the device. The aforementioned computer-readable storage medium is used to store the aforementioned computer program and other programs and data required by the device. The aforementioned computer-readable storage medium can also be used to temporarily store data that has been output or will be output.
[0102] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed, the program can include the processes of the embodiments of the methods described above. The aforementioned storage medium includes various media capable of storing program code, such as ROM, RAM, magnetic disks, or optical disks.
[0103] The steps in the method of this application embodiment can be adjusted, combined, or deleted according to actual needs.
[0104] The modules in the device of this application embodiment can be merged, divided, and deleted according to actual needs.
[0105] It is understood that those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed in the various embodiments of this application can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0106] Those skilled in the art will appreciate that the functionality described by the various illustrative logic blocks, modules, and algorithmic steps disclosed in connection with the various embodiments of this application can be implemented in hardware, software, firmware, or any combination thereof. If implemented in software, the functionality described by the various illustrative logic blocks, modules, and steps can be stored or transmitted as one or more instructions or codes on a computer-readable medium and executed by a hardware-based processing unit. The computer-readable medium may comprise a computer-readable storage medium, which corresponds to a tangible medium, such as a data storage medium, or a communication medium that includes any medium that facilitates the transfer of a computer program from one place to another (e.g., according to a communication protocol). In this way, the computer-readable medium may substantially correspond to (1) a non-transitory tangible computer-readable storage medium, or (2) a communication medium, such as a signal or carrier wave. The data storage medium may be any available medium that can be accessed by one or more computers or one or more processors to retrieve instructions, code, and / or data structures for implementing the techniques described in this application. The computer program product may comprise a computer-readable medium.
[0107] Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0108] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.
[0109] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0110] In addition, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.
[0111] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0112] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A product defect detection method, characterized in that, include: Obtain an image of the target product; The image of the target product is segmented to obtain multiple sub-images; Features are extracted from each sub-image to obtain at least one low-level feature and at least one high-level feature, wherein the at least one low-level feature indicates the RGB color information of the sub-image; and the at least one high-level feature indicates the contrast information between the product and the background contained in the sub-image. Clustering is performed on the at least one low-level feature and the at least one high-level feature to obtain multiple clustering diagrams; For each cluster graph, a significance calculation is performed to obtain the significance sub-features corresponding to each cluster graph; The salient features are obtained by concatenating the salient sub-features corresponding to each cluster graph. The surface defects of the target product are identified based on the at least one low-level feature, the at least one high-level feature, and the saliency feature. The low-level feature includes color information of the R channel, color information of the G channel, and color information of the B channel. The high-level feature includes global contrast feature and background contrast feature. The step of concatenating the salient sub-features corresponding to each cluster graph to obtain salient features includes: Based on the weights corresponding to each salient sub-feature, the salient sub-features corresponding to each cluster graph are concatenated using a neural network model to obtain the salient features.
2. The method according to claim 1, characterized in that, The weights corresponding to each saliency sub-feature are obtained by training the neural network model based on the difference between the saliency map of the sample image and the reference saliency map corresponding to the sample image.
3. The method according to claim 1, characterized in that, The neural network model contains a hidden layer.
4. The method according to any one of claims 1-3, characterized in that, The number of low-level features is 3, and the number of high-level features is 2; the identification of surface defects of the target product based on the at least one low-level feature, the at least one high-level feature, and the salience feature includes: The surface defects of the target product are identified based on the color information of the R channel, the color information of the G channel, the color information of the B channel, the global contrast feature, the background contrast feature, and the saliency feature.
5. A product defect detection device, characterized in that, include: The image acquisition module is used to acquire images of the target product; The segmentation module is used to segment the image of the target product to obtain multiple sub-images; A feature extraction module is used to extract features from each sub-image to obtain at least one low-level feature and at least one high-level feature, wherein the at least one low-level feature indicates the RGB color information of the sub-image; and the at least one high-level feature indicates the contrast information between the product and the background contained in the sub-image. A clustering module is used to cluster the at least one low-level feature and the at least one high-level feature to obtain multiple clustering graphs; The saliency calculation module is used to calculate the saliency of each cluster graph and obtain the saliency sub-features corresponding to each cluster graph. The feature splicing module is used to splice the salient sub-features corresponding to each cluster graph to obtain salient features; The identification module is used to identify surface defects of the target product based on at least one low-level feature, at least one high-level feature, and the saliency feature. The low-level feature includes color information of the R channel, color information of the G channel, and color information of the B channel. The high-level feature includes global contrast feature and background contrast feature. The clustering module is specifically used for: Based on the weights corresponding to each salient sub-feature, the salient sub-features corresponding to each cluster graph are concatenated using a neural network model to obtain the salient features.
6. The apparatus according to claim 5, characterized in that, The weights corresponding to each saliency sub-feature are obtained by training the neural network model based on the difference between the saliency map of the sample image and the reference saliency map corresponding to the sample image.
7. An electronic device, characterized in that, The device includes a processor and a memory interconnected thereto, wherein the memory is used to store a computer program, the computer program including program instructions, and the processor is configured to invoke the program instructions to perform the method as described in any one of claims 1-4.
8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, the computer program including program instructions that, when executed by a processor, cause the processor to perform the method as described in any one of claims 1-4.
Citation Information
Patent Citations
Chip surface scratch defect detection method and device and computer equipment
CN113781402A
Image saliency detection method and device
CN114078138A