Defect contour generation method of machine vision deep learning surface defect sample, electronic equipment and storage medium
By strictly matching the defect profile and material data of surface defect samples in machine vision deep learning, the problem of limited improvement in model training accuracy in the prior art is solved, and higher model training authenticity and general applicability are achieved.
Patent Information
- Application Number
- CN202510510408.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-23
- Publication Date
- 2025-05-27
- Estimated Expiration
- 2045-04-23
AI Technical Summary
The existing machine vision deep learning sample automatic generation method has relatively limited improvement in model training accuracy, mainly because the closed shape is drawn relatively randomly and there is no strict constraint, resulting in the closed shape not matching the filled material data.
By determining the background source diagram and defect source diagram of the surface defect sample, refer to the defect outline of the target defect, draw or select the same or similar defect outline as the defect outline of the target background, and select the corresponding defect outline in the built contour type library to ensure that the defect material data matches the defect outline.
By strictly matching defect profiles and material data, the authenticity and accuracy of model training are improved, and the number of surface defect samples is expanded, which enhances the universality of the model.
Smart Images

Figure CN120047438A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of machine vision deep learning, and particularly to a method for generating defect contours of surface defect samples in machine vision deep learning, an electronic device, and a storage medium. Background Art
[0002] Deep learning, as the main research direction in the field of artificial intelligence in recent years, has developed rapidly, demonstrated great application value, and has continuously received close attention from the industrial and academic communities. Especially in the field of machine vision detection. Currently, in the field of machine vision detection, the premise of using deep learning is that a large number of sample images are required for model training. That is, in order to train a relatively accurate model, the order of magnitude of the sample images is at least required to be in the tens of thousands, or even hundreds of thousands or millions. At this time, the source of the sample images is undoubtedly the biggest obstacle when applying deep learning, and in the process of actual project applications, there are often only a very small number of sample images, which need to be continuously collected for a long time.
[0003] Chinese Patent Application CN114419399A, "Method for Automatically Generating Machine Vision Deep Learning Samples, Computer, and Storage Medium", can generate the number of samples required for model training in machine vision deep learning through a small number of sample images, thereby improving the accuracy of model training. After verification, the degree of improvement is relatively limited and cannot break through the bottleneck. Summary of the Invention
[0004] The applicant found that the reason why Chinese Patent Application CN114419399A cannot effectively improve the accuracy of model training is that: in order to pursue a larger number of samples, the drawing of the closed shape in step S5 is relatively arbitrary and not strictly restricted, resulting in a possible mismatch between the drawn closed shape and the filled material data, thereby affecting the improvement of the accuracy of model training.
[0005] The present invention aims to solve the problem that the existing method for automatically generating machine vision deep learning samples has a relatively limited degree of improvement in model training, and provides a method for generating defect contours of surface defect samples in machine vision deep learning, an electronic device, and a storage medium.
[0006] To achieve the above object, the technical solution of the present invention is as follows: A method for generating a defect contour of a machine vision deep learning surface defect sample, including: Step S1, determining a background source map and a defect source map used for the surface defect sample. Among them, the background source map has a target background, and the defect source map has a target defect. Step S2, determining the defect contour used for the target background. Among them, Step S2 includes: Sub-step S21, referring to the defect contour of the target defect, drawing a defect contour that is the same as or similar to the defect contour of the target defect as the defect contour used for the target background. The beneficial effect is that: Since the defect contour used for the target background is the same as or similar to the defect contour of the target defect, filling the defect material data into the defect contour used for the target background, the obtained surface defect sample can ensure the authenticity (accuracy) of model training.
[0007] As a preferred solution of the method for generating a defect contour of a machine vision deep learning surface defect sample, Step S2 includes: Sub-step S22, referring to the defect contour of the target defect, selecting a defect contour that is the same as or similar to the defect contour of the target defect from the established contour type library as the defect contour used for the target background. The beneficial effect is that: More defect contours used for the target background can be obtained, and on the premise of ensuring the authenticity of model training, the number of surface defect samples is further expanded.
[0008] As a preferred solution of the method for generating a defect contour of a machine vision deep learning surface defect sample, Step S2 includes: Sub-step S23, according to the formation reason of the target defect, determining the contour style generated based on the formation reason of the target defect, and then selecting a defect contour that is the same as or similar to the contour style from the established contour type library as the defect contour used for the target background. The beneficial effect is that: More defect contours used for the target background can be obtained, and on the premise of ensuring the authenticity of model training, the number of surface defect samples is further expanded.
[0009] As a preferred solution of the method for generating a defect contour of a machine vision deep learning surface defect sample, it further includes: Step S3, performing enhancement processing on the defect contour used for the target background. Step S3 includes: Sub-step S31, performing morphological adjustment on the defect contour. Among them, the morphological adjustment includes: overall distortion of the defect contour. Among them, the morphological adjustment includes: line perturbation of the defect contour. The beneficial effect is that: On the premise of ensuring the authenticity of model training, the generality of model training is taken into account, and the problem of insufficient generalization ability is compensated for.
[0010] As an optimal solution of the defect contour generation method for machine vision deep learning surface defect samples, step S3 includes: sub-step S32, performing shape fusion on the defect contour and / or the defect contour after morphological adjustment. The beneficial effect is that, on the premise of ensuring the authenticity of model training, the generality of model training is taken into account, and the problem of insufficient generalization ability is compensated for.
[0011] Another technical solution of the present invention is as follows: An electronic device includes a processor and a memory. At least one instruction is stored in the memory. The instruction is loaded and executed by the processor to implement the operations performed by the defect contour generation method for machine vision deep learning surface defect samples.
[0012] Another technical solution of the present invention is as follows: A storage medium stores at least one instruction. The instruction is loaded and executed by a processor to implement the operations performed by the defect contour generation method for machine vision deep learning surface defect samples.
[0013] In addition to the technical problems solved by the present invention, the technical features constituting the technical solutions, and the beneficial effects brought by these technical features described above, other technical problems that the present invention can solve, other technical features included in the technical solutions, and the beneficial effects brought by these technical features will be further described in detail with reference to the accompanying drawings. Description of the Drawings
[0014] Figure 1 is a flowchart of the method of the embodiment of the defect contour generation method of the present invention.
[0015] Figure 2 is a flowchart of step S2 of the embodiment of the defect contour generation method of the present invention.
[0016] Figure 3 is a flowchart of step S3 of the embodiment of the defect contour generation method of the present invention.
[0017] Figure 4 is a schematic diagram of the contour type library of the embodiment of the defect contour generation method of the present invention.
[0018] Figure 5 is a schematic diagram of the enhanced effect of step S3 of the embodiment of the defect contour generation method of the present invention.
[0019] Figure 6 is a schematic diagram of the structure of the electronic device of the embodiment of the defect contour generation method of the present invention. Detailed Embodiment
[0020] The present invention will be further described in detail below through specific embodiments in conjunction with the accompanying drawings. It should be noted here that the description of these embodiments is used to help understand the present invention, but does not constitute a limitation on the present invention. In addition, the technical features involved in the various embodiments of the present invention described below can be combined with each other as long as they do not conflict with each other.
[0021] See Figure 1 , an embodiment of the present application provides a method for generating a defect contour of a machine vision deep learning surface defect sample. Among them, the surface defect sample includes, but is not limited to: a film material surface defect sample, a sheet material surface defect sample, and a sheet material surface defect sample. The method for generating a defect contour of the machine vision deep learning surface defect sample includes: Step S1, determining the background source map and the defect source map used for the surface defect sample. Among them, the background source map has a target background. Among them, the defect source map has a target defect.
[0022] Step S2, determining the defect contour used for the target background: See Figure 2 , sub-step S21, referring to the defect contour of the target defect, drawing a defect contour that is the same as or similar to the defect contour of the target defect as the defect contour used for the target background. Sub-step S22, referring to the defect contour of the target defect, selecting a defect contour that is the same as or similar to the defect contour of the target defect from the established contour type library as the defect contour used for the target background. Sub-step S23, according to the formation reason of the target defect, determining the contour style generated based on the formation reason of the target defect, and then selecting a defect contour that is the same as or similar to the contour style from the established contour type library as the defect contour used for the target background. For example, if the formation reason of the target defect is a hard object scratch and the determined contour style is a thin line, then a defect contour related to the thin line can be selected from the established contour type library as the defect contour used for the target background.
[0023] It should be noted that the more classifications the contour type library has, the more convenient and accurate it is to select the defect contour.
[0024] In specific implementation, in sub-step S21, the defect contour that is the same as or similar to the defect contour of the target defect is drawn manually by the user or with computer assistance.
[0025] In specific implementation, in sub-step S22 or sub-step S23, the classifications of the contour type library include, but are not limited to: circular, near-circular, elliptical, near-elliptical (see Figure 4 the first line in); circular irregular, near-circular irregular (see Figure 4in the second line); convex polygons, near-convex polygons (see Figure 4 in the third line); irregular convex polygons, irregular near-convex polygons (see Figure 4 in the fourth line); rectangles, near-rectangles (see Figure 4 in the fifth line); slender shapes, near-slender shapes (see Figure 4 in the sixth line); radial shapes, near-radial shapes (see Figure 4 in the seventh line); irregular cloud shapes, irregular near-cloud shapes (see Figure 4 in the eighth line).
[0026] It should be noted that in other embodiments, step S2 may only include any one or any combination of two of sub-step S21, sub-step S22, and sub-step S23.
[0027] Preferably, the method for generating the defect contour of the machine vision deep learning surface defect sample may further include: Step S3, perform enhancement processing on the defect contour used for the target background: see Figure 3 , sub-step S31, perform morphological adjustment on the defect contour. Sub-step S32, perform shape fusion on the defect contour and / or the defect contour after morphological adjustment.
[0028] Specifically, the morphological adjustment includes: globally distorting the defect contour. Among them, the setting parameters of the global distortion can be adjusted within a specified range, and the purpose is to obtain more of the defect contours. See Figure 5 , before global distortion, the effect is shown in contour 51; after global distortion, the effects are shown in contour 52 and contour 53.
[0029] Specifically, the morphological adjustment includes: performing line perturbation on the defect contour. Among them, the setting parameters of the line perturbation can be adjusted within a specified range, and the purpose is to obtain more of the defect contours. See Figure 5 , before line perturbation, the effect is shown in contour 51; after line perturbation, the effects are shown in contour 54 and contour 55.
[0030] Specifically, the shape fusion includes: arbitrarily selecting two from the set of the defect contour and the defect contour after morphological adjustment and performing shape fusion on them. Among them, the setting parameters of the shape fusion can be adjusted within a specified range, and the purpose is to obtain more of the defect contours. See Figure 5 , before shape fusion, the effects are shown in contour 53 and contour 55; after shape fusion, the effects are shown in contour 56 and contour 57. It should be noted that the higher the proportion of the number of contours after shape fusion in the total number of contours, the higher the diversity of the surface defect samples.
[0031] It should be noted that in other embodiments, step S3 may only execute sub-step S31 or only execute sub-step S32.
[0032] Filling the defective material data into the defect contour used for the target background and / or the defect contour used for the enhanced target background, the obtained surface defect sample can ensure both the authenticity of model training and the generality of model training, effectively improving the accuracy of model training.
[0033] See Figure 6 , an embodiment of the present application further provides an electronic device. The electronic device includes: a processor 61 and a memory 62. The processor 61 is connected to the memory 62. The processor 61 is configured to execute the computer program stored in the memory 62, so that the electronic device executes the method for generating a defect contour of a surface defect sample for machine vision deep learning.
[0034] Specifically, the processor may be a general-purpose processor, including a central processing unit (CPU for short), a network processor (NP for short), etc.; it may also be a digital signal processor (DSP for short), an application-specific integrated circuit (ASIC for short), a field programmable gate array (FPGA for short), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
[0035] Specifically, the memory includes: various media such as ROM, RAM, magnetic disk, USB flash drive, memory card, or optical disc that can store program codes.
[0036] Optionally, the electronic device further includes: a display. The display is communicatively connected to the memory and the processor respectively. The display is used to display the relevant graphical user interface (GUI for short) of the method for generating a defect contour of a surface defect sample for machine vision deep learning.
[0037] An embodiment of the present application further provides a storage medium. The storage medium stores a computer program. When the computer program is executed by a processor, the method for generating a defect contour of a surface defect sample for machine vision deep learning is implemented.
[0038] The above only expresses the embodiments of the present invention, and the description is relatively specific and detailed. However, it should not be construed as a limitation on the scope of the invention patent. It should be noted that for those of ordinary skill in the art, without departing from the concept of the present invention, several modifications and improvements can still be made, and these all fall within the protection scope of the present invention. Therefore, the protection scope of the present invention patent shall be subject to the appended claims.
Claims
1. A method for generating defect contours of surface defect samples by deep learning of machine vision, characterized in that: include: Step S1, determining a background source map and a defect source map used by the surface defect sample, wherein the background source map has a target background, and the defect source map has a target defect; Step S2, determining the defect contour used by the target background, wherein step S2 includes: sub-step S21, referring to the defect contour of the target defect, drawing a defect contour that is the same as or similar to the defect contour of the target defect as the defect contour used by the target background.
2. The defect contour generation method of surface defect samples by machine vision deep learning according to claim 1 is characterized in that: Step S2 includes: sub-step S22, referring to the defect contour of the target defect, selecting a defect contour that is the same as or similar to the defect contour of the target defect in the established contour type library as the defect contour used by the target background.
3. The defect contour generation method of surface defect samples by machine vision deep learning according to claim 1, characterized in that: Step S2 includes: sub-step S23, determining the contour style generated based on the cause of the target defect according to the cause of the target defect, and then selecting a defect contour that is the same or similar to the contour style from the established contour type library as the defect contour used by the target background.
4. The defect contour generation method of surface defect samples by machine vision deep learning according to any one of claims 1 to 3, characterized in that: The method further comprises: step S3, enhancing the defect contour used by the target background.
5. The defect contour generation method of surface defect samples by machine vision deep learning according to claim 4 is characterized in that: Step S3 includes: sub-step S31, adjusting the shape of the defect contour.
6. The defect contour generation method of surface defect samples by machine vision deep learning according to claim 5 is characterized in that: The morphological adjustment includes: overall distorting the defect contour.
7. The defect contour generation method of surface defect samples by machine vision deep learning according to claim 5, characterized in that: The morphology adjustment includes: performing line disturbance on the defect contour.
8. The defect contour generation method of surface defect samples by machine vision deep learning according to claim 4 is characterized in that: Step S3 includes: sub-step S32, performing shape fusion on the defect contour and / or the defect contour after morphology adjustment.
9. An electronic device, comprising a processor and a memory, wherein the memory stores at least one instruction, characterized in that: The instructions are loaded and executed by the processor to implement the operations performed by the method for generating defect contours of surface defect samples through deep learning of machine vision as described in any one of claims 1 to 8.
10. A storage medium, wherein at least one instruction is stored in the storage medium, characterized in that: The instructions are loaded and executed by the processor to implement the operations performed by the method for generating defect contours of surface defect samples through deep learning of machine vision as described in any one of claims 1 to 8.
Citation Information
Patent Citations
Machine vision deep learning sample automatic generation method, computer and storage medium
CN114419399A
Panel defect classification model generation method and panel defect classification method
CN113935940A
Surface scratch defect image generation method
CN114266768A
Screen defect detection method and device and readable storage medium
CN117351011A
Image collection device based on defect identification technology and operation method thereof
CN117420135A
Cited By
Material surface defect sample generation method based on machine vision deep learning, computer and storage medium
CN122116052A