Die casting defect detection method, device and equipment and storage medium

Through CAE simulation and image segmentation technology, the defect parts of die castings are predicted and detected, and the accurate classification of defect types is achieved in combination with clustering analysis, which solves the problems of inefficiency and inaccuracy of traditional detection methods, and significantly improves the detection efficiency and accuracy.

CN119445244AInactive Publication Date: 2025-02-14DONGGUAN RIXIN HARDWARE ELECTRONICS CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411548097.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-01
Publication Date
2025-02-14
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

Traditional die-casting defect detection methods are inefficient and not accurate enough, and are particularly difficult to adapt to the multi-type defect detection requirements of large and complex die-casting, and there are situations where excessive detection of appearance defects that do not affect structural performance.

Method used

Through CAE simulation, the potential defect parts are predicted and targeted image acquisition is carried out, background interference is removed by image segmentation technology, and hybrid clustering analysis is used to achieve accurate classification of defect types.

Benefits of technology

It significantly improves the efficiency and accuracy of die-casting defect detection, reduces invalid detection, optimizes the inspection process, and provides a reliable basis for quality control and production process improvement.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119445244A_ABST
    Figure CN119445244A_ABST
Patent Text Reader

Abstract

The invention discloses a die casting defect detection method, device and equipment and a storage medium, and the method comprises the steps: obtaining a mold geometric model, predicting a plurality of defect risk regions of a die casting and corresponding defect types through employing a CAE simulation algorithm, carrying out the image sampling of the regions, obtaining defect risk region images, and carrying out the detection of the defects of the die casting. Background segmentation is carried out by using a preset defect image segmentation algorithm to obtain a plurality of first defect images, the first defect images are added to a defect data set containing second defect images marked with defect types, clustering analysis is carried out to form a plurality of classification clusters, and according to the defect types of the classification clusters to which the first defect images belong, the defect types of the second defect images are marked; and determining corresponding defect type information. According to the method, the image of the potential defect part is predicted and collected through CAE simulation, and image segmentation and clustering analysis are combined, so that the die casting defect detection efficiency and accuracy are remarkably improved, the detection process is optimized, and a reliable basis is provided for quality control.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of die casting defect detection, and in particular to a die casting defect detection method, device, equipment and storage medium. Background Art

[0002] In modern manufacturing, die-casting technology is widely used in many fields such as automobiles, electronics, and aerospace due to its high efficiency, low cost, and ability to produce parts with complex shapes. However, die-castings may have a variety of defects during the production process, such as flow marks, cold shuts, cracks, shrinkage cavities, shrinkage porosity, scratches, sintering, slag pores, pores, or delamination, etc. These defects not only affect the appearance quality of die-castings, but may also have a serious impact on their structural performance. Especially for large die-castings, due to their complex structure and large mold size, coupled with changes in die-casting parameters (such as pressure, temperature, flow rate, etc.), different types of defects may occur in different parts, which puts higher requirements on defect detection.

[0003] Traditional die casting defect detection methods usually rely on manual visual inspection or simple image processing technology, which is not only inefficient, but also easily limited by personal experience and technical level, making it difficult to ensure the consistency and accuracy of detection. As die castings increase in size and complexity, the limitations of this detection method become more and more obvious, especially when facing multiple types of defects, full-range detection becomes neither economical nor efficient. Summary of the invention

[0004] In order to solve at least one of the technical problems mentioned above, the present invention provides a die casting defect detection method, device, equipment and storage medium.

[0005] In a first aspect, the present invention provides a method for detecting defects in die castings, the method comprising:

[0006] Obtaining a mold geometry model, predicting multiple defect risk areas and corresponding defect types of the die casting based on the mold geometry model and using a CAE simulation algorithm, screening the defect risk areas, sampling images of the defect risk areas in turn, and obtaining multiple defect risk area images;

[0007] Using a preset defect image segmentation algorithm to perform background segmentation on the defect risk area image to obtain a plurality of first defect images;

[0008] Adding multiple defect images to a preset defect data set, the defect data set includes multiple second defect images with labeled defect types, performing cluster analysis on the defect data set to obtain multiple classification clusters corresponding to different defect types, and determining defect type information corresponding to the first defect image based on the defect type of the classification cluster to which the first defect image belongs;

[0009] Integrate defect type information of different first defect images to obtain comprehensive defect information of die castings;

[0010] The screening of defect risk areas includes:

[0011] The surface type corresponding to the defect risk area is obtained, and the surface type includes a functional surface and an appearance surface. If the surface type of the defect risk area is a functional surface, and the defect type of the defect risk area is a flow mark, a scratch or sintering, the corresponding defect risk area is eliminated.

[0012] Preferably, the method of using a preset defect image segmentation algorithm to perform background segmentation on the defect risk area image to obtain a plurality of first defect images includes:

[0013] Grayscale processing is performed on the defect risk area image to obtain a grayscale image of the defect risk area;

[0014] Calibrate the grayscale image of the defect risk area based on the average grayscale value of the preset standard image of the corresponding area, and perform grayscale analysis on the calibrated grayscale image of the defect risk area to screen out the first grayscale value with the largest number of pixels;

[0015] Based on the first grayscale value, multiple starting filling points are set on the defect risk area image, and the pixels around the starting filling points are filled using a flood filling algorithm to obtain multiple sub-background images. The defect risk area image is subtracted from the sub-background images in turn to obtain multiple first defect images.

[0016] Preferably, the method of setting a plurality of starting filling points on the defect risk area image based on the first gray value, and using a flood filling algorithm to fill pixels around the starting filling points to obtain a plurality of sub-background images includes:

[0017] A background grayscale interval is set based on the second grayscale, and a pixel point within the background grayscale interval is randomly selected on the defect risk area image as a starting filling point;

[0018] Using a flood filling algorithm, the pixel points around the starting filling point that meet the background grayscale interval are replaced with a first grayscale value;

[0019] If the number of pixels in the unreplaced background grayscale interval in the image is greater than a preset value, continue to select pixels in the remaining background grayscale interval as starting filling points until the number of unreplaced pixels is less than or equal to the preset value.

[0020] Preferably, the defect types include flow marks, cold shuts, cracks, shrinkage cavities, shrinkage porosity, scratches, sintering, slag pores, air holes or delamination.

[0021] Preferably, after predicting multiple defect risk areas of the die casting based on the mold geometry model and using a CAE simulation algorithm, the method further includes screening the defect risk areas, specifically including:

[0022] Acquire a surface type corresponding to the defect risk area, wherein the surface type includes a functional surface and an appearance surface;

[0023] If the surface type of the defect risk area is a functional surface, and the defect type of the defect risk area is flow mark, scratch or sintering, the corresponding defect risk area is removed.

[0024] In a second aspect, the present invention further provides a die casting defect detection device, the device comprising:

[0025] The defect risk area image acquisition module is used to obtain the mold geometry model, predict multiple defect risk areas and corresponding defect types of the die casting based on the mold geometry model and using the CAE simulation algorithm, and sample the defect risk areas in turn to obtain multiple defect risk area images;

[0026] A defect image segmentation module, used to perform background segmentation on the defect risk area image using a preset defect image segmentation algorithm to obtain a plurality of first defect images;

[0027] a defect recognition module, configured to add a plurality of defect images to a preset defect data set, wherein the defect data set includes a plurality of second defect images with labeled defect types, perform cluster analysis on the defect data set to obtain a plurality of classification clusters corresponding to different defect types, and determine defect type information corresponding to the first defect image based on the defect type of the classification cluster to which the first defect image belongs;

[0028] The defect integration module is used to integrate the defect type information of different first defect images to obtain comprehensive defect information of the die casting.

[0029] Preferably, the defect image segmentation module is further used for:

[0030] Grayscale processing is performed on the defect risk area image to obtain a grayscale image of the defect risk area;

[0031] Calibrate the grayscale image of the defect risk area based on the average grayscale value of the preset standard image of the corresponding area, and perform grayscale analysis on the calibrated grayscale image of the defect risk area to screen out the first grayscale value with the largest number of pixels;

[0032] Based on the first grayscale value, multiple starting filling points are set on the defect risk area image, and the pixels around the starting filling points are filled using a flood filling algorithm to obtain multiple sub-background images. The defect risk area image is subtracted from the sub-background images in turn to obtain multiple first defect images.

[0033] Preferably, the defect image segmentation module is further used for:

[0034] A background grayscale interval is set based on the second grayscale, and a pixel point within the background grayscale interval is randomly selected on the defect risk area image as a starting filling point;

[0035] Using a flood filling algorithm, the pixel points around the starting filling point that meet the background grayscale interval are replaced with the first grayscale value;

[0036] If the number of pixels in the unreplaced background grayscale interval in the image is greater than a preset value, continue to select pixels in the remaining background grayscale interval as starting filling points until the number of unreplaced pixels is less than or equal to the preset value.

[0037] In a third aspect, the present invention further provides an electronic device comprising a processor and a memory, wherein the memory is used to store computer program code, and the computer program code comprises computer instructions. When the processor executes the computer instructions, the electronic device executes the method as described in the first aspect above and any possible implementation thereof.

[0038] In a fourth aspect, the present invention further provides a computer-readable storage medium, wherein a computer program is stored in the computer-readable storage medium, wherein the computer program includes program instructions, and when the program instructions are executed by a processor of an electronic device, the processor executes the method as described in the first aspect above and any possible implementation thereof.

[0039] Compared with the prior art, the present invention has the following beneficial effects:

[0040] 1) The present invention predicts potential defect locations through CAE simulation and performs targeted image acquisition, combines image segmentation technology to remove background interference, and finally uses hybrid clustering analysis to achieve accurate classification of defect types, thereby significantly improving the efficiency and accuracy of die-casting defect detection, reducing invalid detection, optimizing the detection process, and providing a reliable basis for quality control and production process improvement.

[0041] 2) The present invention simplifies image data through grayscale processing, and uses standard image calibration to reduce the impact of illumination changes. The selection of background grayscale interval is combined to improve the accuracy of background segmentation and reduce the misidentification of non-background areas. The background area is efficiently identified and replaced by a flood filling algorithm, and finally a clear defect image is obtained. This not only significantly improves the accuracy and efficiency of defect detection and ensures a high level of quality control, but also further improves the background segmentation effect through repeated inspections and supplementary filling, providing clearer and more accurate basic image data for subsequent defect type identification.

[0042] 3) Under the premise of ensuring the structural performance of the die-casting, the present invention reasonably eliminates the detection of appearance defect areas that do not affect the structural performance, thereby optimizing the detection work, which not only improves the detection efficiency and reduces unnecessary detection steps, but also avoids the increase in costs and waste of time caused by excessive detection.

[0043] It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0044] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the background technology, the drawings required for use in the embodiments of the present invention or the background technology will be described below.

[0045] The drawings herein are incorporated into the specification and constitute a part of the specification. These drawings illustrate embodiments consistent with the present disclosure and are used to illustrate the technical solutions of the present disclosure together with the specification.

[0046] Figure 1 A schematic flow chart of a die casting defect detection method provided by an embodiment of the present invention;

[0047] Figure 2 A schematic structural diagram of a die casting defect detection device provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0048] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0049] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present invention. The appearance of the phrase in various places in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.

[0050] Existing die-casting defect detection methods are inefficient and not accurate enough, especially when facing large and complex die-castings. Traditional detection methods are difficult to adapt to the needs of efficient detection of multiple types of defects, and there is a situation of excessive detection of appearance defects that do not affect structural performance, resulting in increased detection costs and time consumption.

[0051] It should be noted that the defect types include flow marks, cold shuts, cracks, shrinkage cavities, shrinkage porosity, scratches, sintering, slag pores, air holes or delamination.

[0052] Flow marks refer to the lines produced when the aluminum alloy liquid metal flows in the mold during the die casting process. Flow marks usually do not affect the strength and stability of the die casting, but may affect its aesthetics.

[0053] Cold shut refers to the defect caused by the incomplete fusion of molten metal due to uneven distribution of temperature and pressure when the molten metal is filled in the mold. The formation of cold shut not only affects the aesthetics of the casting, but also has a negative impact on its mechanical properties.

[0054] Cracking refers to the long-term extrusion of the die casting mold by the high temperature and high pressure of the material, which causes the molecular creeping of the mold surface to produce fatigue, deformation, peeling and cracking. Cracking will affect the strength and stability of the die casting because it may cause cracks or breaks in the casting during use.

[0055] Shrinkage cavities and porosity are caused by solidification shrinkage and insufficient supply of molten metal. They are irregular in shape and mainly distributed in the last solidified area of ​​the casting. These defects not only affect the mechanical properties of the material, but may also cause serious problems such as cracks and fractures.

[0056] Scratches refer to the marks left by the contact between the casting surface and the die casting mold cavity surface or the step marks on the casting surface. Scratches may affect the surface quality of the die casting, but usually do not have a direct impact on its strength and stability.

[0057] Sintering refers to the reaction between the cavity and the alloy liquid to form an alloy layer, which is called sintering. Sintering may affect the surface quality of the die casting, but usually does not have a direct impact on its strength and stability.

[0058] Shrinkage cracking refers to the dendrite-like formation of a molded part during the cooling process after solidification. Shrinkage cracking may affect the strength and stability of the die casting as it may cause the casting to crack or break during use.

[0059] Porosity (sand holes) refers to the holes in the wall of the die casting, which are generally round or oval, with a smooth surface, usually shiny oxide scale, and sometimes oily yellow. Porosity may affect the strength and stability of the die casting, as it may cause cracks or breaks in the casting during use.

[0060] It should be noted that defect types such as flow marks, abrasions or sintering only affect the aesthetics of the die castings, but do not affect the structural properties of the die castings.

[0061] See also Figure 1 , Figure 1 A schematic diagram of a die casting defect detection method provided by an embodiment of the present invention. Figure 1 As shown, the method includes:

[0062] S100, obtaining a mold geometry model, predicting multiple defect risk areas and corresponding defect types of the die casting based on the mold geometry model and using a CAE simulation algorithm, screening the defect risk areas, and sequentially sampling images of the defect risk areas to obtain multiple defect risk area images;

[0063] In the process of obtaining the mold geometry model and die-casting parameters, high-precision 3D scanning equipment, such as laser scanners or CT scanners, is required to obtain the 3D digital model of the mold. The mold geometry model not only covers the geometry of the outer surface of the mold, but also includes the design of internal structures such as cooling channels. Die-casting parameters include but are not limited to the clamping force of the die-casting machine, the pouring temperature of the molten metal, the injection speed, the holding time and pressure, etc. The die-casting parameters are imported into the computational fluid dynamics (CFD) and thermodynamic analysis tools together with the mold geometry model (i.e., the CAD model). By simulating the state of metal flow during the die-casting process, the types and locations of possible defects are predicted. For example, if the cooling rate in a certain area is too fast, it may cause cold shut; while uneven flow rate may cause flow marks or pores. Based on the prediction, a high-resolution industrial camera is used for image acquisition, and the camera's viewing angle and focal length are adjusted according to the location of the defect risk area to ensure that the details of these areas can be clearly captured.

[0064] In a possible embodiment, when multiple risk areas are located on the same plane, information of all these areas can be obtained through a single shot, and then the defect risk area image of a single area can be separated using image processing technology. In order to speed up the inspection, multiple cameras at fixed positions can also be arranged to collect defect risk area images from different angles at the same time.

[0065] The screening of defect risk areas includes:

[0066] The surface type corresponding to the defect risk area is obtained, and the surface type includes a functional surface and an appearance surface. If the surface type of the defect risk area is a functional surface, and the defect type of the defect risk area is a flow mark, a scratch or sintering, the corresponding defect risk area is eliminated.

[0067] Obtain the surface type corresponding to the defect risk area. The surface types are divided into two categories: functional surface and appearance surface. The functional surface refers to the internal or hidden parts of the die-casting. These areas mainly focus on their functionality rather than appearance; the appearance surface refers to the visible parts of the outside of the die-casting. In addition to functional requirements, these areas also need to meet certain appearance requirements. After clarifying the surface type of the defect risk area, if the surface type of the area is a functional surface, and the predicted defect type is flow marks, abrasions or sintering (these defects mainly affect the appearance but not the structural performance), these defect risk areas can be eliminated and no further sampling and detection measures will be taken on them, thereby improving the overall detection efficiency.

[0068] Specifically, through CAE simulation analysis, multiple defect risk areas of die castings and their corresponding defect types are predicted. In the prediction results, defect types may include but are not limited to flow marks, cold shuts, cracks, shrinkage cavities, shrinkage porosity, abrasions, sintering, slag pores, pores or delamination. Next, according to the design drawings and relevant standards of the die casting, determine the surface type corresponding to each defect risk area, that is, determine whether the area is a functional surface or an appearance surface. For functional surfaces, if the predicted defect type is flow marks, abrasions or sintering, although such defects will affect the appearance of the die casting, they will not cause substantial damage to its structural performance, so further sampling and testing of such defect risk areas is not required. On the contrary, for appearance surfaces or risk areas with structural defects (such as cold shuts, cracks, etc.), detailed sampling and testing are required.

[0069] In this embodiment, under the premise of ensuring the structural performance of the die-casting, the inspection of the appearance defect area that does not affect the structural performance is reasonably eliminated, thereby realizing the optimization of the inspection work, which not only improves the inspection efficiency and reduces unnecessary inspection steps, but also avoids the increase in cost and waste of time caused by excessive inspection.

[0070] S200, using a preset defect image segmentation algorithm to perform background segmentation on the defect risk area image to obtain a plurality of first defect images;

[0071] In this embodiment, after acquiring an image containing a defect risk area, the image processing stage is entered, the color image is converted into a grayscale image, and the most common grayscale value in the grayscale image is found through histogram analysis as a preliminary estimate of the background. Then, the average grayscale value of the preset standard image (i.e., a normal image without defects) is used to correct this preliminary estimate to obtain a more accurate background grayscale value, select several starting points in the background, and use the flood filling algorithm to fill the background area. The flood filling algorithm will start from the selected starting point and diffuse along pixels with grayscale values ​​close to the background until a non-background area is encountered. In this way, the background and the defect area can be distinguished. Through a simple subtraction operation, the background is removed and the defect area is retained, thereby obtaining a clear first defect image.

[0072] S300, adding a plurality of defect images to a preset defect data set, wherein the defect data set includes a plurality of second defect images with labeled defect types, performing cluster analysis on the defect data set to obtain a plurality of classification clusters corresponding to different defect types, and determining defect type information corresponding to the first defect image based on the defect type of the classification cluster to which the first defect image belongs;

[0073] The first defect image obtained after processing each defect risk area image is added to the preset defect data set. The data set is a collection of second defect images containing a large number of labeled defect types. The second defect images have been manually labeled by the staff, identifying specific defect types, such as cold shut, flow mark, crack, etc. Further, the clustering algorithm in machine learning (such as K-means, DBSCAN or hierarchical clustering, etc.) is used to perform unsupervised learning on all defect images in the data set. The goal of clustering is to cluster images with similar visual features together to form different classification clusters. In the clustering process, the feature vector is first defined, usually including the color, texture, shape and other attributes of the image. For each second defect image, its feature vector is extracted and input into the clustering algorithm. The clustering algorithm will assign images to different clusters based on the similarity measure between feature vectors (such as Euclidean distance). Each cluster represents a specific type of defect. In order to ensure the quality of the classification cluster, a reasonable number of clusters needs to be set, which is usually determined by methods such as the Elbow Method or the Silhouette Coefficient.

[0074] After clustering is completed, the second defect images in each cluster are statistically analyzed to determine the most labeled defect type in each cluster. If the proportion of images of one defect type in a cluster to the total number of images is lower than the preset threshold (usually determined according to the customer's defect ratio requirements, such as 0.5%), it is considered that there is an abnormality in the classification cluster. This may be due to the clustering algorithm failing to correctly distinguish different defect types, or because some second defect images are incorrectly labeled. In this case, further processing will be stopped and the administrator will be prompted to check.

[0075] Based on the classification cluster to which the first defect image belongs, the defect type information corresponding to the image is determined. This means that if a first defect image is classified into a cluster that mainly contains cold shut defect types, then the image is considered to be a cold shut defect.

[0076] S400, integrating defect type information of different first defect images to obtain comprehensive defect information of the die casting.

[0077] According to the classification cluster to which the first defect image belongs, the defect type information corresponding to each defect image is determined. This information is summarized into a complete die casting defect report, which describes in detail the location, type and severity of all defects detected. This process makes the inspection efficient and accurate, and also facilitates the tracking and analysis of historical data, providing a basis for continuous improvement of the die casting process.

[0078] In this embodiment, CAE simulation is used to predict potential defect locations and perform targeted image acquisition, and image segmentation technology is used to remove background interference. Finally, hybrid clustering analysis is used to achieve accurate classification of defect types, thereby significantly improving the efficiency and accuracy of die-casting defect detection, reducing invalid detection, optimizing the detection process, and providing a reliable basis for quality control and production process improvement.

[0079] Preferably, the method of using a preset defect image segmentation algorithm to perform background segmentation on the defect risk area image to obtain a plurality of first defect images includes:

[0080] Grayscale processing is performed on the defect risk area image to obtain a grayscale image of the defect risk area;

[0081] Calibrate the grayscale image of the defect risk area based on the average grayscale value of the preset standard image of the corresponding area, and perform grayscale analysis on the calibrated grayscale image of the defect risk area to screen out the first grayscale value with the largest number of pixels;

[0082] Based on the first grayscale value, multiple starting filling points are set on the defect risk area image, and the pixels around the starting filling points are filled using a flood filling algorithm to obtain multiple sub-background images. The defect risk area image is subtracted from the sub-background images in turn to obtain multiple first defect images.

[0083] The defect risk area image is grayed, that is, the RGB three-channel color image is converted into a single-channel grayscale image. This process reduces the dimension of the image data, thereby reducing the amount of calculation and complexity of subsequent processing. The grayed image is called the defect risk area grayscale image. Then, the defect risk area grayscale image is calibrated based on the average grayscale value of the preset standard image of the corresponding area. The preset standard image is a reference image taken under standard conditions (such as constant lighting, fixed background, etc.). Its average grayscale value can be used to calibrate the actual collected image to reduce the impact of changes in on-site lighting conditions. By comparing the average grayscale value of the defect risk area grayscale image with the standard image, the brightness and contrast of the actual image are adjusted to make it close to the characteristics of the standard image.

[0084] Grayscale analysis is performed on the basis of the calibrated grayscale image of the defect risk area to screen out the first grayscale value with the largest number of pixels. This step is to find the most likely grayscale value of the background area in the image as a reference point for the subsequent filling algorithm. After the first grayscale value is selected, multiple pixels with grayscale values ​​within the positive and negative preset numerical range centered on the first grayscale value are randomly selected on the defect risk area image as the starting filling points. The flood filling algorithm is used to fill the pixels around the selected starting filling point, which can effectively separate the background area and obtain multiple sub-background images. The defect risk area image is sequentially subtracted from the sub-background image to obtain multiple first defect images. The pixel-level subtraction operation is used here, that is, the background pixel value at the corresponding position is subtracted from each pixel value of the original image, which can remove the background information and highlight the defect features.

[0085] In this embodiment, the image data is simplified through grayscale processing, the influence of illumination changes is reduced by using standard image calibration, and the background is effectively segmented by using a flood filling algorithm, so that a clear defect image is finally obtained, which significantly improves the accuracy and efficiency of defect detection while ensuring a high level of quality control.

[0086] Preferably, the method of setting a plurality of starting filling points on the defect risk area image based on the first gray value, and using a flood filling algorithm to fill pixels around the starting filling points to obtain a plurality of sub-background images includes:

[0087] A background grayscale interval is set based on the second grayscale, and a pixel point within the background grayscale interval is randomly selected on the defect risk area image as a starting filling point;

[0088] Using a flood filling algorithm, the pixel points around the starting filling point that meet the background grayscale interval are replaced with the first grayscale value;

[0089] If the number of pixels in the unreplaced background grayscale interval in the image is greater than a preset value, continue to select pixels in the remaining background grayscale interval as starting filling points until the number of unreplaced pixels is less than or equal to the preset value.

[0090] In this embodiment, a background grayscale interval is set based on the second grayscale value. The interval refers to a range centered on the second grayscale value, which is used to screen out pixels that may belong to the background area. The second grayscale value is obtained through preliminary grayscale analysis, that is, a grayscale value with the largest number of pixels in the grayscale image of the defect risk area. On this basis, a background grayscale interval is defined, such as ±10 grayscale units. Further, a pixel point located in the background grayscale interval is randomly selected on the defect risk area image as a starting filling point, and a flood filling algorithm is used to replace the first grayscale value of the pixels that meet the background grayscale interval around the selected starting filling point. It should be noted that the flood filling algorithm will check whether its neighboring pixels fall within the background grayscale interval. If the conditions are met, the grayscale values ​​of these pixels are replaced with the first grayscale value, and continue to diffuse to the surroundings until all pixels that meet the conditions are replaced. This process is similar to the "paint bucket" tool in painting software, but it is performed on a grayscale image and only replaces those pixel values ​​that fall within the preset background grayscale interval.

[0091] During the execution of the flood filling algorithm, it is constantly checked whether the number of pixels in the background grayscale interval that has not been replaced in the image is greater than the preset value. If it is greater than the preset value, it means that there are still many background pixels that have not been replaced. At this time, it is necessary to continue to randomly select pixels in the remaining background grayscale interval in the image as new starting filling points, and repeat the above filling process until the number of pixels in the background grayscale interval that has not been replaced in the image is less than or equal to the preset value. The preset value can be set according to the actual situation, for example, it can be set to a certain percentage of the total pixels of the image to ensure that most of the background area has been correctly identified and replaced.

[0092] In this embodiment, the accuracy of background segmentation is improved by selecting the background grayscale interval, and the situation where non-background areas are mistakenly identified as background is reduced. Furthermore, through the flood filling algorithm, efficient identification and replacement of background areas are achieved, and the speed and efficiency of image processing are improved. Further, through repeated inspections and supplementary filling, the effect of background segmentation is further improved, ensuring the integrity of the background area, and providing clearer and more accurate basic image data for the subsequent identification of defect types.

[0093] In summary, the method provided in this embodiment can at least achieve the following effects:

[0094] 1) The present invention predicts potential defect locations through CAE simulation and performs targeted image acquisition, combines image segmentation technology to remove background interference, and finally uses hybrid clustering analysis to achieve accurate classification of defect types, thereby significantly improving the efficiency and accuracy of die-casting defect detection, reducing invalid detection, optimizing the detection process, and providing a reliable basis for quality control and production process improvement.

[0095] 2) The present invention simplifies image data through grayscale processing, and uses standard image calibration to reduce the impact of illumination changes. The selection of background grayscale interval is combined to improve the accuracy of background segmentation and reduce the misidentification of non-background areas. The background area is efficiently identified and replaced by a flood filling algorithm, and finally a clear defect image is obtained. This not only significantly improves the accuracy and efficiency of defect detection and ensures a high level of quality control, but also further improves the background segmentation effect through repeated inspections and supplementary filling, providing clearer and more accurate basic image data for subsequent defect type identification.

[0096] 3) Under the premise of ensuring the structural performance of the die-casting, the present invention reasonably eliminates the detection of appearance defect areas that do not affect the structural performance, thereby optimizing the detection work, which not only improves the detection efficiency and reduces unnecessary detection steps, but also avoids the increase in costs and waste of time caused by excessive detection.

[0097] See also Figure 2 In one embodiment, a die casting defect detection device is also provided, the device comprising:

[0098] The defect risk area image acquisition module 100 is used to acquire a mold geometry model, predict multiple defect risk areas and corresponding defect types of the die casting based on the mold geometry model and using a CAE simulation algorithm, and sequentially perform image sampling on the defect risk areas to obtain multiple defect risk area images;

[0099] The defect image segmentation module 200 is used to perform background segmentation on the defect risk area image using a preset defect image segmentation algorithm to obtain a plurality of first defect images;

[0100] The defect recognition module 300 is used to add multiple defect images to a preset defect data set, wherein the defect data set includes multiple second defect images with labeled defect types, perform cluster analysis on the defect data set to obtain multiple classification clusters corresponding to different defect types, and determine defect type information corresponding to the first defect image based on the defect type of the classification cluster to which the first defect image belongs;

[0101] The defect integration module 400 is used to integrate the defect type information of different first defect images to obtain comprehensive defect information of the die casting.

[0102] Preferably, the defect image segmentation module 200 is further used for:

[0103] Grayscale processing is performed on the defect risk area image to obtain a grayscale image of the defect risk area;

[0104] Calibrate the grayscale image of the defect risk area based on the average grayscale value of the preset standard image of the corresponding area, and perform grayscale analysis on the calibrated grayscale image of the defect risk area to screen out the first grayscale value with the largest number of pixels;

[0105] Based on the first grayscale value, multiple starting filling points are set on the defect risk area image, and the pixels around the starting filling points are filled using a flood filling algorithm to obtain multiple sub-background images. The defect risk area image is subtracted from the sub-background images in turn to obtain multiple first defect images.

[0106] Preferably, the defect image segmentation module 200 is further used for:

[0107] A background grayscale interval is set based on the second grayscale, and a pixel point within the background grayscale interval is randomly selected on the defect risk area image as a starting filling point;

[0108] Using a flood filling algorithm, the pixel points around the starting filling point that meet the background grayscale interval are replaced with the first grayscale value;

[0109] If the number of pixels in the unreplaced background grayscale interval in the image is greater than a preset value, continue to select pixels in the remaining background grayscale interval as starting filling points until the number of unreplaced pixels is less than or equal to the preset value.

[0110] It can be understood that the functions or modules included in the device provided in this embodiment can be used to execute the method described in the above method embodiment. Its specific implementation can refer to the description of the above method embodiment. For the sake of brevity, it will not be repeated here.

[0111] The present invention also provides an electronic device, including a processor and a memory, wherein the memory is used to store computer program code, and the computer program code includes computer instructions. When the processor executes the computer instructions, the electronic device executes a method as described in any possible implementation manner.

[0112] The present invention also provides a computer-readable storage medium, in which a computer program is stored. The computer program includes program instructions. When the program instructions are executed by a processor of an electronic device, the processor executes a method as described in any possible implementation manner.

[0113] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.

[0114] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described devices, apparatuses and units can refer to the corresponding processes in the aforementioned method embodiments, and will not be repeated here. Those skilled in the art can also clearly understand that the descriptions of the various embodiments of the present invention have different focuses. For the convenience and brevity of description, the same or similar parts may not be repeated in different embodiments. Therefore, for parts not described or not described in detail in a certain embodiment, refer to the records of other embodiments.

Claims

1. A die casting defect detection method, characterized in that: The method comprises: Obtaining a mold geometry model, predicting multiple defect risk areas and corresponding defect types of the die casting based on the mold geometry model and using a CAE simulation algorithm, screening the defect risk areas, sampling images of the defect risk areas in turn, and obtaining multiple defect risk area images; Using a preset defect image segmentation algorithm to perform background segmentation on the defect risk area image to obtain a plurality of first defect images; Adding multiple defect images to a preset defect data set, the defect data set includes multiple second defect images with labeled defect types, performing cluster analysis on the defect data set to obtain multiple classification clusters corresponding to different defect types, and determining defect type information corresponding to the first defect image based on the defect type of the classification cluster to which the first defect image belongs; Integrate defect type information of different first defect images to obtain comprehensive defect information of die castings; The screening of defect risk areas includes: The surface type corresponding to the defect risk area is obtained, and the surface type includes a functional surface and an appearance surface. If the surface type of the defect risk area is a functional surface, and the defect type of the defect risk area is a flow mark, a scratch or sintering, the corresponding defect risk area is eliminated.

2. The die casting defect detection method according to claim 1, characterized in that: The method uses a preset defect image segmentation algorithm to perform background segmentation on the defect risk area image to obtain a plurality of first defect images, including: Grayscale processing is performed on the defect risk area image to obtain a grayscale image of the defect risk area; Calibrate the grayscale image of the defect risk area based on the average grayscale value of the preset standard image of the corresponding area, and perform grayscale analysis on the calibrated grayscale image of the defect risk area to screen out the first grayscale value with the largest number of pixels; Based on the first grayscale value, multiple starting filling points are set on the defect risk area image, and the pixels around the starting filling points are filled using a flood filling algorithm to obtain multiple sub-background images. The defect risk area image is subtracted from the sub-background images in turn to obtain multiple first defect images.

3. The die casting defect detection method according to claim 2, characterized in that: The method of setting a plurality of starting filling points on the defect risk area image based on the first gray value and using a flood filling algorithm to fill pixels around the starting filling points to obtain a plurality of sub-background images includes: A background grayscale interval is set based on the second grayscale, and a pixel point within the background grayscale interval is randomly selected on the defect risk area image as a starting filling point; Using a flood filling algorithm, the pixel points around the starting filling point that meet the background grayscale interval are replaced with the first grayscale value; If the number of pixels in the unreplaced background grayscale interval in the image is greater than a preset value, continue to select pixels in the remaining background grayscale interval as starting filling points until the number of unreplaced pixels is less than or equal to the preset value.

4. A die casting defect detection device, characterized in that: The device comprises: The defect risk area image acquisition module is used to obtain the mold geometry model, predict multiple defect risk areas and corresponding defect types of the die casting based on the mold geometry model and using the CAE simulation algorithm, screen the defect risk areas, and sample the images of the defect risk areas in turn to obtain multiple defect risk area images; A defect image segmentation module, used to perform background segmentation on the defect risk area image using a preset defect image segmentation algorithm to obtain a plurality of first defect images; a defect recognition module, configured to add a plurality of defect images to a preset defect data set, wherein the defect data set includes a plurality of second defect images with labeled defect types, perform cluster analysis on the defect data set to obtain a plurality of classification clusters corresponding to different defect types, and determine defect type information corresponding to the first defect image based on the defect type of the classification cluster to which the first defect image belongs; A defect integration module is used to integrate defect type information of different first defect images to obtain comprehensive defect information of the die casting; The screening of defect risk areas includes: The surface type corresponding to the defect risk area is obtained, and the surface type includes a functional surface and an appearance surface. If the surface type of the defect risk area is a functional surface, and the defect type of the defect risk area is a flow mark, a scratch or sintering, the corresponding defect risk area is eliminated.

5. The die casting defect detection device according to claim 4, characterized in that: The defect image segmentation module is also used for: Grayscale processing is performed on the defect risk area image to obtain a grayscale image of the defect risk area; Calibrate the grayscale image of the defect risk area based on the average grayscale value of the preset standard image of the corresponding area, and perform grayscale analysis on the calibrated grayscale image of the defect risk area to screen out the first grayscale value with the largest number of pixels; Based on the first grayscale value, multiple starting filling points are set on the defect risk area image, and the pixels around the starting filling points are filled using a flood filling algorithm to obtain multiple sub-background images. The defect risk area image is subtracted from the sub-background images in turn to obtain multiple first defect images.

6. The die casting defect detection device according to claim 5, characterized in that: The defect image segmentation module is also used for: A background grayscale interval is set based on the second grayscale, and a pixel point within the background grayscale interval is randomly selected on the defect risk area image as a starting filling point; Using a flood filling algorithm, the pixel points around the starting filling point that meet the background grayscale interval are replaced with the first grayscale value; If the number of pixels in the unreplaced background grayscale interval in the image is greater than a preset value, continue to select pixels in the remaining background grayscale interval as starting filling points until the number of unreplaced pixels is less than or equal to the preset value.

7. An electronic device, characterized in that: include: A processor and a memory, wherein the memory is used to store computer program codes, wherein the computer program codes include computer instructions, and when the processor executes the computer instructions, the electronic device executes the die casting defect detection method according to any one of claims 1 to 3.

8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein the computer program includes program instructions. When the program instructions are executed by a processor of an electronic device, the processor executes the die casting defect detection method according to any one of claims 1 to 3.

Citation Information

Cited By

  • Anti-peeling method based on high-compactness exhaust die punching technology

    CN120306468A