CN116596903A - Defect identification method, device, electronic equipment and readable storage medium - Google Patents

Defect identification method, device, electronic equipment and readable storage medium Download PDF

Info

Publication number
CN116596903A
CN116596903A CN202310602477.6A CN202310602477A CN116596903A CN 116596903 A CN116596903 A CN 116596903A CN 202310602477 A CN202310602477 A CN 202310602477A CN 116596903 A CN116596903 A CN 116596903A
Authority
CN
China
Prior art keywords
target
image
workpiece
defect
source image
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202310602477.6A
Other languages
Chinese (zh)
Inventor
周启航
高泽源
潘扬敬
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Luxshare Automation Jiangsu Ltd
Original Assignee
Luxshare Automation Jiangsu Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Luxshare Automation Jiangsu Ltd filed Critical Luxshare Automation Jiangsu Ltd
Priority to CN202310602477.6A priority Critical patent/CN116596903A/en
Publication of CN116596903A publication Critical patent/CN116596903A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/0002Inspection of images, e.g. flaw detection
    • G06T7/0004Industrial image inspection
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20081Training; Learning
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/30Subject of image; Context of image processing
    • G06T2207/30108Industrial image inspection
    • G06T2207/30164Workpiece; Machine component
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02PCLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
    • Y02P90/00Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
    • Y02P90/30Computing systems specially adapted for manufacturing

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Quality & Reliability (AREA)
  • Image Analysis (AREA)

Abstract

The application relates to a defect identification method, a defect identification device, electronic equipment and a readable storage medium, wherein the defect identification method comprises the following steps: acquiring a target source image corresponding to a target workpiece; acquiring a preset template, and performing workpiece identification operation on a target source image according to the preset template to obtain a target workpiece image; obtaining transformation parameters corresponding to the identification operation, and carrying out transformation operation on the target workpiece image based on the transformation parameters to obtain a fixed visual angle image; the fixed view images are input to the segmentation model for a target operation, which is a model training operation, a model testing operation, or an application recognition operation. The target workpiece image can be accurately extracted from the target source image through the preset template, and is converted into the fixed visual angle image through the transformation parameters, so that defects can be identified based on the fixed visual angle when different images or different targets are operated, and the identification accuracy can be improved.

Description

Defect identification method, device, electronic equipment and readable storage medium
Technical Field
The present application relates to the field of image recognition, and in particular, to a defect recognition method, device, electronic apparatus, and readable storage medium.
Background
In the production scenes of electronic products and industrial products, different production process ring joints can cause different product appearance defects, and common defect types include scratches, crush injuries, dirt, foreign matters, sticky glue, glue overflow, defects and the like. If defects on the surfaces of the products cannot be detected in time, the appearance of the products is affected, and the quality and the performance of the products are affected. For products with complex structures and various materials, the difficulty of defect detection is increased, the existing defect recognition of the parts is usually carried out by inputting images of the parts into a trained relevant model, however, in practical application, because of different view angles of image acquisition of the parts, the characteristics of the acquired images are different, if the images acquired at different view angles are directly input into a defect recognition system, accurate defect recognition is often difficult to realize.
Disclosure of Invention
The application provides a defect identification method, a defect identification device, electronic equipment and a readable storage medium, and aims to solve the technical problem that the defect identification accuracy of parts is low in the prior art.
To solve the above technical problems or at least partially solve the above technical problems, the present application provides a defect identification method, the method including the steps of:
acquiring a target source image corresponding to a target workpiece;
acquiring a preset template, and performing workpiece identification operation on the target source image according to the preset template to obtain a target workpiece image, wherein the target workpiece image is a pixel set corresponding to the target workpiece in the target source image;
obtaining transformation parameters corresponding to the identification operation, and carrying out transformation operation on the target workpiece image based on the transformation parameters to obtain a fixed visual angle image;
the fixed view image is input to a segmentation model for a target operation, which is a model training operation, a model testing operation, or an application recognition operation.
Optionally, the step of performing workpiece identification operation on the target source image according to the preset template to obtain a target workpiece image includes:
cutting a preset area in the target source image to obtain a cut image;
and carrying out workpiece identification operation on the cutting image according to the preset template to obtain a target workpiece image.
Optionally, the step of performing workpiece identification operation on the target source image according to the preset template to obtain a target workpiece image includes:
quantizing the target source image based on the gray value of each pixel in the target source image to obtain a gray matrix;
acquiring a template matrix of the preset template, and performing feature matching positioning on the gray matrix based on the template matrix to determine a target pixel corresponding to the target workpiece in the target source image;
and dividing the target pixel to obtain the target workpiece image.
Optionally, the step of performing workpiece identification operation on the target source image according to the preset template to obtain a target workpiece image includes:
performing workpiece identification operation on the target source image according to the preset template to determine workpiece features corresponding to the target workpiece in the target source image;
and carrying out morphological operation on the workpiece features to obtain the target workpiece image and determine the transformation parameters.
Optionally, the step of inputting the fixed view image into a segmentation model for target operation includes:
performing defect enhancement operation on the fixed-view image to obtain an enhanced image;
the enhanced image is input to the segmentation model for a target operation.
Optionally, the target operation is a model training operation, and the step of inputting the fixed view image into a segmentation model for target operation includes:
inputting the fixed view image into the segmentation model, and acquiring first defect information output by the segmentation model based on the fixed view image;
determining a defect area in the target source image according to the first defect information;
and marking the defect area to generate a mark image of the defect.
Optionally, the target operation is a model test operation; the step of inputting the fixed view image to a segmentation model for a target operation includes:
inputting the fixed view image into the segmentation model, and acquiring second defect information output by the segmentation model based on the fixed view image;
acquiring associated defect information corresponding to the target source image;
comparing the associated defect information with the second defect information to judge whether the second defect information meets the precision requirement;
if the second defect information does not meet the precision requirement, adjusting the segmentation threshold value of the segmentation model, and returning to the execution step: and inputting the fixed visual angle image into a segmentation model until the second defect information meets the precision requirement.
In order to achieve the above object, the present application also provides a defect recognition apparatus including:
the first acquisition module is used for acquiring a target source image corresponding to the target workpiece;
the second acquisition module is used for acquiring a preset template, and carrying out workpiece identification operation on the target source image according to the preset template to obtain a target workpiece image, wherein the target workpiece image is a pixel set corresponding to the target workpiece in the target source image;
the third acquisition module is used for acquiring transformation parameters corresponding to the identification operation and carrying out transformation operation on the target workpiece image based on the transformation parameters to obtain a fixed visual angle image;
and the first input module is used for inputting the fixed visual angle image into a segmentation model to perform target operation, wherein the target operation is model training operation, model testing operation or application identification operation.
To achieve the above object, the present application also provides an electronic device including a memory, a processor, and a computer program stored on the memory and executable on the processor, which when executed by the processor, implements the steps of the defect identification method as described above.
To achieve the above object, the present application also provides a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements the steps of the defect identification method as described above.
The application provides a defect identification method, a defect identification device, electronic equipment and a readable storage medium, wherein a target source image corresponding to a target workpiece is obtained; acquiring a preset template, and performing workpiece identification operation on the target source image according to the preset template to obtain a target workpiece image, wherein the target workpiece image is a pixel set corresponding to the target workpiece in the target source image; obtaining transformation parameters corresponding to the identification operation, and carrying out transformation operation on the target workpiece image based on the transformation parameters to obtain a fixed visual angle image; the fixed view image is input to a segmentation model for a target operation, which is a model training operation, a model testing operation, or an application recognition operation. The target workpiece image can be accurately extracted from the target source image through the preset template, and is converted into the fixed visual angle image through the transformation parameters, so that defects can be identified based on the fixed visual angle when different images or different targets are operated, and the identification accuracy can be improved.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the application and together with the description, serve to explain the principles of the application.
In order to more clearly illustrate the embodiments of the application or the technical solutions of the prior art, the drawings which are used in the description of the embodiments or the prior art will be briefly described, and it will be obvious to a person skilled in the art that other drawings can be obtained from these drawings without inventive effort.
FIG. 1 is a flowchart of a defect identification method according to a first embodiment of the present application;
fig. 2 is a schematic block diagram of an electronic device according to the present application.
Detailed Description
It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the application. In order that those skilled in the art will better understand the present application, a technical solution in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in which it is apparent that the described embodiments are only some embodiments of the present application, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the present application without making any inventive effort, shall fall within the scope of the present application.
The application provides a defect identification method, referring to fig. 1, fig. 1 is a flow chart of a first embodiment of the defect identification method of the application, the method comprises the steps of:
step S10, acquiring a target source image corresponding to a target workpiece;
in this embodiment, the defect recognition method includes three stages, namely a model training stage, a model testing stage and an application recognition stage; training the initial segmentation model in a model training stage to obtain a trained segmentation model; the model test stage tests a stack of trained segmentation models for optimization; and in the application recognition stage, the actual defect recognition application is carried out through the trained segmentation model.
The target source image is an original image containing a target workpiece;
in the model training stage, the target source image is a training sample image; in the model test stage, the target source image is a test sample image; it will be appreciated that the training sample image and the test sample image may be obtained from historically accumulated sample data, or from other sources such as the internet.
In the application identification stage, the target workpiece is a workpiece needing defect detection, and the target source image is an original image obtained by performing image acquisition on the target workpiece; the acquisition of the target source image can be set based on the actual application requirements, such as a camera.
Step S20, a preset template is obtained, workpiece identification operation is carried out on the target source image according to the preset template, and a target workpiece image is obtained, wherein the target workpiece image is a pixel set corresponding to the target workpiece in the target source image;
the preset module is used for indicating the characteristics of the target workpiece; it will be appreciated that the basic features are the same for the same type of workpiece, and therefore, the target workpiece image can be obtained by extracting the pixels contained in the target workpiece from the target source image based on the preset module.
Step S30, obtaining transformation parameters corresponding to the identification operation, and carrying out transformation operation on the target workpiece image based on the transformation parameters to obtain a fixed visual angle image;
it can be understood that in practical application, the relative viewing angles of the workpieces in the target source images are different due to the difference of the acquired scenes and the placement positions of the target workpieces; the workpiece features in the preset templates are fixed, so that the transformation parameters obtained by comparing the preset templates with the target workpiece images can reflect the visual angle difference between the target workpiece images and the preset templates, and further the visual angle of the target workpiece images can be adjusted to be consistent with the preset templates based on the transformation parameters, thereby realizing the unification of the fixed visual angle images for training/testing/application identification at visual angle levels and improving the identification accuracy.
Step S40, inputting the fixed view image into a segmentation model to perform a target operation, wherein the target operation is a model training operation, a model testing operation or an application identification operation.
The target operation corresponding to different stages is different;
in the model training stage, the target operation is model training operation, specifically, a fixed view angle image is input into an initial segmentation model, the initial segmentation model outputs a recognition result corresponding to the fixed view angle image, and the recognition result and defect information associated with a target source image are compared to realize training of the initial segmentation model so as to obtain a segmentation model after training is completed; the specific training method, training completion conditions, and the like may be set based on actual application requirements, and are not limited herein.
In the model test stage, the target operation is a model test operation, specifically, a fixed visual angle image is input into a trained segmentation model, the trained segmentation model outputs a recognition result corresponding to the fixed visual angle image, and the trained segmentation model is optimized based on the recognition result.
In the application recognition stage, the target operation is an application recognition operation, specifically, a fixed-view image is input into a trained segmentation model, and the trained segmentation model outputs a recognition result corresponding to the fixed-view image.
According to the method and the device, the target workpiece image can be accurately extracted from the target source image through the preset template, and the target workpiece image is converted into the fixed view angle image through the transformation parameters, so that defects can be identified based on the fixed view angle when different images or different targets are operated, and the identification accuracy can be improved.
Further, in a second embodiment of the defect identifying method according to the present application, which is set forth based on the first embodiment of the present application, the step S20 includes the steps of:
s21, cutting a preset area in the target source image to obtain a cut image;
and S22, carrying out workpiece identification operation on the cut image according to the preset template to obtain a target workpiece image.
The preset area is a preset area for indicating the size of the fixed image; it can be understood that, based on different sources of the target source images, the sizes of the target source images are different, so that the sizes of the target source images are uniformly cut in order to further unify the consistency of the target source images in different stages, thereby improving the identification accuracy; it should be noted that, the image size in this embodiment refers to the length-width dimension of the image, and the unit of the image size includes, but is not limited to, the length and the number of pixels.
According to the method and the device, the sizes of the target source images entering the identification flow are unified, so that the accuracy of defect identification is further improved.
Further, in a third embodiment of the defect identifying method according to the present application, which is set forth based on the first embodiment of the present application, the step S20 includes the steps of:
step S23, quantizing the target source image based on the gray value of each pixel in the target source image to obtain a gray matrix;
step S24, a template matrix of the preset template is obtained, and feature matching positioning is carried out on the gray matrix based on the template matrix so as to determine a target pixel corresponding to the target workpiece in the target source image;
and S25, dividing the target pixel to obtain the target workpiece image.
The gray value is used for reflecting the black-white degree of the pixel; it will be appreciated that, in general, the pixels correspond to 256 gray scales of 0 to 255, and in practical application, the number of gray scales may be set to be smaller or larger in consideration of the calculation intensity and the accuracy, and the smaller the number of gray scales, the lower the calculation intensity and the lower the accuracy, the larger the number of gray scales, and the higher the calculation intensity and the accuracy. And after the pixels in the target source image are quantized through the gray values, a gray matrix corresponding to the target source image can be obtained based on the quantized gray values and pixel positions.
The template matrix is a matrix obtained by carrying out gray value quantization on a preset template.
It can be appreciated that the specific positioning algorithm can be selected based on the actual application scenario; in the feature matching positioning in this embodiment, feature extraction and comparison are performed on the gray matrix and the template matrix, and an optimal matching result is determined by matching the geometric shape, the center and the direction between corresponding feature points in the two matrices, so that feature points most relevant to the workpiece features set in the template matrix are obtained in the gray matrix, and pixel points corresponding to the target workpiece in the target source image are determined based on the feature points; in particular, in the matching, the image processing operation is performed on the gray matrix based on the features of the template matrix, including but not limited to rotation, scaling or stretching, it is understood that the shape, texture, color, and the like corresponding to the target workpiece are not affected by the image processing operation, so that the features that remain unchanged in the image processing process can be identified, thereby realizing the positioning of the features corresponding to the target workpiece, and the pixels corresponding to the features that remain unchanged are the target pixels. And extracting the target pixel from the target source image to obtain a target workpiece image.
The embodiment can accurately obtain the target workpiece image from the target source image.
Further, in a fourth embodiment of the defect identifying method according to the present application, which is set forth based on the first embodiment of the present application, the step S20 includes the steps of:
step S26, performing workpiece identification operation on the target source image according to the preset template to determine workpiece features corresponding to the target workpiece in the target source image;
and step S27, carrying out morphological operation on the workpiece features to obtain the target workpiece image and determining the transformation parameters.
The workpiece feature is a set of target pixels.
Morphological operations are image processing methods based on the principle of shape. It will be appreciated that the morphological operation is based on the shape and size of the structural elements, so that the extraction of image features can be achieved by morphological operation, for example, when a linear structure in a transverse or longitudinal direction is expanded, coordinate information of the structure in a X, Y direction can be determined, for example, when a structure is rotated, angle information of the structure can be determined, and features can be extracted by relevant information obtained by the operation.
It can be understood that the target workpiece is consistent with the workpiece features in the preset template, and the change of the shooting view angle of the target workpiece can cause the change of the relative position, the size, the angle and the like of the target workpiece in the image, so that after the difference between the target workpiece and the preset template is obtained by comparing the target workpiece with the preset template, the change condition of the shooting view angle causing the difference to appear can be reversely calculated based on the difference, and further, the transformation parameters for correcting can be determined according to the change condition.
The embodiment can accurately extract the target workpiece image and determine the transformation parameters.
Further, in a fifth embodiment of the defect identifying method according to the present application, which is set forth based on the first embodiment of the present application, the step S40 includes the steps of:
step S41, performing defect enhancement operation on the fixed view angle image to obtain an enhanced image;
step S42, inputting the enhanced image to the segmentation model for target operation.
It can be understood that the obvious degree of different defects in different color states is different, and the accuracy of defect identification can be improved if the obvious degree is high; in practical application, the color state in the fixed view image may not be the most obvious state of the defect, so in this embodiment, defect enhancement operation is performed on the fixed view image, so that the defect in the obtained enhanced image is more obvious, and thus improvement of defect identification accuracy is achieved.
The defect enhancement operation can process the gray scale, color, sharpness, contrast, etc. of the image; the specific defect enhancement operation can be set based on the actual application scene and the need; if corresponding target color states are set for different types of workpieces or defects, when the defect enhancement operation is carried out on the fixed visual angle image, the color states of the fixed visual angle image are adjusted to the target color states corresponding to the workpieces or defects; in some cases, the defects in the fixed view image are already apparent when the color state of the fixed view image is close to the target color state for use. A simple defect enhancement operation can be achieved by fine tuning the sharpness, contrast.
The embodiment can be used for highlighting the defects, so that the defects can be more accurately identified.
Further, in a sixth embodiment of the defect identifying method according to the present application, which is set forth based on the first embodiment of the present application, the target operation is a model training operation, and the step S40 includes the steps of:
step S43, inputting the fixed view angle image into the segmentation model, and acquiring first defect information output by the segmentation model based on the fixed view angle image;
step S44, determining a defect area in the target source image according to the first defect information;
and S45, marking the defect area to generate a mark image of the defect.
The defect area is used for indicating the defect position, and the user can find the defect more easily by marking the defect area.
Specifically, the segmentation model in this embodiment includes a positioning module and a segmentation module, where the positioning module is configured to extract a plurality of defect frames from a fixed view image, and associate corresponding identifiers for the defect frames based on whether defects exist in the defect frames, that is, associate defect identifiers for the defect frames with defects, and associate defect identifiers for the defect frames with no defects; the positioning module outputs the defect frame and the associated mark to the segmentation module to train the segmentation module, and the segmentation module binds the mark of the defect frame with the image output after the training is completed; after the first defect information is output, marking and generating a defect frame with defects to obtain a defect marking image; the first defect information is the recognition result output by the segmentation model in the model training stage. Specifically, the mark generation operation includes setting based on actual needs, such as framing a defect frame with a specific color.
The embodiment can make the defects in the image more striking, and is convenient for the user to find.
Further, in a seventh embodiment of the defect identifying method according to the present application set forth based on the first embodiment of the present application, the target operation is a model test operation; the step S40 includes the steps of:
step S46, inputting the fixed view angle image into the segmentation model, and acquiring second defect information output by the segmentation model based on the fixed view angle image;
step S47, obtaining associated defect information corresponding to the target source image;
step S48, comparing the associated defect information with the second defect information to judge whether the second defect information meets the precision requirement;
step S49, if the second defect information does not meet the accuracy requirement, adjusting the segmentation threshold of the segmentation model, and returning to the execution step: and inputting the fixed visual angle image into a segmentation model until the second defect information meets the precision requirement.
It can be understood that when the segmentation model performs defect recognition, a determination is made as to whether all pixels in the fixed view image are defective pixels, specifically, for each pixel, a probability of being a defective pixel is calculated, whether a probability corresponding to the pixel is greater than a segmentation threshold value is determined, if the pixel is greater than the segmentation threshold value, a defect identifier corresponding to the pixel is set to 1, which indicates that the pixel is a defective pixel, and if the pixel is less than the segmentation threshold value, a defect identifier corresponding to the pixel is set to 0, which indicates that the pixel is a non-defective pixel, which can be set based on practical application requirements.
The associated defect information is defect information which is known and determined by the target source image; the second defect information is an identification result output by the segmentation model in the model test stage; after the target source image outputs the second defect information corresponding to the fixed view image, comparing the second defect information with the associated defect information, and when the gap between the second defect information and the associated defect information is large, namely the second defect information does not meet the precision requirement, indicating that the segmentation threshold of the segmentation model needs to be adjusted, specifically, when the second defect information does not contain a complete defect, indicating that the segmentation threshold is lower, the segmentation threshold should be improved, and when the defect at the second defect information contains more other contents, indicating that the segmentation threshold is higher, and the segmentation threshold should be reduced. Specifically, the associated defect information and the second defect information may be compared by information such as area, position, overlapping proportion, and the like, and the associated defect information and the second defect information may be displayed, and the comparison may be implemented by a user, and the segmentation threshold may be adjusted by the user. When the gap between the second defect information and the associated defect information is smaller, namely the second defect information meets the precision requirement, the segmentation model test is passed, and the accurate defect segmentation can be realized by the current segmentation threshold.
The embodiment can accurately determine the segmentation threshold value of the segmentation model and improve the recognition accuracy.
It should be noted that, for simplicity of description, the foregoing method embodiments are all described as a series of acts, but it should be understood by those skilled in the art that the present application is not limited by the order of acts described, as some steps may be performed in other orders or concurrently in accordance with the present application. Further, those skilled in the art will also appreciate that the embodiments described in the specification are all preferred embodiments, and that the acts and modules referred to are not necessarily required for the present application.
From the description of the above embodiments, it will be clear to a person skilled in the art that the method according to the above embodiments may be implemented by means of software plus the necessary general hardware platform, but of course also by means of hardware, but in many cases the former is a preferred embodiment. Based on such understanding, the technical solution of the present application may be embodied essentially or in a part contributing to the prior art in the form of a software product stored in a storage medium (e.g. ROM/RAM, magnetic disk, optical disk) comprising instructions for causing a terminal device (which may be a mobile phone, a computer, a server, or a network device, etc.) to perform the method according to the embodiments of the present application.
The application also provides a defect recognition device for implementing the defect recognition method, which comprises the following steps:
the first acquisition module is used for acquiring a target source image corresponding to the target workpiece;
the second acquisition module is used for acquiring a preset template, and carrying out workpiece identification operation on the target source image according to the preset template to obtain a target workpiece image, wherein the target workpiece image is a pixel set corresponding to the target workpiece in the target source image;
the third acquisition module is used for acquiring transformation parameters corresponding to the identification operation and carrying out transformation operation on the target workpiece image based on the transformation parameters to obtain a fixed visual angle image;
and the first input module is used for inputting the fixed visual angle image into a segmentation model to perform target operation, wherein the target operation is model training operation, model testing operation or application identification operation.
The defect identification device can accurately extract the target workpiece image from the target source image through the preset template, and the target workpiece image is converted into the fixed visual angle image through the transformation parameters, so that defects can be identified based on the fixed visual angle when different images or different targets are operated, and the identification accuracy can be improved.
It should be noted that, the first acquiring module in this embodiment may be used to perform step S10 in the embodiment of the present application, the second acquiring module in this embodiment may be used to perform step S20 in the embodiment of the present application, the third acquiring module in this embodiment may be used to perform step S30 in the embodiment of the present application, and the first input module in this embodiment may be used to perform step S40 in the embodiment of the present application.
Further, the second acquisition module includes:
the first clipping unit is used for clipping a preset area in the target source image to obtain a clipping image;
and the first recognition unit is used for carrying out workpiece recognition operation on the cutting image according to the preset template to obtain a target workpiece image.
Further, the second acquisition module includes:
the first quantization unit is used for quantizing the target source image based on the gray value of each pixel in the target source image to obtain a gray matrix;
the first acquisition unit is used for acquiring a template matrix of the preset template, and performing feature matching positioning on the gray matrix based on the template matrix so as to determine a target pixel corresponding to the target workpiece in the target source image;
and the first segmentation unit is used for segmenting the target pixel to obtain the target workpiece image.
Further, the second acquisition module includes:
the first determining unit is used for performing workpiece identification operation on the target source image according to the preset template to determine workpiece features corresponding to the target workpiece in the target source image;
and the first operation unit is used for carrying out morphological operation on the workpiece characteristics to obtain the target workpiece image and determining the transformation parameters.
Further, the first input module includes:
the first execution unit is used for performing defect enhancement operation on the fixed-view image to obtain an enhanced image;
and the first input unit is used for inputting the enhanced image into the segmentation model to perform target operation.
Further, the target operation is a model training operation, and the first input module includes:
a second input unit configured to input the fixed view image to the segmentation model, and acquire first defect information output by the segmentation model based on the fixed view image;
a second determining unit configured to determine a defect area in the target source image according to the first defect information;
the first generation unit is used for marking the defect area to generate a mark defect marking image.
Further, the target operation is a model test operation; the first input module includes:
a third input unit configured to input the fixed view image to the segmentation model, and obtain second defect information output by the segmentation model based on the fixed view image;
the second acquisition unit is used for acquiring associated defect information corresponding to the target source image;
the first comparison unit is used for comparing the associated defect information with the second defect information to judge whether the second defect information meets the precision requirement or not;
the first adjusting unit is configured to adjust the segmentation threshold of the segmentation model if the second defect information does not meet the accuracy requirement, and return to the executing step: and inputting the fixed visual angle image into a segmentation model until the second defect information meets the precision requirement.
It should be noted that the above modules are the same as examples and application scenarios implemented by the corresponding steps, but are not limited to what is disclosed in the above embodiments. It should be noted that, the above modules may be implemented in software as a part of the apparatus, or may be implemented in hardware, where the hardware environment includes a network environment.
Referring to fig. 2, the electronic device may include components such as a communication module 10, a memory 20, and a processor 30 in a hardware configuration. In the electronic device, the processor 30 is connected to the memory 20 and the communication module 10, and the memory 20 stores a computer program, and the computer program is executed by the processor 30 at the same time, where the computer program implements the steps of the method embodiments described above when executed.
The communication module 10 is connectable to an external communication device via a network. The communication module 10 may receive a request sent by an external communication device, and may also send a request, an instruction, and information to the external communication device, where the external communication device may be other electronic devices, a server, or an internet of things device, such as a television, and so on.
The memory 20 is used for storing software programs and various data. The memory 20 may mainly include a storage program area and a storage data area, where the storage program area may store an operating system, an application program required for at least one function (such as acquiring a target source image corresponding to a target workpiece), and the like; the storage data area may include a database, may store data or information created according to the use of the system, and the like. In addition, the memory 20 may include high-speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid-state storage device.
The processor 30, which is a control center of the electronic device, connects various parts of the entire electronic device using various interfaces and lines, performs various functions of the electronic device and processes data by running or executing software programs and/or modules stored in the memory 20, and calling data stored in the memory 20, thereby performing overall monitoring of the electronic device. Processor 30 may include one or more processing units; alternatively, the processor 30 may integrate an application processor that primarily handles operating systems, user interfaces, applications, etc., with a modem processor that primarily handles wireless communications. It will be appreciated that the modem processor described above may not be integrated into the processor 30.
Although not shown in fig. 2, the electronic device may further include a circuit control module, where the circuit control module is used to connect to a power source to ensure normal operation of other components. It will be appreciated by those skilled in the art that the electronic device structure shown in fig. 2 is not limiting of the electronic device and may include more or fewer components than shown, or may combine certain components, or a different arrangement of components.
The present application also proposes a computer-readable storage medium on which a computer program is stored. The computer readable storage medium may be the Memory 20 in the electronic device of fig. 2, or may be at least one of ROM (Read-Only Memory)/RAM (Random Access Memory ), magnetic disk, or optical disk, and the computer readable storage medium includes several instructions for causing a terminal device (which may be a television, an automobile, a mobile phone, a computer, a server, a terminal, or a network device) having a processor to perform the method according to the embodiments of the present application.
In the present application, the terms "first", "second", "third", "fourth", "fifth" are used for descriptive purposes only and are not to be construed as indicating or implying relative importance, and the specific meaning of the above terms in the present application will be understood by those of ordinary skill in the art depending on the specific circumstances.
In the description of the present specification, a description referring to terms "one embodiment," "some embodiments," "examples," "specific examples," or "some examples," etc., means that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the present application. In this specification, schematic representations of the above terms are not necessarily directed to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples. Furthermore, the different embodiments or examples described in this specification and the features of the different embodiments or examples may be combined and combined by those skilled in the art without contradiction.
Although embodiments of the present application have been shown and described above, the scope of the present application is not limited thereto, and it should be understood that the above embodiments are exemplary and should not be construed as limiting the present application, and that variations, modifications and substitutions of the above embodiments may be made by those skilled in the art within the scope of the present application, and are intended to be included in the scope of the present application. Therefore, the protection scope of the application is subject to the protection scope of the claims.

Claims (10)

1. A defect identification method, characterized in that the defect identification method comprises:
acquiring a target source image corresponding to a target workpiece;
acquiring a preset template, and performing workpiece identification operation on the target source image according to the preset template to obtain a target workpiece image, wherein the target workpiece image is a pixel set corresponding to the target workpiece in the target source image;
obtaining transformation parameters corresponding to the identification operation, and carrying out transformation operation on the target workpiece image based on the transformation parameters to obtain a fixed visual angle image;
the fixed view image is input to a segmentation model for a target operation, which is a model training operation, a model testing operation, or an application recognition operation.
2. The defect identification method of claim 1, wherein the step of performing a workpiece identification operation on the target source image according to the preset template to obtain a target workpiece image comprises:
cutting a preset area in the target source image to obtain a cut image;
and carrying out workpiece identification operation on the cutting image according to the preset template to obtain a target workpiece image.
3. The defect identification method of claim 1, wherein the step of performing a workpiece identification operation on the target source image according to the preset template to obtain a target workpiece image comprises:
quantizing the target source image based on the gray value of each pixel in the target source image to obtain a gray matrix;
acquiring a template matrix of the preset template, and performing feature matching positioning on the gray matrix based on the template matrix to determine a target pixel corresponding to the target workpiece in the target source image;
and dividing the target pixel to obtain the target workpiece image.
4. The defect identification method of claim 1, wherein the step of performing a workpiece identification operation on the target source image according to the preset template to obtain a target workpiece image comprises:
performing workpiece identification operation on the target source image according to the preset template to determine workpiece features corresponding to the target workpiece in the target source image;
and carrying out morphological operation on the workpiece features to obtain the target workpiece image and determine the transformation parameters.
5. The defect recognition method of claim 1, wherein the step of inputting the fixed view image to a segmentation model for target operation comprises:
performing defect enhancement operation on the fixed-view image to obtain an enhanced image;
the enhanced image is input to the segmentation model for a target operation.
6. The defect identification method of claim 1, wherein the target operation is a model training operation, and the step of inputting the fixed view image into a segmentation model for target operation comprises:
inputting the fixed view image into the segmentation model, and acquiring first defect information output by the segmentation model based on the fixed view image;
determining a defect area in the target source image according to the first defect information;
and marking the defect area to generate a mark image of the defect.
7. The defect identification method of claim 1, wherein the target operation is a model test operation; the step of inputting the fixed view image to a segmentation model for a target operation includes:
inputting the fixed view image into the segmentation model, and acquiring second defect information output by the segmentation model based on the fixed view image;
acquiring associated defect information corresponding to the target source image;
comparing the associated defect information with the second defect information to judge whether the second defect information meets the precision requirement;
if the second defect information does not meet the precision requirement, adjusting the segmentation threshold value of the segmentation model, and returning to the execution step: and inputting the fixed visual angle image into a segmentation model until the second defect information meets the precision requirement.
8. A defect recognition apparatus, characterized in that the defect recognition apparatus comprises:
the first acquisition module is used for acquiring a target source image corresponding to the target workpiece;
the second acquisition module is used for acquiring a preset template, and carrying out workpiece identification operation on the target source image according to the preset template to obtain a target workpiece image, wherein the target workpiece image is a pixel set corresponding to the target workpiece in the target source image;
the third acquisition module is used for acquiring transformation parameters corresponding to the identification operation and carrying out transformation operation on the target workpiece image based on the transformation parameters to obtain a fixed visual angle image;
and the first input module is used for inputting the fixed visual angle image into a segmentation model to perform target operation, wherein the target operation is model training operation, model testing operation or application identification operation.
9. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, which when executed by the processor implements the steps of the defect identification method according to any of claims 1 to 7.
10. A computer readable storage medium, characterized in that the computer readable storage medium has stored thereon a computer program which, when executed by a processor, implements the steps of the defect identification method according to any of claims 1 to 7.
CN202310602477.6A 2023-05-25 2023-05-25 Defect identification method, device, electronic equipment and readable storage medium Pending CN116596903A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310602477.6A CN116596903A (en) 2023-05-25 2023-05-25 Defect identification method, device, electronic equipment and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310602477.6A CN116596903A (en) 2023-05-25 2023-05-25 Defect identification method, device, electronic equipment and readable storage medium

Publications (1)

Publication Number Publication Date
CN116596903A true CN116596903A (en) 2023-08-15

Family

ID=87595311

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310602477.6A Pending CN116596903A (en) 2023-05-25 2023-05-25 Defect identification method, device, electronic equipment and readable storage medium

Country Status (1)

Country Link
CN (1) CN116596903A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116863175A (en) * 2023-08-31 2023-10-10 中江立江电子有限公司 Right-angle connector defect identification method, device, equipment and medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116863175A (en) * 2023-08-31 2023-10-10 中江立江电子有限公司 Right-angle connector defect identification method, device, equipment and medium
CN116863175B (en) * 2023-08-31 2023-12-26 中江立江电子有限公司 Right-angle connector defect identification method, device, equipment and medium

Similar Documents

Publication Publication Date Title
WO2021051885A1 (en) Target labeling method and apparatus
CN111507958B (en) Target detection method, training method of detection model and electronic equipment
CN111640091A (en) Method for detecting product defects and computer storage medium
CN109543665B (en) Image positioning method and device
CN110569341A (en) method and device for configuring chat robot, computer equipment and storage medium
CN112348835B (en) Material quantity detection method and device, electronic equipment and storage medium
CN109389659B (en) Rendering method and device of mathematical formula in PPT, storage medium and terminal equipment
CN112712513A (en) Product defect detection method, device, equipment and computer readable storage medium
CN111814905A (en) Target detection method, target detection device, computer equipment and storage medium
CN111340796A (en) Defect detection method and device, electronic equipment and storage medium
CN111461101A (en) Method, device and equipment for identifying work clothes mark and storage medium
CN114782286A (en) Defect repairing method, optical repairing device, electronic device and storage medium
CN112381092B (en) Tracking method, tracking device and computer readable storage medium
CN114677567B (en) Model training method and device, storage medium and electronic equipment
CN116596903A (en) Defect identification method, device, electronic equipment and readable storage medium
CN113657370B (en) Character recognition method and related equipment thereof
CN110991357A (en) Answer matching method and device and electronic equipment
CN111539975B (en) Method, device, equipment and storage medium for detecting moving object
CN110660000A (en) Data prediction method, device, equipment and computer readable storage medium
CN112581001B (en) Evaluation method and device of equipment, electronic equipment and readable storage medium
CN115147422A (en) Method, device and equipment for generating crystal grains at center of wafer and storage medium
CN112084874B (en) Object detection method and device and terminal equipment
CN114240837A (en) Welding seam positioning method, device, equipment and storage medium
CN111612766B (en) Image quality evaluation method and device and electronic equipment
CN113870210A (en) Image quality evaluation method, device, equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination