A method and device for detecting pores of a complex shape automobile die-casting product

By constructing a simulation diagram of the die casting parameter combination and an attention mechanism, and training a porosity recognition model, the problem of recognition caused by the distribution and feature differences of porosity in die castings was solved, and accurate recognition of porosity in die castings was achieved.

CN121280375BActive Publication Date: 2026-06-05HUIZHOU CAMEL DIE LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
HUIZHOU CAMEL DIE LTD
Filing Date
2025-10-09
Publication Date
2026-06-05

AI Technical Summary

Technical Problem

The distribution and characteristics of pores in existing die-cast parts vary, making it difficult to identify them uniformly and affecting the accuracy of pore identification.

Method used

By collecting a large number of images of porosity in die-cast parts, a simulation diagram with various combinations of die-casting parameters is constructed. An attention mechanism is introduced to train a porosity recognition model. By combining image registration and feature analysis, porosity feature vectors and saliency weights are obtained, and a final attention mechanism diagram is constructed to achieve accurate porosity recognition.

Benefits of technology

It enables accurate identification of the distribution and characteristic differences of pores in die castings, improving the accuracy and consistency of pore identification.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121280375B_ABST
    Figure CN121280375B_ABST
Patent Text Reader

Abstract

The application relates to the technical field of pattern recognition, and discloses a gas hole detection method and detection equipment for complex automobile die-casting products, which comprises the following steps: collecting a large number of die-casting gas hole images to obtain die-casting gas hole simulation images of various parameter combinations; obtaining possible gas hole areas in the die-casting gas hole simulation images of various parameter combinations to obtain to-be-analyzed areas; obtaining a plurality of analysis areas of the die-casting gas hole images and a plurality of gas hole feature vectors of the die-casting gas hole images; obtaining the significant influence weights of various die-casting parameters of each analysis area; obtaining the significant values of various die-casting parameters at various positions in the die-casting gas hole simulation images to obtain the attention base numerical values of various positions in each analysis area; obtaining the final attention mechanism diagrams of the die-casting gas hole images, and training a gas hole recognition model and performing gas hole monitoring on the automobile die-casting products. The application aims to solve the problem that the gas hole distribution and characteristics in the die-casting parts are different and difficult to be uniformly recognized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of graphic recognition technology, specifically to a method and equipment for detecting porosity in complex-shaped automotive die-cast products. Background Technology

[0002] Die casting is a manufacturing process that produces metal products with precise dimensions, specific shapes, smooth surfaces, or textures. It is achieved by injecting molten metal into a die casting mold under high speed and pressure. Compared to other casting processes, die casting has the highest filling speed and the highest filling pressure. The high-speed filling causes the molten metal to form a turbulent state in the die casting mold. However, because the gas inside the die casting mold cannot be eliminated in time during the die casting process, air and oxide inclusions from the die casting process are drawn into the die casting, resulting in defects such as porosity.

[0003] The formation of porosity is related to the die-casting conditions during the die-casting process, including pouring temperature, casting pressure, and high injection speed. Porosity formation is affected by various factors, resulting in significantly different characteristics of porosity in different locations within the die-casting part. For example, porosity located far from the gate is relatively smooth and shiny; porosity located at the "hot spot" (the thickest area of ​​the part where heat is most concentrated) is irregular and honeycomb-like. Therefore, the porosity characteristics of different areas of the die-casting part are different. In the subsequent porosity identification process, it is necessary to consider the die-casting conditions and the spatial distribution within the die-casting part. By using an attention mechanism, the porosity identification model can identify porosity in die-casting parts under different die-casting conditions, avoiding the reduction in porosity identification accuracy due to the influence of die-casting conditions on porosity distribution and characteristics. Summary of the Invention

[0004] This invention provides a method and equipment for detecting porosity in complex-shaped automotive die-cast products, to solve the problem that the distribution and characteristics of porosity in existing die-cast parts vary and are difficult to identify uniformly. The specific technical solution adopted is as follows:

[0005] This invention proposes a method for detecting porosity in complex-shaped automotive die-cast products, the method comprising the following steps:

[0006] A large number of images of porosity in die castings were collected. Based on the combination of different values ​​of various die casting parameters, simulation images of porosity in die castings with each parameter combination were obtained.

[0007] Binarization is performed on all simulation images of porosity in die castings to obtain possible porosity regions in the simulation images of porosity in die castings with various parameter combinations, thereby obtaining the region to be analyzed; by image registration between the simulation images of porosity in die castings and the porosity images of die castings, several analysis regions of porosity images of each die casting are obtained; combined with the porosity itself and its distribution in the analysis regions, several porosity feature vectors of each analysis region of porosity images of each die casting are obtained.

[0008] By analyzing the differences in porosity feature vectors in the same analysis region of porosity images of different die castings under the same die casting parameter variation, the degree of change of porosity features in each analysis region with each die casting parameter is obtained, and then the significance influence weight of each die casting parameter in each analysis region is obtained; based on the grayscale performance of porosity simulation image of die castings under the same die casting parameter variation, the significance value of each die casting parameter at each position in porosity simulation image of die castings is obtained, and combined with the significance influence weight, the basic attention value at each position in each analysis region is obtained;

[0009] Based on the similarity of the distribution of pores in the pore images of die castings and the pore simulation images of die castings, and combined with the differences in die casting parameters, the adjustment coefficients of each die casting pore image are obtained, and the final attention mechanism diagram of each die casting pore image is obtained. This is used to train a pore recognition model and to monitor the pores of automotive die casting products.

[0010] Optionally, the possible porosity regions in the simulation diagram of the porosity of the die-casting part for each parameter combination are obtained by the following method:

[0011] For any combination of parameters, the simulation image of the porosity of the die casting is obtained by using the Otsu threshold segmentation algorithm to obtain the segmentation threshold, and then a binary image of the simulation image of the porosity of the die casting is generated.

[0012] The regions formed by pixels with a value of 1 in the binary image of the porosity simulation diagram of the die casting are denoted as the possible porosity regions in the porosity simulation diagram of the die casting.

[0013] Optionally, the specific methods for obtaining the region to be analyzed include:

[0014] For each parameter combination, the simulation diagram of the porosity of the die casting is used to obtain several possible porosity regions. The union of the possible porosity regions of the simulation diagram of the die casting with all parameter combinations is obtained, and the regions corresponding to the union are used as several regions to be analyzed.

[0015] Optionally, the specific method for obtaining several porosity feature vectors in each analysis region of the porosity image of each die-cast part is as follows:

[0016] For any analysis region of the porosity image of any die casting, obtain the porosity distribution density in the analysis region as the porosity region density of each porosity in the analysis region; obtain the distance between the centers of any two porosities in the analysis region, and take the average distance between the centers of all any two porosities in the analysis region as the average porosity distance of each porosity in the analysis region.

[0017] The number of pixels within the convex hull of any pore in the analysis region, its circularity, mean gray value, maximum and minimum gray value, contrast, distance from the center of the analysis region, and the lengths of the major and minor axes of the ellipse with the same second-order central moment as the pore are obtained. These are combined with the pore region density and the average pore distance to construct the pore feature vector of the pore. The pore feature vectors of each pore in the analysis region are obtained in this way, serving as several pore feature vectors for the analysis region.

[0018] Optionally, the specific method for obtaining the degree of variation of the porosity characteristics of each analysis region with each die-casting parameter includes:

[0019] Using any one die casting parameter as the target parameter, extract several die casting porosity images from all die casting porosity images where the target parameter value is different but the values ​​of other die casting parameters are the same, and use these as several porosity analysis images with the target parameter.

[0020] All stomatal analysis images are arranged in ascending order of the corresponding target parameter values. For any analysis region, a stomatal feature vector is extracted from any two adjacent stomatal analysis images and cosine similarity is calculated to obtain several cosine similarities corresponding to the analysis region in the two adjacent stomatal analysis images. The ratio of the absolute value of the difference between the maximum value of all cosine similarities and the target parameter values ​​corresponding to the two adjacent stomatal analysis images is used as the change coefficient of the target parameter of the two adjacent stomatal analysis images under the analysis region.

[0021] The average of the variation coefficients of the target parameters of all two adjacent stomatal analysis images in the analysis area is taken as the degree of change of the stomatal features of the analysis area with the target parameters.

[0022] Optionally, the significance weights of each die-casting parameter in each analysis region are obtained using the following method:

[0023] The porosity characteristics of any analysis region are obtained as a function of each die-casting parameter. All variations are linearly normalized, and the results are used as the weights of the significance of each die-casting parameter in the analysis region.

[0024] Optionally, the significance values ​​of each die-casting parameter at each position in the simulation diagram of porosity in the die-casting part are obtained using the following method:

[0025] In the porosity simulation diagrams of die castings with all parameter combinations, extract several porosity simulation diagrams of die castings with different target parameter values ​​but the same values ​​of other die casting parameters, and use them as several porosity analysis simulation diagrams of the target parameter.

[0026] For any position, the corresponding gray value in all porosity analysis simulation diagrams is linearly normalized for the target parameter values ​​under all parameter combinations. The result is used as several processed values ​​of the target parameter. The ratio of the gray value of the position in any porosity analysis simulation diagram to the processed value of the target parameter corresponding to that porosity analysis simulation diagram is calculated and used as the significance factor of the position in that porosity analysis simulation diagram.

[0027] The mean of the significance factors of this location in all porosity analysis simulation diagrams is used as the significance value of this location in the porosity simulation diagram of the die casting as the target parameter.

[0028] Optionally, the specific method for obtaining the basic attention values ​​at each location in each analysis region includes:

[0029] Obtain the significance value of each die casting parameter at any position in the porosity simulation image of the die casting, and obtain the analysis region to which that position belongs in the porosity image of the die casting. Use the significance influence weight of each die casting parameter in the corresponding analysis region to perform a weighted average of the significance values ​​of each die casting parameter at that position in the porosity simulation image of the die casting. The result is used as the basic attention value for that position in the corresponding analysis region.

[0030] Optionally, the specific method for obtaining the adjustment coefficients of the porosity images of each die casting and obtaining the final attention mechanism diagram of the porosity images of each die casting includes:

[0031] For any die-cast part porosity image, obtain the regions corresponding to several marked pores in the die-cast part porosity image to obtain several porosity regions of the die-cast part porosity image. For any die-cast part porosity simulation image, obtain the pixel points contained in all porosity regions of the die-cast part porosity image and the intersection-union ratio of the pixel points contained in all possible porosity regions of the die-cast part porosity simulation image, and use it as the porosity matching degree between the die-cast part porosity image and the die-cast part porosity simulation image. The die-cast part porosity simulation image with the largest porosity matching degree with the die-cast part porosity image is used as the reference porosity simulation image of the die-cast part porosity image.

[0032] The processed values ​​of each die casting parameter corresponding to the porosity image of the die casting are obtained, as well as the processed values ​​of each die casting parameter in the parameter combination corresponding to the reference porosity simulation image. The absolute value of the difference between the processed values ​​of the same die casting parameter in the porosity image of the die casting and the reference porosity simulation image is calculated. The mean of the absolute values ​​of the differences corresponding to each die casting parameter is used as the adjustment coefficient of the porosity image of the die casting.

[0033] The product of the basic attention value at each position in each analysis region and the adjustment coefficient is used as the final attention value at each position in each analysis region of the porosity image of the die casting, thus forming the final attention mechanism diagram of the porosity image of the die casting.

[0034] The present invention also proposes a porosity detection device for complex-shaped automotive die-cast products. The device includes a product positioning module, an image acquisition module, a data analysis module, and a display and recognition module. The data analysis module includes a memory, a processor, and a computer program stored in the memory and running on the processor. When the processor executes the computer program, it implements the steps of the above method.

[0035] The beneficial effects of this invention are as follows: This invention analyzes a large number of historical images of porosity in die castings and constructs simulation images of porosity in die castings with multiple parameter combinations. An attention mechanism is introduced during the training of the porosity recognition model to fully consider the influence of changes in die casting parameters corresponding to the porosity images on porosity generation. This allows the porosity recognition model to more accurately identify differences in porosity distribution and characteristics in die castings. Specifically, binarization processing is performed on the simulation images of porosity in die castings to extract potential porosity regions, i.e., regions with a high probability of porosity defects. Further image registration is used to obtain the analysis region in each die casting porosity image, and the analysis region is then analyzed. Morphological analysis of pores is performed to quantify pore feature vectors. Then, the changes in pore feature vectors under variations in a single die-casting parameter are analyzed to obtain the influence weight of a single die-casting parameter on pore morphology. Further, the pore morphology changes between the simulation image of the die-cast part and the single die-casting parameter are considered to obtain the basic attention values ​​applicable to each position of the pore image of each die-cast part. By analyzing the impact of differences in die-casting parameters on pore distributions similar to those in the simulation image of the die-cast part, adjustment coefficients are obtained, and the final attention intelligence map is acquired. This completes the construction and training of the pore recognition model, ultimately realizing pore detection in automotive die-cast products. Attached Figure Description

[0036] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0037] Figure 1 A schematic flowchart of a method for detecting porosity in a complex-shaped automotive die-cast product provided in an embodiment of the present invention;

[0038] Figure 2 This is an example diagram showing the porosity of a die-cast part. Detailed Implementation

[0039] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0040] Please see Figure 1 The diagram illustrates a flowchart of a method for detecting porosity in complex-shaped automotive die-cast products according to an embodiment of the present invention. The method includes the following steps:

[0041] Step S001: Collect a large number of images of porosity in die castings, and obtain simulation images of porosity in die castings based on combinations of different values ​​of various die casting parameters.

[0042] The purpose of this embodiment is to construct a porosity recognition model by using a large number of porosity images of die castings and several porosity simulation images of die castings under various combinations of different die casting parameters (grayscale images obtained based on the probability of porosity occurrence). An attention mechanism is introduced to avoid the impact of differences in porosity distribution and features in die castings on recognition accuracy.

[0043] Specifically, the product positioning module limits the positioning of automotive die-cast products in different postures on the die-casting production line, facilitating image acquisition by the image acquisition module. The image acquisition module includes a high-resolution industrial camera, camera bracket, camera data transmission cable, and fixed light source to acquire surface images of the die-cast products. The data analysis module contains a large number of historically acquired surface images of die-cast parts, with pores marked by professionals. These images serve as a large database of pore images for further data analysis to obtain a final pore recognition model. This pore recognition model is then used by the display module to detect and display the pores in the automotive die-cast products in real time. Figure 2 As shown, the pores on the surface of the die-cast part are marked by circles.

[0044] Furthermore, to analyze the influence of different die-casting parameters on porosity and spatial distribution, the AnyCasting casting simulation software system, used in the die-casting mold design process, was employed. Different simulation data were generated by setting different die-casting parameters. These parameters included material, insert, casting temperature, weight, mold material, mold temperature, punch diameter, punch low-speed / high-speed, cake thickness, and vacuum pressure. All die-casting parameters were expressed numerically. The AnyCasting casting simulation software system was used to generate oxide content cloud maps and air pressure cloud maps for the current die-casting mold. Based on the formula of the combined defect parameter method: ,in This represents an empirical constant, determined by fitting a large amount of experimental data to specific materials and welding processes. This will not be elaborated further in this embodiment. and The formulas for the combined defect parameter method, which correspond to oxide content and air pressure respectively, are existing technologies in the corresponding field and will not be elaborated in this embodiment. Thus, the porosity probability of each position of the die casting mold under different values ​​of various die casting parameters is obtained. That is, a set of parameter combinations (a combination of values ​​of various die casting parameters) corresponds to a set of porosity probabilities of each position of the die casting mold. The porosity probabilities of each position under all parameter combinations are linearly normalized, and the result is used as the porosity probability of each position under each parameter combination. For any parameter combination, the porosity probability of each position under the parameter combination is multiplied by the upper limit of the gray value range (255), and the product is used as the gray value of the corresponding position. The image constructed in this way is used as the porosity simulation image of the die casting part of the parameter combination. The porosity simulation image of the die casting part of each parameter combination is obtained according to the above method.

[0045] It should be noted that the formation of porosity is related to the die-casting conditions during the die-casting process, including pouring temperature, casting pressure, and injection speed. Studies have shown that as the pouring temperature increases, the porosity of the casting gradually decreases; as the casting pressure increases, the porosity of the casting also gradually decreases; and as the injection speed increases, the porosity shows a trend of first increasing and then decreasing (Hao Mengyao, "Study on the Influence of Vacuum Die Casting and Heat Treatment on Porosity Defects and Casting Performance"). Therefore, the formation of porosity is affected by a variety of factors, resulting in significant differences in the characteristics of porosity generated in different locations within the die-casting part. For example, porosity located far from the gate is relatively smooth and shiny; porosity located at the "hot spot" (the thickest part with the most concentrated heat) is irregular and honeycomb-like.

[0046] Step S002: Binarize all the simulation images of porosity in the die castings to obtain the possible porosity regions in the simulation images of porosity in the die castings with each parameter combination, and then obtain the region to be analyzed; by image registration between the simulation images of porosity in the die castings and the porosity images of the die castings, obtain several analysis regions of the porosity images of each die casting; and by combining the porosity itself and its distribution in the analysis regions, obtain several porosity feature vectors of each analysis region of the porosity images of each die casting.

[0047] It should be noted that the simulation image of the porosity of the die casting reflects the probability of porosity at the corresponding position under each parameter combination. The simulation image is constructed by multiplying it by the upper limit of the gray value range (255). Then, by performing binarization on the simulation image, the possible porosity region is extracted from the binary image, that is, the region formed by the position where the probability of porosity is high. The region to be analyzed is obtained by union, which provides the basis for the registration and extraction of the analysis region in the subsequent porosity image of the die casting.

[0048] Preferably, in one embodiment of the present invention, the porosity simulation images of all die-cast parts are binarized to obtain the possible porosity regions in the porosity simulation images of die-cast parts with each parameter combination, thereby obtaining the region to be analyzed. The specific method includes:

[0049] For any combination of parameters corresponding to the simulation image of porosity in a die casting, the gray value of each pixel in the simulation image is actually the gray value obtained based on the probability of porosity occurrence at the corresponding position of each pixel in the simulation result. Then, the Otsu threshold segmentation algorithm is used to obtain the segmentation threshold of the simulation image of porosity in the die casting, and then a binary image of the simulation image of porosity in the die casting is generated. In the binary image, the gray value of the pixel with a pixel value of 1 is greater than or equal to the segmentation threshold, and the gray value of the pixel with a pixel value of 0 is less than the segmentation threshold. The several regions formed by the pixels with a pixel value of 1 in the binary image of the simulation image of porosity in the die casting are recorded as the possible porosity regions in the simulation image of porosity in the die casting.

[0050] Furthermore, for each parameter combination, several possible porosity regions are obtained from the simulation image of the porosity of the die casting. Since the pixels at the same position in the simulation image of the porosity of the die casting actually correspond, the union of the possible porosity regions in the simulation images of the porosity of the die casting with all parameter combinations is obtained. Several regions corresponding to the union are used as several regions to be analyzed. In the subsequent analysis, these regions are registered with a large number of porosity images of the die casting to obtain the analysis regions.

[0051] It should be further noted that a large number of images of pores in die castings are used as the training dataset for the pore recognition model. Considering the adjustment through the attention mechanism, it is necessary to obtain the corresponding analysis area based on the pore simulation image of the die casting. That is, the probability of bubble defects occurring in the analysis area is relatively high under different parameter combinations. On this basis, further pore feature analysis is carried out based on the pore images of die castings.

[0052] Preferably, in one embodiment of the present invention, by image registration of the simulation image of the porosity of the die casting and the porosity image of the die casting, several analysis regions of the porosity image of each die casting are obtained. Combining the porosity itself and its distribution within the analysis regions, several porosity feature vectors of each analysis region of the porosity image of each die casting are obtained. The specific method includes:

[0053] For any image of porosity in a die casting, this embodiment uses a feature-point-based image registration method to register it with a simulation image of porosity in the die casting (the overall position distribution of porosity in the simulation image of the die casting is the same and is not affected by changes in parameter combinations). Based on several regions to be analyzed in the simulation image of porosity in the die casting, the corresponding regions of the porosity image of the die casting are extracted to obtain several analysis regions of the porosity image of the die casting.

[0054] Furthermore, for any analysis region of the porosity image of the die-cast part, several pores in the analysis region have been marked. The distribution density of the pores in the analysis region is obtained as the porosity region density of each pore in the analysis region; the distance between the centers of any two pores in the analysis region is obtained, and the average distance between the centers of all any two pores in the analysis region is used as the average distance of each pore in the analysis region; the number of pixels within the convex hull of any pore in the analysis region (convex hull is a prior art), roundness, average grayscale value, maximum and minimum grayscale value (obtained based on the grayscale values ​​of the pixels within the pore), contrast, and distance from the center of the analysis region are obtained, as well as... The major and minor axes of an ellipse having the same second-order central moment as the stoma, combined with the stomatal region density and average stomatal distance, constitute the stomatal feature vector. It should be noted that in the stomatal feature vectors of different pores within the same analytical region, the values ​​of the stomatal region density and average stomatal distance are the same, and the dimensions at the same position in different stomatal feature vectors are also the same. This allows us to obtain the stomatal feature vectors for each pore in the analytical region, thus obtaining several stomatal feature vectors for the analytical region. Specifically, if there are no pores in the analytical region, the stomatal feature vector for that region is set to a zero vector, meaning that the values ​​of all dimensions in the corresponding stomatal feature vector are 0.

[0055] Thus, several analysis regions and several porosity feature vectors in the porosity image of the die-cast part were obtained.

[0056] Step S003: Analyze the differences in porosity feature vectors in the same analysis region of porosity images of different die castings under the same die casting parameter variation, obtain the degree of change of porosity features in each analysis region with each die casting parameter, and then obtain the significance influence weight of each die casting parameter in each analysis region; based on the grayscale performance in the porosity simulation image of the die casting under the same die casting parameter variation, obtain the significance value of each die casting parameter at each position in the porosity simulation image of the die casting, and combine it with the significance influence weight to obtain the basic attention value of each position in each analysis region.

[0057] It should be noted that among a large number of historical images of porosity in die castings, there are several images of porosity in die castings where one die casting parameter changes while other die casting parameters remain unchanged. By analyzing the changes in the porosity feature vectors in the analysis regions, the impact of this die casting parameter change on porosity features is analyzed, thereby quantifying the significance weight of each die casting parameter in the analysis region. Since the calculation is based on several porosity feature vectors in the analysis region, and the analysis regions in porosity images of different die castings contain the same pixel positions, it is necessary to perform a difference analysis on the porosity feature vectors in the porosity images of die castings in each analysis region under the corresponding die casting parameter changes.

[0058] Preferably, in one embodiment of the present invention, the differences in porosity feature vectors in the same analysis region of porosity images of different die castings under the same die casting parameter variation are analyzed to obtain the degree of change of porosity features in each analysis region with each die casting parameter, and then the significance influence weight of each die casting parameter in each analysis region is obtained. The specific method includes:

[0059] Using any die-casting parameter as the target parameter, extract several die-casting porosity images from all die-casting porosity images where the target parameter value is different but other die-casting parameter values ​​are the same. These are then used as porosity analysis images for the target parameter. All porosity analysis images are arranged in ascending order of the corresponding target parameter value. Since the pixel positions within the analysis regions of each die-casting porosity image are the same, taking any analysis region as an example, extract any porosity feature vector from any two adjacent porosity analysis images and calculate its cosine similarity. This yields several cosine similarities corresponding to the analysis region in the two adjacent porosity analysis images. The ratio of the absolute value of the difference between the maximum value of all cosine similarities and the target parameter value corresponding to the two adjacent porosity analysis images is used as the variation coefficient of the target parameter in the two adjacent porosity analysis images under that analysis region. The mean of the variation coefficients of the target parameter in all two adjacent porosity analysis images under that analysis region is used as the degree of change of the porosity features in the analysis region with the target parameter.

[0060] Furthermore, the porosity characteristics of the analysis area are obtained according to the above method, and the degree of variation of each die casting parameter is linearly normalized. The result is used as the significance weight of each die casting parameter in the analysis area.

[0061] It should be further explained that the positions in the simulation diagram of porosity in die castings reflect the probability of porosity. Therefore, based on the significance influence weight, we analyze the grayscale performance of each position in the simulation diagram of porosity in die castings when one die casting parameter changes while other die casting parameters remain unchanged. This comprehensively reflects the influence of the die casting parameter on that position, thereby obtaining the significance value of the die casting parameter for each position. Combined with the significance influence weight, we weight the significance values ​​of all die casting parameters to construct the basic value of attention.

[0062] Preferably, in one embodiment of the present invention, based on the grayscale performance of the porosity simulation image of the die casting under the same die casting parameter variation, the significance value of each die casting parameter at each position in the porosity simulation image of the die casting is obtained. Combined with the significance influence weight, the basic attention value at each position in each analysis region is obtained. The specific method includes:

[0063] In the porosity simulation images of die-cast parts with all parameter combinations, extract several porosity simulation images of die-cast parts with different target parameter values ​​but the same values ​​of other die-casting parameters, and use them as several porosity analysis simulation images of the target parameter. For the gray value corresponding to any position in all porosity analysis simulation images, perform linear normalization on the value of the target parameter under all parameter combinations, and use the result as several processed values ​​of the target parameter. Calculate the ratio of the gray value of that position in any porosity analysis simulation image to the processed value of the target parameter corresponding to that porosity analysis simulation image (to avoid the denominator being 0 and the ratio being meaningless, add a hyperparameter of 0.01 to both the denominator and numerator for calculation), and use it as the significance factor of that position in that porosity analysis simulation image. The mean of the significance factors of that position in all porosity analysis simulation images is used as the significance value of the target parameter at that position in the die-cast part porosity simulation image.

[0064] Furthermore, following the method described above, the significance value of each die-casting parameter at that location in the simulation image of the die-casting porosity is obtained. The analysis region to which this location belongs in the die-casting porosity image is then obtained as the corresponding analysis region. Using the significance influence weight of each die-casting parameter in the corresponding analysis region, the significance value of each die-casting parameter at that location in the simulation image of the die-casting porosity is weighted and averaged. The result is used as the attention basis value for that location in the corresponding analysis region. It should be noted that if the location does not belong to any analysis region, the significance influence weight of each die-casting parameter is set to 0, and the corresponding attention basis value is also 0. Although the location exists in the die-casting porosity image, it does not belong to any analysis region. Therefore, the attention basis values ​​for each location in each analysis region are obtained according to the method described above. The attention basis values ​​for other locations in the die-casting porosity image, except for the analysis regions, are all 0.

[0065] Thus, the basic attention values ​​for each location in each analysis region of the porosity image of the die-cast part are obtained.

[0066] Step S004: Based on the similarity of the distribution of pores in the pore image of the die casting and the pore simulation image of the die casting, and combined with the differences in die casting parameters, obtain the adjustment coefficient of each pore image of the die casting, and obtain the final attention mechanism diagram of each pore image of the die casting, thereby training the pore recognition model and performing pore monitoring of automotive die casting products.

[0067] It should be noted that after introducing the attention mechanism to obtain the basic attention value, it is necessary to further consider the impact of the difference in die casting parameters when the porosity distribution of the die casting porosity image and the die casting porosity simulation image are similar. In this way, adjustment coefficients are obtained, and the final attention value is obtained on the basis of the basic attention value, so as to obtain the final attention mechanism map for training the porosity recognition model.

[0068] Specifically, for any die-cast part porosity image, the regions corresponding to several marked pores in the die-cast part porosity image are obtained, resulting in several porosity regions of the die-cast part porosity image. For any die-cast part porosity simulation image, the intersection-union ratio (IUGR) of the pixels contained in all porosity regions of the die-cast part porosity image and the pixels contained in all possible porosity regions of the die-cast part porosity simulation image (IUGR is calculated after image registration) is used as the porosity matching degree between the die-cast part porosity image and the die-cast part porosity simulation image. The die-cast part porosity simulation image with the highest porosity matching degree is used as the reference porosity simulation image of the die-cast part porosity image. The processed values ​​of each die-casting parameter corresponding to the porosity image of the die-cast part (all values ​​of the same die-casting parameter are linearly normalized), and the processed values ​​of each die-casting parameter in the parameter combination corresponding to the reference porosity simulation image, are used to calculate the absolute value of the difference between the processed values ​​of the same die-casting parameter in the porosity image of the die-cast part and the reference porosity simulation image. The mean of the absolute values ​​of the differences corresponding to each die-casting parameter is used as the adjustment coefficient of the porosity image of the die-cast part. The product of the basic attention value of each position in each analysis region and the adjustment coefficient is used as the final attention value of each position in each analysis region of the porosity image of the die-cast part, thus constituting the final attention mechanism diagram of the porosity image of the die-cast part.

[0069] Furthermore, a porosity recognition model is constructed using a neural network. A large number of porosity images from die-cast parts are used as the training dataset, with each porosity image corresponding to a final attention mechanism map. During training, the final attention mechanism map is upsampled or downsampled to the same spatial size as the current feature layer (the convolution process during neural network training changes the image size in the training dataset). Then, the final attention mechanism map is element-wise multiplied with the feature map, equivalent to using a soft mask. The Mask algorithm weights each spatial location of the feature map and inputs the weighted feature map into subsequent network layers for training. This process trains the porosity recognition model using a large number of images of porosity in die-cast parts, resulting in a trained porosity recognition model. In the porosity detection process of automotive die-cast products, the product positioning module and image acquisition module acquire images of the die-cast part surface and input them into the porosity recognition model. The porosity recognition model is the result of analysis of a large number of die-cast part porosity images and a simulation image of die-cast part porosity with several parameter combinations in the data analysis module. It is used as a display recognition module to identify and detect porosity on the surface images of die-cast parts.

[0070] This concludes the embodiment.

[0071] Another embodiment of the present invention provides a porosity detection device for complex-shaped automotive die-cast products. The device includes a product positioning module, an image acquisition module, a data analysis module, and a display and recognition module. The data analysis module includes a memory, a processor, and a computer program stored in the memory and running on the processor. When the processor executes the computer program, it implements the above-described method steps S001 to S004.

[0072] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the principles of the present invention should be included within the protection scope of the present invention.

Claims

1. A method for detecting porosity in complex-shaped automotive die-cast products, characterized in that, The method includes the following steps: A large number of images of porosity in die castings were collected. Based on the combination of different values ​​of various die casting parameters, simulation images of porosity in die castings with each parameter combination were obtained. Binarization is performed on all simulation images of porosity in die castings to obtain possible porosity regions in the simulation images of porosity in die castings with various parameter combinations, thereby obtaining the region to be analyzed; by image registration between the simulation images of porosity in die castings and the porosity images of die castings, several analysis regions of porosity images of each die casting are obtained; combined with the porosity itself and its distribution in the analysis regions, several porosity feature vectors of each analysis region of porosity images of each die casting are obtained. By analyzing the differences in porosity feature vectors in the same analysis region of porosity images of different die castings under the same die casting parameter variation, the degree of change of porosity features in each analysis region with each die casting parameter is obtained, and then the significance influence weight of each die casting parameter in each analysis region is obtained; based on the grayscale performance of porosity simulation image of die castings under the same die casting parameter variation, the significance value of each die casting parameter at each position in porosity simulation image of die castings is obtained, and combined with the significance influence weight, the basic attention value at each position in each analysis region is obtained; Based on the similarity of the distribution of pores in the pore images of die castings and the pore simulation images of die castings, and combined with the differences in die casting parameters, the adjustment coefficients of each die casting pore image are obtained, and the final attention mechanism diagram of each die casting pore image is obtained. This is used to train a pore recognition model and to monitor the pores of automotive die casting products.

2. The method for detecting porosity in complex-shaped automotive die-cast products according to claim 1, characterized in that, The specific method for obtaining the possible porosity regions in the simulation diagram of the porosity of the die-casting part for each parameter combination is as follows: For any combination of parameters, the simulation image of the porosity of the die casting is obtained by using the Otsu threshold segmentation algorithm to obtain the segmentation threshold, and then a binary image of the simulation image of the porosity of the die casting is generated. The regions formed by pixels with a value of 1 in the binary image of the porosity simulation diagram of the die casting are denoted as the possible porosity regions in the porosity simulation diagram of the die casting.

3. The method for detecting porosity in complex-shaped automotive die-cast products according to claim 1, characterized in that, The specific methods for obtaining the region to be analyzed are as follows: For each parameter combination, the simulation diagram of the porosity of the die casting is used to obtain several possible porosity regions. The union of the possible porosity regions of the simulation diagram of the die casting with all parameter combinations is obtained, and the regions corresponding to the union are used as several regions to be analyzed.

4. The method for detecting porosity in complex-shaped automotive die-cast products according to claim 1, characterized in that, The specific method for obtaining several porosity feature vectors in each analysis region of the porosity image of each die casting is as follows: For any analysis region of the porosity image of any die casting, obtain the porosity distribution density in the analysis region as the porosity region density of each porosity in the analysis region; obtain the distance between the centers of any two porosities in the analysis region, and take the average distance between the centers of all any two porosities in the analysis region as the average porosity distance of each porosity in the analysis region. The number of pixels within the convex hull of any pore in the analysis region, its circularity, mean gray value, maximum and minimum gray value, contrast, distance from the center of the analysis region, and the lengths of the major and minor axes of the ellipse with the same second-order central moment as the pore are obtained. These are combined with the pore region density and the average pore distance to construct the pore feature vector of the pore. The pore feature vectors of each pore in the analysis region are obtained in this way, serving as several pore feature vectors for the analysis region.

5. The method for detecting porosity in complex-shaped automotive die-cast products according to claim 1, characterized in that, The specific methods for obtaining the degree of variation of the porosity characteristics of each analysis region with each die-casting parameter are as follows: Using any one die casting parameter as the target parameter, extract several die casting porosity images from all die casting porosity images where the target parameter value is different but the values ​​of other die casting parameters are the same, and use these as several porosity analysis images with the target parameter. All stomatal analysis images are arranged in ascending order of the corresponding target parameter values. For any analysis region, a stomatal feature vector is extracted from any two adjacent stomatal analysis images and cosine similarity is calculated to obtain several cosine similarities corresponding to the analysis region in the two adjacent stomatal analysis images. The ratio of the absolute value of the difference between the maximum value of all cosine similarities and the target parameter values ​​corresponding to the two adjacent stomatal analysis images is used as the change coefficient of the target parameter of the two adjacent stomatal analysis images under the analysis region. The average of the variation coefficients of the target parameters of all two adjacent stomatal analysis images in the analysis area is taken as the degree of change of the stomatal features of the analysis area with the target parameters.

6. The method for detecting porosity in complex-shaped automotive die-cast products according to claim 5, characterized in that, The significance weights of each die-casting parameter in each analysis region are obtained using the following method: The porosity characteristics of any analysis region are obtained as a function of each die-casting parameter. All variations are linearly normalized, and the results are used as the weights of the significance of each die-casting parameter in the analysis region.

7. The method for detecting porosity in complex-shaped automotive die-cast products according to claim 5, characterized in that, The significance values ​​of each die-casting parameter at each position in the simulation diagram of porosity in the die-casting part are obtained using the following method: In the porosity simulation diagrams of die castings with all parameter combinations, extract several porosity simulation diagrams of die castings with different target parameter values ​​but the same values ​​of other die casting parameters, and use them as several porosity analysis simulation diagrams of the target parameter. For any position, the corresponding gray value in all porosity analysis simulation diagrams is linearly normalized for the target parameter values ​​under all parameter combinations. The result is used as several processed values ​​of the target parameter. The ratio of the gray value of the position in any porosity analysis simulation diagram to the processed value of the target parameter corresponding to that porosity analysis simulation diagram is calculated and used as the significance factor of the position in that porosity analysis simulation diagram. The mean of the significance factors of this location in all porosity analysis simulation diagrams is used as the significance value of this location in the porosity simulation diagram of the die casting as the target parameter.

8. The method for detecting porosity in complex-shaped automotive die-cast products according to claim 7, characterized in that, The specific methods for obtaining the basic attention values ​​at each location in each analysis region include: Obtain the significance value of each die casting parameter at any position in the porosity simulation image of the die casting, and obtain the analysis region to which that position belongs in the porosity image of the die casting. Use the significance influence weight of each die casting parameter in the corresponding analysis region to perform a weighted average of the significance values ​​of each die casting parameter at that position in the porosity simulation image of the die casting. The result is used as the basic attention value for that position in the corresponding analysis region.

9. The method for detecting porosity in complex-shaped automotive die-cast products according to claim 7, characterized in that, The specific method for obtaining the adjustment coefficients of the porosity images of each die casting and obtaining the final attention mechanism diagram of the porosity images of each die casting includes: For any die-cast part porosity image, obtain the regions corresponding to several marked pores in the die-cast part porosity image to obtain several porosity regions of the die-cast part porosity image. For any die-cast part porosity simulation image, obtain the pixel points contained in all porosity regions of the die-cast part porosity image and the intersection-union ratio of the pixel points contained in all possible porosity regions of the die-cast part porosity simulation image, and use it as the porosity matching degree between the die-cast part porosity image and the die-cast part porosity simulation image. The die-cast part porosity simulation image with the largest porosity matching degree with the die-cast part porosity image is used as the reference porosity simulation image of the die-cast part porosity image. The processed values ​​of each die casting parameter corresponding to the porosity image of the die casting are obtained, as well as the processed values ​​of each die casting parameter in the parameter combination corresponding to the reference porosity simulation image. The absolute value of the difference between the processed values ​​of the same die casting parameter in the porosity image of the die casting and the reference porosity simulation image is calculated. The mean of the absolute values ​​of the differences corresponding to each die casting parameter is used as the adjustment coefficient of the porosity image of the die casting. The product of the basic attention value at each position in each analysis region and the adjustment coefficient is used as the final attention value at each position in each analysis region of the porosity image of the die casting, thus forming the final attention mechanism diagram of the porosity image of the die casting.

10. A porosity detection device for complex-shaped automotive die-cast products, the device comprising a product positioning module, an image acquisition module, a data analysis module, and a display and recognition module, wherein the data analysis module comprises a memory, a processor, and a computer program stored in the memory and running on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the porosity detection method for complex-shaped automotive die-cast products as described in any one of claims 1-9.