Defect grading method and device, electronic equipment and storage medium

By combining regression and classification structures in the defect grading model, the problem of low precision in defect grading was solved, and the accuracy of fine-grained defect grading was improved, meeting the needs of diverse workpieces.

CN117197051BActive Publication Date: 2026-04-10苏州凌云光工业智能技术有限公司
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-08-18
Publication Date
2026-04-10

AI Technical Summary

Technical Problem

Existing technologies have low levels of precision in defect classification, making it difficult to achieve fine-grained classification and lacking sufficient accuracy, thus failing to meet the diverse needs of workpieces.

Method used

By combining regression and classification structures in a defect grading model, fine-grained classification of defect images to be graded is achieved through learning from a defect grading dataset with coarse classification labels.

Benefits of technology

It improves the precision and accuracy of defect classification, meeting users' needs for diverse workpieces.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117197051B_ABST
    Figure CN117197051B_ABST
Patent Text Reader

Abstract

The application discloses a kind of defect grading method, device, equipment and storage medium.The method comprises: obtaining defect image to be graded;The defect image to be graded is input to the grading model pre-trained;According to the output result of grading model, the defect level of defect image to be graded is determined;Wherein, the grading model is obtained by training the grading network pre-constructed based on defect grading dataset;The grading network includes feature extraction structure, regression structure and classification structure;Defect grading dataset includes at least one group of defect grading data, and each group of defect grading data includes defect image sample and defect image sample matched reference level;The number of reference level is less than the number of defect level.This technical solution solves the problem of low defect grading refinement degree, can realize fine-grained defect grading while effectively improving the accuracy of defect grading to meet the diversified workpiece needs of users.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of defect detection, in particular to a defect grading method and device, electronic equipment and storage medium. BACKGROUND

[0002] The workpiece defect detection usually adopts an AOI (Automatic Optic Inspection) device to detect defects and output defect images. After defect detection, the defects need to be graded. The defect grading can determine the defect level according to the severity of the defect, and the evaluation indexes of the severity include but are not limited to the length, width, area, depth and color of the defect and the like. According to the defect classification result, the workpiece can be allocated to different users with different requirements.

[0003] At present, the defect grading scheme mainly includes a graphics algorithm classification and a deep learning algorithm classification. The graphics algorithm classification adopts the features such as defect area, defect region gray difference, defect length and width and defect number to grade the defects. Therefore, in the graphics algorithm classification process, the defect feature dimension is limited, and it is difficult to realize accurate classification of the defects. Although the deep learning algorithm classification improves the defect grading accuracy to a certain extent, it needs to label the defect images, and trains the grading model by using the defect images with labels. Therefore, the deep learning algorithm classification is limited by the artificial recognition ability, and it is difficult to break through the limitation of artificial classification and realize fine-grained classification of the defects. SUMMARY

[0004] The present application provides a defect grading method, device, equipment and storage medium to solve the problem of low defect grading refinement, which can realize fine-grained defect grading and effectively improve the accuracy of defect grading to meet the diversified workpiece requirements of users.

[0005] According to an aspect of the present application, a defect grading method is provided, which comprises:

[0006] obtaining a defect image to be graded, and inputting the defect image to be graded into a pre-trained grading model;

[0007] determining the defect level of the defect image to be graded according to the output result of the grading model;

[0008] The grading model is obtained by training a pre-constructed grading network based on a defect grading data set. The grading network comprises a feature extraction structure, a regression structure and a classification structure. The defect grading data set comprises at least one group of defect grading data, each group of defect grading data comprises a defect image sample and a reference level matched with the defect image sample, and the number of reference levels is less than the number of defect levels.

[0009] According to another aspect of the present application, there is provided a defect grading device, the device comprising:

[0010] a defect image to be graded acquisition module configured to acquire a defect image to be graded and input the defect image to be graded into a pre-trained grading model;

[0011] a defect level determination module configured to determine a defect level of the defect image to be graded according to an output result of the grading model;

[0012] The grading model is obtained by training a pre-constructed grading network based on a defect grading dataset; the grading network comprises a feature extraction structure, a regression structure and a classification structure; the defect grading dataset comprises at least one group of defect grading data, each group of defect grading data comprises a defect image sample and a reference level matched with the defect image sample; the number of reference levels is less than the number of defect levels.

[0013] According to another aspect of the present application, there is provided an electronic device, the electronic device comprising:

[0014] at least one processor; and

[0015] a memory connected in communication with the at least one processor; wherein

[0016] The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor to enable the at least one processor to perform the defect grading method according to any one of the embodiments of the present application.

[0017] According to another aspect of the present application, there is provided a computer readable storage medium storing computer instructions for causing a processor to perform the defect grading method according to any one of the embodiments of the present application when executed by the processor.

[0018] The technical solution of the embodiments of the present application combines the regression structure and the classification structure, learns the defect grading dataset of the coarse classification label, and realizes the fine-grained classification of the defect image to be graded. The technical solution solves the problem of low fine-grained degree of defect grading, can realize fine-grained defect grading while effectively improving the accuracy of defect grading to meet the diversified workpiece needs of users.

[0019] It should be understood that the contents described in this part are not intended to identify the key or important features of the embodiments of the present application, nor are they used to limit the scope of the present application. Other features of the present application will become apparent from the following description. BRIEF DESCRIPTION OF DRAWINGS

[0020] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following will briefly introduce the drawings needed in the embodiments description. Obviously, the drawings in the following description only show some embodiments of the present application, and for those skilled in the art, other drawings can be obtained without creative effort based on these drawings.

[0021] Figure 1 is a flow chart of a defect grading method according to the first embodiment of the present application;

[0022] Figure 2 is a flow chart of a defect grading method according to the second embodiment of the present application;

[0023] Figure 3 is a structural schematic diagram of a defect grading device according to the third embodiment of the present application;

[0024] Figure 4 is a structural schematic diagram of an electronic device implementing the defect grading method of the present application. DETAILED DESCRIPTION

[0025] In order to make the person skilled in the art better understand the present application, the following will combine the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only some of the embodiments of the present application, not all. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative effort should be within the scope of the present application.

[0026] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and do not necessarily describe a specific order or sequence. It should be understood that the data thus used can be interchanged under appropriate circumstances, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion, for example, a process, method, system, product or device including a series of steps or units does not necessarily have to be limited to those steps or units clearly listed, but can include other steps or units not clearly listed or inherent to these processes, methods, products or devices. The acquisition, storage, use, processing, etc. of data in the technical solutions of the present application comply with the relevant provisions of national laws and regulations.

[0027] Embodiment one

[0028] Figure 1A flowchart of a defect grading method is provided for Embodiment One of the present application. The embodiment can be applied to the defect grading scenario of fine industrial devices, especially the defect grading situation that is difficult for the human eye to distinguish. The method can be executed by a defect grading device, which can be realized in the form of hardware and / or software, and can be configured in an electronic device. As shown in FIG. 1, Figure 1 The method comprises the following steps:

[0029] S110, obtaining a defect image to be graded, and inputting the defect image to be graded into a pre-trained grading model.

[0030] The present scheme can be executed by a defect detection device. The defect detection device can directly capture an image of the defect of the workpiece, and take the image as the defect image to be graded. In order to realize more accurate defect grading, the defect detection device can also perform target detection on the workpiece image, mark the defect area in the workpiece image, and cut the defect image according to the defect area in the workpiece image.

[0031] After obtaining the defect image to be graded, the defect detection device can input the defect image to be graded into the pre-trained grading model to perform defect grading. The grading model is obtained by training a pre-constructed grading network based on a defect grading dataset. The grading network comprises a feature extraction structure, a regression structure and a classification structure. The defect grading dataset comprises at least one group of defect grading data, each group of defect grading data comprising a defect image sample and a reference level matched with the defect image sample. The number of reference levels is less than the number of defect levels.

[0032] It should be noted that the reference level of the defect image sample can be obtained by manual recognition, or can be obtained by processing the defect image sample based on clustering, machine learning classification and other algorithms. In the present scheme, the reference level and the defect level can be categories obtained by dividing the defect degree. Since the human and the existing classification algorithm can distinguish limited defect levels, the reference level is a coarse classification of the defect image sample. The present scheme can realize fine-grained classification of defects on the coarse classification result, so the number of reference levels is less than the number of defect levels.

[0033] The hierarchical network can be constructed based on a convolutional neural network and can include a feature extraction structure, a regression structure, and a classification structure. It can be understood that the feature extraction structure can include a convolutional layer, a pooling layer, and the like. The feature extractor can extract defect features of the defect image samples and pass the defect features to the regression structure and the classification structure. The regression structure can determine a defect classification prediction result matched by the defect image samples according to the defect features. The classification structure can pattern the defect features and output a classification probability of a reference level matched by the defect image samples. According to the defect classification prediction result, the reference level of the defect image samples, and the classification probability of the reference level, a model loss can be calculated. During the iterative training process, the hierarchical network can be learned by feeding back the model loss to the feature extraction structure, so as to output a hierarchical model meeting the defect classification requirements.

[0034] S120, determining the defect level of the defect image to be classified according to the output result of the hierarchical model.

[0035] After obtaining the hierarchical model, the defect detection device can input the defect image to be classified into the hierarchical model, determine the defect level of the defect image to be classified according to the output result of the hierarchical model, and obtain a fine-grained classification result matched by the defect image to be classified.

[0036] The technical scheme of the embodiment of the present application combines the regression structure and the classification structure, learns the defect image samples of the coarse classification label, and realizes fine-grained classification of the defect image to be classified. The technical scheme solves the problem of low defect classification refinement degree, can realize fine-grained defect classification while effectively improving the accuracy of defect classification, and meets the diversified workpiece requirements of users.

[0037] Embodiment Two

[0038] Figure 2 A flowchart of a defect classification method provided by the second embodiment of the present application is shown in FIG. 2. The present embodiment refines the training process of the hierarchical model based on the above-mentioned embodiments. As shown in FIG. 2, the method includes the following steps. Figure 2

[0039] S210, inputting the defect image samples in the defect classification data set into the feature extraction structure to obtain defect features.

[0040] The defect detection device can input all or part of the defect image samples in the defect classification data set into the feature extraction structure for feature extraction to obtain the defect features.

[0041] S220, inputting the defect features into the regression structure to output a defect classification prediction result matched by the defect image samples, and inputting the defect features into the classification structure to output a classification probability of a reference level matched by the defect image samples.

[0042] ​In the scheme, the regression structure can include a convolutional layer, a regression layer, and the like hierarchical structure, and the classification structure can include a fully connected layer, a classification layer, and the like hierarchical structure. The regression structure can determine the defect classification prediction result matched by the defect image sample according to the defect feature. The classification structure can determine the classification probability of the reference level matched by the defect image sample according to the defect feature.

[0043] S230, according to the defect classification prediction result, the classification probability of the reference level, and the reference level matched by the defect image sample in the defect classification data set, at least one iteration training is performed on the classification network to obtain the training result of each iteration training.

[0044] The defect detection device can calculate the model loss according to the defect classification prediction result, the classification probability of the reference level, and the reference level matched by the defect image sample in the defect classification data set. Based on the model loss, the defect detection device can perform at least one iteration training on the classification network through feedback to obtain the training result of each iteration training. Each iteration training result can include the classification model obtained by the current iteration training and the evaluation index matched by the classification model. The evaluation index can be obtained by verifying the classification model obtained by training, and can include a verification loss, an accuracy, and the like. The verification loss can include a classification loss and a regression loss.

[0045] In the scheme, optionally, according to the defect classification prediction result, the classification probability of the reference level, and the reference level matched by the defect image sample in the defect classification data set, at least one iteration training is performed on the classification network to obtain the training result of each iteration training, including:

[0046] According to the defect classification prediction result, the classification probability of the reference level, and the reference level matched by the defect image sample in the defect classification data set, a model loss is calculated;

[0047] According to the model loss, at least one iteration training is performed on the classification network to obtain the training result of each iteration training;

[0048] The model loss includes a regression loss and a classification loss.

[0049] Specifically, the regression loss can be determined based on an absolute value loss, a square loss, and the like loss function, and the classification loss can be determined based on a cross-entropy loss, a hinge loss, and the like loss function. In the iteration training process, the regression loss of each iteration training can continuously refine the defect classification prediction result based on the reference level, and the classification loss of each iteration training can help to constrain the defect classification prediction result output by the regression structure to a reasonable reference level range, so as to avoid too large defect classification prediction result error and produce reference level deviation.

[0050] For a specific example, referring to three categories of reference levels R1, R2 and R3, the category codes of the reference levels R1, R2 and R3 are 1, 2 and 3 respectively. The reference level of the defect image sample A is R2, and the defect classification prediction result output by the iteration training is 3.2. It is indicated that the defect classification prediction result error is too large, and the reference level deviation is generated.

[0051] On the basis of the above scheme, the calculation formula of the model loss is:

[0052]

[0053] wherein y i is the reference level of the i-th defect image sample, is the defect level prediction result of the i-th defect image sample output by the regression structure, p i is the classification probability of the reference level of the i-th defect image sample output by the classification structure, n represents the number of defect image samples, and λ1 and λ2 are respectively the first coefficient and the second coefficient.

[0054] It is easy to understand that the classification loss can be calculated based on the reference level of the defect image sample and the classification probability of the reference level; the classification loss can be represented as The regression loss can be calculated according to the reference level of the defect image sample and the defect level prediction result of the defect image sample; the regression loss can be represented as

[0055] Through the model loss calculation formula of the scheme, the rapid convergence of the grading network can be realized, and the grading model with stable and reliable classification effect and fine and accurate classification result can be obtained.

[0056] S240, determining the grading model according to the training result of each iteration training.

[0057] In the embodiment, optionally, the determining the grading model according to the training result of each iteration training comprises:

[0058] the grading network obtained by the last iteration training is taken as the grading model; or the grading network meeting the preset evaluation index is taken as the grading model.

[0059] The iteration training of the grading network is a process in which the model loss gradually tends to be stable, therefore, the defect detection device can pre-set the iteration times, for example, 100 generations, and after the training is completed, the grading network obtained by the last iteration training is taken as the grading model.

[0060] The defect detection device can also verify the hierarchical network obtained by each iteration of training to obtain a verification result, and according to the verification result of each hierarchical model, the hierarchical network meeting the preset evaluation index is taken as the hierarchical model. For example, the hierarchical network with a verification loss less than a preset loss threshold is taken as the hierarchical model.

[0061] S250, obtain a defect image to be classified, and input the defect image to be classified to the pre-trained hierarchical model.

[0062] S260, according to the defect level prediction result output by the regression structure in the hierarchical model, determine the defect level of the defect image to be classified.

[0063] The defect detection device can divide the defect level of the defect image to be classified on the basis of the reference level according to the defect level prediction result output by the regression structure in the hierarchical model.

[0064] In a specific example, the reference levels include three types of R1, R2 and R3, and the defects are classified into ten categories of Q1-Q10. The category codes of the reference levels R1, R2 and R3 are 1, 2 and 3 respectively. The category code intervals of Q1-Q10 are [0.5, 0.8), [0.8, 1.1), [1.1, 1.4), [1.4, 1.7), [1.7, 2), [2, 2.3), [2.3, 2.6), [2.6, 2.9), [2.9, 3.2) and [3.2, 3.5) respectively. The defect level prediction result of the defect image to be classified is 2.5, and the defect detection device can determine that the defect level of the defect image to be classified is Q8.

[0065] In a feasible scheme, before inputting the defect image samples in the defect classification data set to the feature extraction structure, the method further comprises:

[0066] The data balancing processing is performed on each group of defect classification data in the defect classification data set, so that the defect classification data of each defect classification is uniformly distributed.

[0067] Before the model training, the defect detection device can perform data balancing processing on each group of defect classification data in the defect classification data set, so that the number of defect classification data of each reference level is uniformly distributed. Training the hierarchical network based on the balanced defect classification data set can help ensure that the hierarchical network fully learns the defect features of the defect image samples of each reference level, and improve the stability and reliability of the hierarchical model.

[0068] The technical scheme of the embodiment of the present application combines the regression structure and the classification structure, learns the defect image samples of the coarse classification labels, and realizes the fine-grained classification of the defect images to be classified. The technical scheme solves the problem of low defect classification refinement degree, can realize fine-grained defect classification while effectively improving the accuracy of defect classification, and meets the diversified workpiece requirements of users.

[0069] Embodiment three

[0070] Figure 3 A structural schematic diagram of a defect classification device provided by the third embodiment of the present application is shown in FIG. 3. As shown in the figure, the device comprises: Figure 3

[0071] The defect image to be classified acquisition module 310 is configured to acquire the defect image to be classified and input the defect image to be classified into the pre-trained classification model.

[0072] The defect level determination module 320 is configured to determine the defect level of the defect image to be classified according to the output result of the classification model.

[0073] The classification model is obtained by training the pre-constructed classification network based on the defect classification data set. The classification network comprises a feature extraction structure, a regression structure and a classification structure. The defect classification data set comprises at least one group of defect classification data. Each group of defect classification data comprises a defect image sample and a reference level matched with the defect image sample. The number of reference levels is less than the number of defect levels.

[0074] Optionally, the device further comprises a model training module, which comprises:

[0075] The defect feature extraction unit is configured to input the defect image sample in the defect classification data set into the feature extraction structure to obtain a defect feature.

[0076] The prediction result determination unit is configured to input the defect feature into the regression structure to output a defect classification prediction result matched with the defect image sample.

[0077] The classification probability determination unit is configured to input the defect feature into the classification structure to output a classification probability of the reference level matched with the defect image sample.

[0078] The training result determination unit is configured to perform at least one iteration training on the classification network according to the defect classification prediction result, the classification probability of the reference level and the reference level matched with the defect image sample in the defect classification data set, and obtain a training result of each iteration training.

[0079] The classification model determination unit is configured to determine the classification model according to the training result of each iteration training. ​

[0080] In one possible implementation, the training result determination unit is specifically configured to:

[0081] According to the defect classification prediction result, the classification probability of the reference level, and the reference level matched by the defect image sample in the defect classification data set, a model loss is calculated.

[0082] According to the model loss, the grading network is iteratively trained at least once to obtain a training result of each iteration.

[0083] The model loss includes a regression loss and a classification loss.

[0084] Based on the above-mentioned solution, optionally, the calculation formula of the model loss is:

[0085]

[0086] wherein y i is the reference level of the i-th defect image sample, f yi is the defect level prediction result of the i-th defect image sample output by the regression structure, p i is the classification probability of the reference level of the i-th defect image sample output by the classification structure, n represents the number of defect image samples, and λ1 and λ2 are respectively a first coefficient and a second coefficient.

[0087] In this embodiment, optionally, the defect level determination module 320 is specifically configured to:

[0088] According to the defect level prediction result output by the regression structure in the grading model, the defect level of the defect image to be graded is determined.

[0089] Optionally, the device further comprises:

[0090] A data equalization module is configured to perform data equalization processing on each group of defect classification data in the defect classification data set, so that the defect classification data of each defect classification is uniformly distributed.

[0091] In this solution, optionally, the grading model determination unit is specifically configured to:

[0092] The grading network obtained through the last iteration is taken as the grading model, or the grading network meeting the preset evaluation index is taken as the grading model.

[0093] The defect classification device provided in the embodiments of the present application can perform the defect classification method provided in any of the embodiments of the present application, and has the corresponding function modules and beneficial effects of the execution method.

[0094] Embodiment Four

[0095] Figure 4A structural diagram of an electronic device 410 that can be used to implement embodiments of the present application is shown. The electronic device is intended to represent various forms of digital computers, such as laptops, desktops, tablets, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The electronic device can also represent various forms of mobile devices, such as personal digital assistants, cellular telephones, smartphones, wearable devices (e.g., headsets, glasses, watches, etc.), and other similar computing devices. The components shown here, their connections and relationships, and their functions, are meant to be examples only, and are not meant to limit implementations of the present application described and / or claimed in this document.

[0096] As shown, Figure 4 The electronic device 410 includes at least one processor 411, and a memory, such as a read-only memory (ROM) 412, a random access memory (RAM) 413, etc., connected to the at least one processor 411 in communication, where the memory stores computer programs executable by the at least one processor. The processor 411 can perform various appropriate actions and processes according to the computer programs stored in the read-only memory (ROM) 412 or loaded into the random access memory (RAM) 413 from the storage unit 418. In the RAM 413, various programs and data required for the operation of the electronic device 410 can also be stored. The processor 411, the ROM 412, and the RAM 413 are connected to each other through a bus 414. An input / output (I / O) interface 415 is also connected to the bus 414.

[0097] Various components in the electronic device 410 are connected to the I / O interface 415, including an input unit 416, such as a keyboard, a mouse, etc., an output unit 417, such as various types of displays, speakers, etc., a storage unit 418, such as a magnetic disk, an optical disk, etc., and a communication unit 419, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 419 allows the electronic device 410 to exchange information / data with other devices through a computer network, such as the Internet, and / or various telecommunication networks.

[0098] The processor 411 can be various general and / or special purpose processing components with processing and computing capabilities. Some examples of the processor 411 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 411 performs various methods and processes described above, such as the defect grading method.

[0099] In some embodiments, the defect classification method can be implemented as a computer program tangibly embodied in a computer readable storage medium, e.g., storage unit 418. In some embodiments, parts or all of the computer program can be loaded and / or installed onto electronic device 410 via, e.g., ROM 412 and / or communication unit 419. When the computer program is loaded onto RAM 413 and executed by processor 411, one or more steps of the defect classification method described above can be performed. Alternatively, in other embodiments, processor 411 can be configured to perform the defect classification method by other means, e.g., with the aid of firmware.

[0100] Various implementations of the systems and techniques described above can be realized in digital electronic circuitry, integrated circuitry, a field programmable gate array (FPGA), an application specific integrated circuit (ASIC), a system on a chip (SOC), a programmable logic device (PLD), a computer hardware, firmware, software, and / or combinations thereof. These various implementations can include implementation in one or more computer programs that are executable and / or interpretable on a programmable system including at least one programmable processor, which can be special or general purpose, coupled to receive data and instructions from, and to transmit data and instructions to, a storage system, at least one input device, and at least one output device.

[0101] Computer programs used to implement the methods of the present application can be written in any combination of one or more programming languages. These computer programs can be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus to produce a machine, such that the computer program, when executed by the processor of the machine, implements the functions / acts specified in the flowcharts and / or block diagrams. The computer program can be executed entirely on a machine, partially on a machine, partially on a machine as part of a separate software package, or entirely on a remote machine or server.

[0102] In the context of the present application, a computer-readable storage medium can be a tangible medium that can contain or store a computer program for use by or in connection with an instruction execution system, apparatus, or device. A computer-readable storage medium can include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium can be a machine-readable signal medium. More specific examples of a machine-readable storage medium will include one or more lines of a program of instructions in a transitory signal, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0103] To provide for interaction with a user, the systems and techniques described here can be implemented on an electronic device having a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user and a keyboard and a pointing device (e.g., a mouse or a trackball) by which the user can provide input to the electronic device. Other kinds of devices can be used to provide for interaction with a user as well; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form, including acoustic, speech, or tactile input.

[0104] The systems and techniques described here can be implemented in a computing system that includes a back end component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front end component (e.g., a user computer having a graphical user interface or a Web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such back end, middleware, or front end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.

[0105] The computing system can include clients and servers. A client and server are generally remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system, to solve the defects of large management difficulty and weak business scalability in traditional physical host and VPS service.

[0106] It should be understood that the various forms of flow shown above can be used to reorder, add or delete steps. For example, each step described in the present application can be executed in parallel, sequentially or in a different order, as long as the desired results of the technical solutions of the present application can be achieved, which is not limited herein.

[0107] The above detailed description does not constitute a limitation on the protection scope of the present application. Those skilled in the art should understand that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modifications, equivalent replacements and improvements made within the spirit and principles of the present application shall be included in the protection scope of the present application.

Claims

1. A defect grading method characterized by, The method comprises: acquiring a defect image to be classified, and inputting the defect image to be classified into a pre-trained classification model; determining a defect level of the defect image to be classified according to an output result of the classification model; wherein the classification model is obtained by training a pre-constructed classification network based on a defect classification data set; the classification network comprises a feature extraction structure, a regression structure and a classification structure; the defect classification data set comprises at least one group of defect classification data, each group of defect classification data comprising a defect image sample and a reference level matched with the defect image sample; the number of reference levels is less than the number of defect levels; the training process of the classification model comprises: inputting the defect image sample in the defect classification data set into the feature extraction structure to obtain a defect feature; inputting the defect feature into the regression structure to output a defect classification prediction result matched with the defect image sample, and inputting the defect feature into the classification structure to output a classification probability of the reference level matched with the defect image sample; calculating a model loss according to the defect classification prediction result, the classification probability of the reference level and the reference level matched with the defect image sample in the defect classification data set; the model loss is determined based on a regression loss and a classification loss; the classification loss is calculated based on the reference level of the defect image sample and the classification probability of the reference level; and the regression loss is calculated according to the reference level of the defect image sample and the defect classification prediction result of the defect image sample; performing at least one iteration training on the classification network according to the model loss to obtain a training result of each iteration training; determining the classification model according to the training result of each iteration training.

2. The method of claim 1, wherein, The calculation formula of the model loss is: ; wherein, is a reference level of a th defect image sample, is a defect classification prediction result of a th defect image sample output by the regression structure, is a classification probability of the reference level of a th defect image sample output by the classification structure, denotes a number of defect image samples, and are respectively a first coefficient and a second coefficient.

3. The method of claim 1, wherein, determining the defect level of the defect image to be classified according to the output result of the classification model comprises: determining the defect level of the defect image to be classified according to the defect classification prediction result output by the regression structure in the classification model.

4. The method of claim 1, wherein, Before inputting the defect image sample in the defect classification data set into the feature extraction structure, the method further comprises: performing data equalization processing on each group of defect classification data in the defect classification data set to make the defect classification data in each group of defect classification data uniformly distributed.

5. The method of claim 1, wherein, determining the classification model according to the training result of each iteration training comprises: taking the classification network obtained by the last iteration training as the classification model, or taking the classification network meeting a preset evaluation index as the classification model.

6. A defect grading apparatus characterized by comprising: comprises: a defect image to be classified acquisition module, configured to acquire a defect image to be classified, and input the defect image to be classified into a pre-trained classification model; a defect level determination module, configured to determine a defect level of the defect image to be classified according to an output result of the classification model; wherein the classification model is obtained by training a pre-constructed classification network based on a defect classification data set; the classification network comprises a feature extraction structure, a regression structure and a classification structure; the defect classification data set comprises at least one group of defect classification data, each group of defect classification data comprising a defect image sample and a reference level matched with the defect image sample; the number of reference levels is less than the number of defect levels; The apparatus also includes a model training module, which includes: a defect feature extraction unit, configured to input the defect image samples in the defect classification data set into a feature extraction structure to obtain defect features; a prediction result determination unit, configured to input the defect features into a regression structure to output defect classification prediction results matched by the defect image samples; a classification probability determination unit, configured to input the defect features into a classification structure to output classification probabilities of the reference levels matched by the defect image samples; a training result determination unit, configured to calculate a model loss according to the defect classification prediction results, the classification probabilities of the reference levels, and the reference levels matched by the defect image samples in the defect classification data set; the model loss is determined based on a regression loss and a classification loss; the classification loss is calculated based on the reference levels of the defect image samples and the classification probabilities of the reference levels; the regression loss is calculated according to the reference levels of the defect image samples and the defect classification prediction results of the defect image samples; the classification network is iteratively trained at least once according to the model loss to obtain training results of each iteration; a classification model determination unit, configured to determine a classification model according to the training results of each iteration.

7. An electronic device, comprising: The electronic device includes: at least one processor; and a memory connected to the at least one processor in communication; wherein the memory stores a computer program that can be executed by the at least one processor, and the computer program is executed by the at least one processor to enable the at least one processor to perform the defect classification method of any one of claims 1-5.

8. A computer-readable storage medium, characterized in that, The computer readable storage medium stores computer instructions for causing the processor to implement the defect classification method of any one of claims 1-5 when executed.

Citation Information

Patent Citations

  • Method and device for training defect grading detection model, equipment and storage medium

    CN113205176A

  • Defect detection method based on multi-task learning

    CN113947567A