Method for eliminating pseudo defects of metal casting in ADR detection

By constructing a joint processing of the image segmentation model and the object detection model, and using matrix point multiplication operation for secondary confirmation, the problem of high false error rate in the detection method is solved, and higher detection accuracy and efficiency are achieved.

CN119863434APending Publication Date: 2025-04-22CHONGQING UNICOMP TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411916073.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-23
Publication Date
2025-04-22

AI Technical Summary

Technical Problem

When detecting defects of metal castings, the false defect error rate is high, resulting in a large number of qualified castings being wrongly marked as defective, which increases the workload and production cost of manual retrieval.

Method used

The training image segmentation model and the object detection model are constructed, and the image segmentation model and the object detection model are combined, and the matrix point multiplication operation is used to perform secondary confirmation to eliminate pseudo-defects.

Benefits of technology

It effectively reduces the false misjudgment rate, reduces the workload of manual retrieval, and improves the accuracy and efficiency of detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119863434A_ABST
    Figure CN119863434A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of detection, in particular to a method for eliminating pseudo defects of a metal casting in ADR detection, and the method comprises the steps: respectively processing an input image through an image segmentation model and a target detection model, and obtaining two processing results; drawing a target frame output by the target detection model on a black image with the same size as the input image; carrying out matrix dot multiplication operation on a segmentation result and the graph drawn in the previous step, and taking an operation result as a segmentation result after secondary confirmation; and performing connected domain contour search on the result after secondary confirmation to obtain the position and size information of the defect. According to the method, the same annotation data is utilized, a conversion tool is written, the method is suitable for two network models, and the repeated workload is reduced; matrix dot multiplication is directly carried out by utilizing output results of the two models, the basic principle is AND gate logic, and pseudo defects are simply and efficiently eliminated, so that the problem that the workload of workers is increased due to high false defect misjudgment rate of an existing detection method is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the field of detection technology, and in particular to a method for eliminating pseudo defects of metal castings in ADR detection. Background Art

[0002] In the current industrial inspection field, especially for the detection of internal defects in castings, deep learning technology has shown great potential and value. By training complex neural network models, these systems can automatically identify and mark potential defects inside castings, such as pores, cracks, inclusions, etc. However, although deep learning technology has made significant progress in improving detection accuracy and efficiency, it still faces a problem that cannot be ignored in practical applications - false defect misjudgment.

[0003] False defect misjudgment refers to the situation where the system mistakenly judges qualified castings as defective. This situation often occurs because the deep learning model is interfered by noise, lighting conditions, casting surface texture and other factors when processing complex and changeable casting images, resulting in the model being unable to accurately distinguish between real defects and false defects. When the false defect misjudgment rate is high, it will directly lead to a large number of qualified castings being mistakenly marked as defective, which will lead to a large-scale overkill phenomenon.

[0004] Large-scale over-killing will not only increase the workload of manual re-judgment and reduce production efficiency, but may also have a negative impact on the quality control of castings. Because in actual production, once a casting is judged to be defective, it often needs further inspection, repair or scrapping. The over-killing phenomenon caused by false defect misjudgment will cause these originally qualified castings to undergo unnecessary processing, thereby increasing production costs and time costs. Summary of the invention

[0005] The purpose of the present invention is to provide a method for eliminating false defects of metal castings in ADR detection, aiming to solve the problem that the false defect misjudgment rate of existing detection methods is high, resulting in increased workload for staff.

[0006] To achieve the above object, the present invention provides a method for eliminating false defects of metal castings in ADR detection, comprising the following steps:

[0007] Build training image segmentation models and target detection models;

[0008] The image segmentation model and the target detection model process the input image respectively to obtain two processing results;

[0009] Draw the target box output by the target detection model onto a black image of the same size as the input image;

[0010] Perform matrix dot multiplication on the segmentation result and the image drawn in the previous step, and use the result as the segmentation result after secondary confirmation;

[0011] The connected domain contour is searched for the results after the second confirmation to obtain the defect location and size information.

[0012] Among them, in “building a training image segmentation model and a target detection model”, the building of the image segmentation model includes the following steps:

[0013] Label confirmed defects and suspected defects to obtain training data;

[0014] Preprocessing the training data

[0015] Build an image segmentation model;

[0016] The preprocessed training data is input into the image segmentation model for inference to obtain the network inference result;

[0017] Input the network inference result and the true annotation into the loss calculation function to get the total loss value;

[0018] Perform gradient back propagation on the total loss value to update the parameters of the image segmentation model;

[0019] Repeat the above learning process until the loss value of the image segmentation model reaches the preset range.

[0020] Among them, in "inputting the network inference results and the true annotations into the loss calculation function to obtain the total loss value", the following steps are included:

[0021] The loss value of the real defect area is calculated by the binary cross entropy formula;

[0022] Exclude the real defect area and shielded area to obtain the real background area and loss value;

[0023] The total loss value is obtained by adding up the loss values ​​of each part according to the weight ratio.

[0024] Among them, in “building a training image segmentation model and a target detection model”, the construction of the target detection model includes the following steps:

[0025] Write a conversion tool to obtain the labeled data required for the detection model;

[0026] Build a network model;

[0027] Input the required labeled data into the network model for inference and obtain the loss value i

[0028] Perform back gradient propagation on the loss value to update the model parameters;

[0029] Repeat the model learning process until the loss value drops to an appropriate level, terminate the training, and save the final target detection model.

[0030] Among them, in "inputting the required labeled data into the network model for inference to obtain the loss value", it includes:

[0031] Input data into the network for inference and obtain results;

[0032] The result and the true label value are given to the loss calculation module to obtain the target box coordinate regression loss, target confidence loss, and target classification loss;

[0033] The weight is multiplied by the coordinate regression loss, target confidence loss, and target classification loss to obtain the final loss value.

[0034] The present invention discloses a method for eliminating pseudo defects of metal castings in ADR detection, comprising the following steps: constructing a training image segmentation model and a target detection model; the image segmentation model and the target detection model process the input image respectively to obtain two processing results; drawing the target frame output by the target detection model onto a black image of the same size as the input image; performing matrix dot multiplication operation on the segmentation result and the image drawn in the previous step, and taking the operation result as the segmentation result after secondary confirmation; searching the connected domain contour of the result after secondary confirmation to obtain the defect position and size information. The present invention uses the same kind of annotation data, writes a conversion tool, and is applicable to two network models to reduce repeated workload; directly performs matrix dot multiplication operation on the output results of the two models, and the basic principle is AND gate logic, which simply and efficiently eliminates pseudo defects, thereby solving the problem that the false defect misjudgment rate of the existing detection method is high, which leads to an increase in the workload of the staff. BRIEF DESCRIPTION OF THE DRAWINGS

[0035] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0036] Figure 1 The present invention provides a flow chart of a method for eliminating pseudo defects of metal castings in ADR detection.

[0037] Figure 2 It is a flowchart of image segmentation model construction.

[0038] Figure 3 It is a flowchart that inputs the network inference results and the true annotation into the loss calculation function to obtain the total loss value.

[0039] Figure 4 It is a flowchart of target detection model construction.

[0040] Figure 5 It is a flowchart for inputting the required labeled data into the network model for inference and obtaining the loss value. DETAILED DESCRIPTION

[0041] Embodiments of the present invention are described in detail below, examples of which are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are intended to be used to explain the present invention, and should not be construed as limiting the present invention.

[0042] See also Figures 1 to 5 The present invention provides a method for eliminating pseudo defects of metal castings in ADR detection, comprising the following steps:

[0043] S1 builds training image segmentation model and target detection model;

[0044] S101 marks confirmed defects and suspected defects to obtain training data;

[0045] Specifically, prepare training data, mark obvious defects in red, and mark suspected defects in blue.

[0046] S102 preprocesses the training data;

[0047] Specifically, the training data is loaded, the data is read in the child thread, the image preprocessing operation is completed, and a value between 0 and 1 is defined for the blue and red colors in the labeled image, respectively, to distinguish different areas in the loss calculation stage.

[0048] S103 builds an image segmentation model;

[0049] Specifically, complete the construction of the U-shaped segmentation network, adjust the output layer according to actual needs, and process it into a 32-bit floating point type between 0 and 1 through the sigmoid function.

[0050]

[0051] S104 inputs the preprocessed training data into the image segmentation model for inference to obtain a network inference result;

[0052] Specifically, data is obtained from the child thread and input into the network for inference and the parameter gradient information (derivative value) is recorded, and the network inference result is recorded as out.

[0053] S105 inputs the network inference result and the true annotation into the loss calculation function to obtain the total loss value;

[0054] Input the inference result out and the true label label into the loss calculation function to obtain the partition information (the marked red and blue parts)

[0055] S1051 calculates the loss value of the real defect area through the binary cross entropy formula;

[0056] Specifically, the loss value of the real defect area is first calculated by the binary cross entropy formula (BCE).

[0057] S1052 excludes the real defect area and the shielding area to obtain the real background area and the loss value;

[0058] Specifically, the real defect area and the shielded area are excluded to obtain the real background area, and the loss value is also obtained through BCE.

[0059] S1053 adds the loss values ​​of each part according to the weight ratio to obtain the total loss value.

[0060] Specifically, the loss values ​​of each part are added together according to a certain weight ratio to get the total loss value.

[0061] LOSS=-(ylong(p(x)+(1-y)log(1-p(x))

[0062] Among them, loss is the loss value, y is the true annotation value, p is the model output result, and x is the input data.

[0063] S106 performs gradient back propagation on the total loss value to update the parameters of the image segmentation model

[0064] Specifically, the gradient back propagation operation is performed on the loss value obtained in the previous step. The main principle is to calculate the partial derivatives of the parameters in the network model, determine the direction of adjustment of each parameter, and then multiply it by the hyperparameter learning rate lr to obtain the adjusted parameters. Finally, the parameters of the network model are updated to complete the learning of the model.

[0065] S107 repeats the above learning process until the loss value of the image segmentation model reaches a preset range.

[0066] Specifically, the learning process of the above model is repeated until the loss value drops to a reasonable range, completing the training of the entire segmentation model.

[0067] S111 write a conversion tool to obtain the annotation data required for the detection model;

[0068] Specifically, a conversion tool is written from the segmentation model annotation data to the detection model annotation data to obtain the annotation data required for the detection model.

[0069] S112 builds a network model;

[0070] Specifically, the data loading code was written, in which the image data set expansion technology (mosaic enhancement) was applied. The principle is to randomly select 4 pictures from the data set each time, then stitch them into a large picture, and then randomly crop and scale the large picture to the appropriate size.

[0071] S113 inputs the required labeled data into the network model for inference to obtain a loss value;

[0072] S1131 inputs data into the network for inference and obtains results;

[0073] Specifically, input data into the network for inference, and the result is recorded as out.

[0074] S1132 gives the result and the true label value to the loss calculation module to obtain the target frame coordinate regression loss, target confidence loss, and target classification loss;

[0075] Specifically, out and the true label value are given to the loss calculation module. The loss calculation is divided into three parts: target box coordinate regression loss, target confidence loss, and target classification loss.

[0076] The S1133 weight is multiplied by the coordinate regression loss, target confidence loss, and target classification loss to obtain the final loss value.

[0077] Specifically, the degree of adjustment is determined according to the learning rate, and the adjusted model parameters are updated into the model to complete the learning of the model.

[0078] S114 performs reverse gradient propagation on the loss value to update the model parameters;

[0079] Specifically, reverse gradient propagation is performed on the loss value to determine the direction of model parameter adjustment, and then the degree of adjustment is determined according to the learning rate. The adjusted model parameters are updated to the model to complete the model learning.

[0080] S115 repeats the model learning process until the loss value drops to an appropriate level, terminates the training, and saves the final target detection model.

[0081] Specifically, the model learning process is repeated until the loss value drops to an appropriate level, the training is terminated, the final model is saved, and the entire training process is completed.

[0082] S2: the image segmentation model and the target detection model process the input image respectively to obtain two processing results;

[0083] Specifically, two models are called to process the input image respectively to obtain two processing results.

[0084] S3 draws the target box output by the target detection model onto a black image of the same size as the input image;

[0085] Specifically, the target box output by the detection model is drawn on a black image of the same size as the input image, the grayscale value of the drawing is set to 1, and it is a filled drawing.

[0086] S4 performs a matrix dot multiplication operation on the segmentation result and the image drawn in the previous step, and uses the operation result as the segmentation result after secondary confirmation;

[0087] Specifically, a matrix dot multiplication operation is performed on the segmentation result and the image drawn in the previous step, and the operation result is used as the segmentation result after secondary confirmation.

[0088] S5 searches for the connected domain contour on the result after the second confirmation to obtain the defect location and size information.

[0089] Specifically, the connected domain contour is searched for the result after the second confirmation to obtain the defect location and size information to complete the detection task.

[0090] Beneficial effects:

[0091] 1. Use the same annotated data and write conversion tools to apply to both network models to reduce duplication of work.

[0092] Second, use the output results of the two models to directly perform matrix dot multiplication operations. The basic principle is AND gate logic, which eliminates false defects simply and efficiently.

[0093] The above disclosure is only a preferred embodiment of a method for eliminating pseudo defects of metal castings in ADR detection of the present invention. Of course, this cannot be used to limit the scope of rights of the present invention. Ordinary technicians in this field can understand that all or part of the processes of the above embodiments and equivalent changes made according to the claims of the present invention still fall within the scope of the invention.

Claims

1. A method for eliminating false defects in metal castings during ADR detection, characterized in that: The following steps are involved: Build training image segmentation models and target detection models; The image segmentation model and the target detection model process the input image respectively to obtain two processing results; Draw the target box output by the target detection model onto a black image of the same size as the input image; Perform matrix dot multiplication on the segmentation result and the image drawn in the previous step, and use the result as the segmentation result after secondary confirmation; The connected domain contour is searched for the results after the second confirmation to obtain the defect location and size information.

2. The method for eliminating false defects of metal castings in ADR detection according to claim 1, characterized in that: In "Constructing a training image segmentation model and a target detection model", the construction of the image segmentation model includes the following steps: Label confirmed defects and suspected defects to obtain training data; Preprocessing the training data Build an image segmentation model; The preprocessed training data is input into the image segmentation model for inference to obtain the network inference result; Input the network inference result and the true annotation into the loss calculation function to get the total loss value; Perform gradient back propagation on the total loss value to update the parameters of the image segmentation model; Repeat the above learning process until the loss value of the image segmentation model reaches the preset range.

3. The method for eliminating false defects of metal castings in ADR detection according to claim 2, characterized in that: In "Input the network inference results and the true annotations into the loss calculation function to obtain the total loss value", the following steps are included: The loss value of the real defect area is calculated by the binary cross entropy formula; Exclude the real defect area and shielded area to obtain the real background area and loss value; The total loss value is obtained by adding up the loss values ​​of each part according to the weight ratio.

4. The method for eliminating false defects of metal castings in ADR detection according to claim 1, characterized in that: In "Constructing a training image segmentation model and a target detection model", the construction of the target detection model includes the following steps: Write a conversion tool to obtain the labeled data required for the detection model; Build a network model; Input the required labeled data into the network model for inference to obtain the loss value; Perform back gradient propagation on the loss value to update the model parameters; Repeat the model learning process until the loss value drops to an appropriate level, terminate the training, and save the final target detection model.

5. The method for eliminating false defects of metal castings in ADR detection according to claim 4, characterized in that: In "Input the required labeled data into the network model for inference and obtain the loss value", include: Input data into the network for inference and obtain results; The result and the true label value are given to the loss calculation module to obtain the target box coordinate regression loss, target confidence loss, and target classification loss; The weight is multiplied by the coordinate regression loss, target confidence loss, and target classification loss to obtain the final loss value.