Method and device for counting the number of inclusions

By constructing an improved BP neural network statistical model, combining CT scanning and image processing technology, the problem of large statistical errors in the quantity of MnS inclusions in easy-to-cut steel is solved, and high-precision inclusions statistics are achieved, ensuring the accurate evaluation of the quality of easy-to-cut steel products.

CN120355702BActive Publication Date: 2025-08-29NORTH CHINA UNIVERSITY OF SCIENCE AND TECHNOLOGY +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510819967.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-06-19
Publication Date
2025-08-29
Estimated Expiration
2045-06-19

AI Technical Summary

Technical Problem

In the prior art, there are large detection and statistical errors in the quantity statistics of MnS inclusions in easy-to-cut steel, which cannot be accurately obtained, resulting in the inability to correctly evaluate the quality of easy-to-cut steel products.

Method used

By constructing a statistical model based on the improved BP neural network, the real number, area proportion, average area, average perimeter, average spherical degree and apparent number of manganese sulfide inclusions in multiple two-dimensional sectional images of the training sample was established, and combined with CT scanning and image processing technology, the number of manganese sulfide inclusions to be counted is accurately counted.

Benefits of technology

High-precision statistics on the number of manganese sulfide inclusions in easy-to-cut steel are achieved, which can accurately evaluate the quality of easy-to-cut steel, and improve the accuracy and efficiency of statistics.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120355702B_ABST
    Figure CN120355702B_ABST
Patent Text Reader

Abstract

The present application discloses a method and a statistical device for counting the number of inclusions, which are applied to counting manganese sulfide inclusions in free-cutting steel. The statistical method comprises: obtaining a first true number, a first area ratio, a first average area, a first average perimeter, a first average sphericity, and a first apparent number of manganese sulfide inclusions in multiple two-dimensional cross-sectional images of a training sample; constructing a statistical model based on the first true number, the first area ratio, the first average area, the first average perimeter, the first average sphericity, and the first apparent number; obtaining a second area ratio, a second average area, a second average perimeter, a second average sphericity, and a second apparent number of manganese sulfide inclusions in a metallographic image of a sample to be counted, and substituting these into the statistical model to obtain the number of manganese sulfide inclusions in the sample to be counted as output by the statistical model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the technical field of inclusion statistics in free-cutting steel, and specifically relates to a method and device for counting the number of inclusions. Background Art

[0002] Free-cutting steel refers to alloy steels that incorporate a certain amount of one or more free-cutting elements, such as sulfur, phosphorus, lead, calcium, selenium, and tellurium, to improve their machinability. MnS inclusions in free-cutting steel not only facilitate chip breakage during cutting but also lubricate the tool during machining, effectively reducing tool wear. The number, morphology, size, and distribution of MnS inclusions are key factors affecting the strength, impact toughness, and fatigue properties of free-cutting steel. Therefore, accurate MnS inclusion counting is a crucial prerequisite for evaluating the performance of free-cutting steel.

[0003] In the related art, two-dimensional images of free-cutting steel are obtained using optical microscopes and scanning electron microscopes, and then the number of manganese sulfide inclusions in the two-dimensional images is counted manually or using imageJ software. However, this statistical method has large detection and statistical errors, and cannot accurately obtain the number of MnS inclusions in free-cutting steel in industrial production, nor can it correctly evaluate the quality of free-cutting steel products. Summary of the Invention

[0004] In order to solve the current technical problem of large statistical errors in the number of manganese sulfide inclusions in free-cutting steel, the present application provides a method and a statistical device for the number of inclusions.

[0005] In a first aspect of the present application, a method for counting the number of inclusions is provided, which is applied to counting manganese sulfide inclusions in free-cutting steel. The method comprises:

[0006] Obtaining a first true number, a first area ratio, a first average area, a first average perimeter, a first average sphericity, and a first apparent number of manganese sulfide inclusions in a plurality of two-dimensional cross-sectional images of a training sample;

[0007] constructing a statistical model based on the first true quantity, the first area proportion, the first average area, the first average perimeter, the first average sphericity, and the first apparent quantity;

[0008] The second area ratio, second average area, second average perimeter, second average sphericity and second apparent number of manganese sulfide inclusions in the metallographic image of the sample to be counted are obtained, and are substituted into the statistical model to obtain the number of manganese sulfide inclusions in the sample to be counted output by the statistical model.

[0009] In some embodiments, obtaining a first true number of manganese sulfide inclusions in a plurality of two-dimensional cross-sectional images of a training sample comprises:

[0010] Obtaining a CT scan image of a training sample, and reconstructing the CT scan image to obtain a three-dimensional inclusion distribution map of the training sample;

[0011] Performing multi-position cutting on the three-dimensional inclusion distribution map to obtain a plurality of two-dimensional cross-sectional images;

[0012] A first actual number of manganese sulfide inclusions in the plurality of two-dimensional slice images is determined.

[0013] In some embodiments, each inclusion in the three-dimensional inclusion distribution map is assigned a different grayscale value, and determining a first actual number of manganese sulfide inclusions in the plurality of two-dimensional cross-sectional images includes:

[0014] performing image coding on the plurality of two-dimensional cross-sectional images and extracting grayscale values ​​of manganese sulfide inclusions to obtain image codes of the plurality of two-dimensional cross-sectional images and a number of non-repeated grayscale values ​​of manganese sulfide inclusions in the plurality of two-dimensional cross-sectional images;

[0015] A first actual number of manganese sulfide inclusions in the plurality of two-dimensional section images is determined according to the image code and the number of grayscale values ​​in the corresponding two-dimensional section images.

[0016] In some embodiments, the first area percentage, the first average area, the first average perimeter, the first average sphericity, and the first apparent number are obtained by the following steps:

[0017] Feature extraction is performed on the plurality of the two-dimensional cross-sectional images to determine the first area ratio, the first average area, the first average perimeter, the first average sphericity, and the first apparent number of manganese sulfide inclusions in the plurality of the two-dimensional cross-sectional images.

[0018] In some embodiments, constructing a statistical model based on the first true quantity, the first area proportion, the first average area, the first average perimeter, the first average sphericity, and the first apparent quantity comprises:

[0019] An improved BP neural network is trained based on the first real quantity, the first area proportion, the first average area, the first average perimeter, the first average sphericity and the first apparent quantity to obtain the statistical model, wherein the first to fifth layers of the improved BP neural network each include a linear transformation module and a nonlinear activation module set in sequence, the sixth layer is a linear transformation layer, the output end of the second layer is jump-connected to the input end of the fourth layer, the output end of the third layer is jump-connected to the input end of the fifth layer, and the output end of the fourth layer is jump-connected to the input end of the sixth layer.

[0020] In some embodiments, the training of the improved BP neural network based on the first real quantity, the first area ratio, the first average area, the first average perimeter, the first average sphericity, and the first apparent quantity comprises:

[0021] Inputting the first true quantity, the first area proportion, the first average area, the first average perimeter, the first average sphericity, and the first apparent quantity into the improved BP neural network to obtain a predicted quantity output by the last layer of the improved BP neural network;

[0022] Determine the deviation between the predicted quantity and the actual quantity using a mean square error function;

[0023] Calculating the derivative of the deviation value with respect to the training parameters of the improved BP neural network to obtain the gradient of the training parameters;

[0024] updating the training parameters according to the gradient of the training parameters and an adaptive moment estimation optimization algorithm;

[0025] The number of training times is accumulated, and the step of inputting the first real quantity, the first area proportion, the first average area, the first average perimeter, the first average sphericity, and the first apparent quantity into the improved BP neural network is returned to, and the training is terminated when the number of training times reaches a preset threshold.

[0026] In some embodiments, the training sample is a cylindrical sample having a diameter of 0.2 mm to 1 mm and a length of 5 mm to 20 mm.

[0027] In some embodiments, in the free-cutting steel, the mass fraction of manganese is 1.20% to 1.50%, and the mass fraction of sulfur is 0.25% to 0.40%.

[0028] In some embodiments, in the free-cutting steel, the mass fraction of manganese is 1.20% to 1.30% or 1.40% to 1.50%, and the mass fraction of sulfur is 0.25% to 0.30% or 0.35% to 0.40%.

[0029] In a second aspect of the present application, there is provided an inclusion number counting device based on the inclusion number counting method of the first aspect, comprising:

[0030] an acquisition module, configured to obtain a first true number, a first area ratio, a first average area, a first average perimeter, a first average sphericity, and a first apparent number of manganese sulfide inclusions in a plurality of two-dimensional cross-sectional images of a training sample;

[0031] a model building module, configured to build a statistical model based on the first real quantity, the first area proportion, the first average area, the first average perimeter, the first average sphericity, and the first apparent quantity;

[0032] A statistical module is used to obtain a second area ratio, a second average area, a second average perimeter, a second average sphericity, and a second apparent number of manganese sulfide inclusions in the metallographic image of the sample to be counted, and substitute them into the statistical model to obtain the number of manganese sulfide inclusions in the sample to be counted output by the statistical model.

[0033] According to an inclusion number counting method provided in an embodiment of the present application, which is applied to counting manganese sulfide inclusions in free-cutting steel, the statistical method includes: obtaining a first true number, a first area ratio, a first average area, a first average perimeter, a first average sphericity, and a first apparent number of manganese sulfide inclusions in multiple two-dimensional cross-sectional images of a training sample; constructing a statistical model based on the first true number, the first area ratio, the first average area, the first average perimeter, the first average sphericity, and the first apparent number; obtaining a second area ratio, a second average area, a second average perimeter, a second average sphericity, and a second apparent number of manganese sulfide inclusions in a metallographic image of a sample to be counted, and substituting these into the statistical model to obtain the number of manganese sulfide inclusions in the sample to be counted as output by the statistical model.

[0034] Because the model is constructed using the actual number, area percentage, average area, average perimeter, average sphericity, and apparent number of manganese sulfide inclusions from two-dimensional cross-sectional images, each parameter is closely related to manganese sulfide inclusions. Furthermore, the diverse range of parameters and the large number of two-dimensional cross-sectional images provide a highly accurate statistical model. Therefore, by substituting the area percentage, average area, average perimeter, average sphericity, and apparent number of manganese sulfide inclusions from the metallographic images of the sample being counted into the model, a statistical count with very low deviation can be calculated, enabling accurate assessment of the quality of free-cutting steel in industrial production. BRIEF DESCRIPTION OF THE DRAWINGS

[0035] Figure 1shows a three-dimensional distribution diagram of manganese sulfide inclusions in the free-cutting steel of the present application;

[0036] Figure 2 Shown Figure 1 Cross-section at position X=0.

[0037] Figure 3 Shown Figure 1 Cross-section at Y=0.

[0038] Figure 4 Shown Figure 1 One of the manganese sulfide inclusions and a cross-section.

[0039] Figure 5 A diagram showing the steps of the inclusion quantity counting method of the present application is shown. DETAILED DESCRIPTION

[0040] In order to enable those skilled in the art to understand the present application more clearly, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative efforts shall fall within the scope of protection of this application.

[0041] Free-cutting steel contains sulfur and manganese, which will form manganese sulfide inclusions in the free-cutting steel. Manganese sulfide inclusions have good plasticity, so during the hot rolling process, manganese sulfide will deform along with the matrix. Figure 1 . Figure 1 The extension direction of the coordinate axis Z is the rolling direction. The darker long strips are manganese sulfide inclusions. Some manganese sulfide inclusions will be cut off by rolling, forming more than two manganese sulfide inclusions. Some manganese sulfide inclusions are not cut off by rolling, and appear as rods with a thinner middle and thicker ends (see Figure 4 For an inclusion that is thinner in the middle and thicker at both ends, it includes a first end, a middle portion, and a second end, the first end, the middle portion, and the second end are connected in sequence, and the diameter of the middle portion is smaller than the diameters of the first end and the second end.

[0042] In the process of counting manganese sulfide inclusions in free-cutting steel, the surface of the free-cutting steel to be analyzed is first photographed using an optical microscope or a scanning electron microscope to form a two-dimensional metallographic image. The manganese sulfide inclusions in the two-dimensional metallographic image are then counted manually or using imageJ software to obtain the number of manganese sulfide inclusions in the free-cutting steel. Since some manganese sulfide inclusions have a relatively thin middle portion and a relatively large diameter at the first and second ends, in order to count the number of manganese sulfide inclusions and also to test the size of the manganese sulfide inclusions along the rolling direction, the sample surfaces observed are mostly surfaces parallel to the rolling direction. On the surface of the sample parallel to the rolling direction, some manganese sulfide inclusions will appear as two closed figures (see Figures 2 to 4 ), when counting the two-dimensional metallographic images, the grayscale of these two closed figures is darker than that of the steel matrix, and they are identified as two manganese sulfide inclusions. Because the surface being analyzed has multiple inclusions that form two closed figures when cut open, the number of manganese sulfide inclusions counted will be much higher than the actual number.

[0043] The first embodiment of the present application provides a method for counting the number of inclusions, which can accurately count the number of manganese sulfide inclusions in free-cutting steel to correctly evaluate the quality of free-cutting steel products.

[0044] Manganese sulfide inclusions are needed to improve cutting performance in free-cutting steels. Therefore, sulfur and manganese are intentionally added to the steel. Generally, the mass fraction of manganese is 1.20% to 1.50%, and the mass fraction of sulfur is 0.25% to 0.40%. In some embodiments, the mass fraction of manganese is 1.20% to 1.30%, and the mass fraction of sulfur is 0.35% to 0.40%. In other embodiments, the mass fraction of manganese is 1.40% to 1.50%, and the mass fraction of sulfur is 0.25% to 0.30%.

[0045] The present application is described below with reference to specific embodiments and with reference to the accompanying drawings:

[0046] See also Figure 5 The method for counting the number of inclusions provided in the embodiment of the present application includes:

[0047] S1. Obtaining a first true number, a first area ratio, a first average area, a first average perimeter, a first average sphericity, and a first apparent number of manganese sulfide inclusions in a plurality of two-dimensional cross-sectional images of a training sample;

[0048] S2. constructing a statistical model based on the first true quantity, the first area proportion, the first average area, the first average perimeter, the first average sphericity, and the first apparent quantity;

[0049] S3. Obtain a second area ratio, a second average area, a second average perimeter, a second average sphericity, and a second apparent number of manganese sulfide inclusions in the metallographic image of the sample to be counted, and substitute these into the statistical model to obtain the number of manganese sulfide inclusions in the sample to be counted as output by the statistical model.

[0050] The apparent number, area percentage, average area, average perimeter, and average sphericity of manganese sulfide inclusions in the two-dimensional cross-sectional image are explained as follows:

[0051] The apparent number of manganese sulfide inclusions in a 2D cross-sectional image refers to the number of closed figures with a grayscale lower than that of the steel matrix in the 2D cross-sectional image. It can also be understood as the number of manganese sulfide inclusions identified by analyzing 2D metallographic images using an optical microscope or scanning electron microscope in related technologies. Generally speaking, the apparent number of manganese sulfide inclusions in the 2D cross-sectional image is higher than the actual number of manganese sulfide inclusions.

[0052] The area ratio of manganese sulfide inclusions in a two-dimensional cross-sectional image refers to the ratio of the total area of ​​the apparent number of manganese sulfide inclusions in the two-dimensional cross-sectional image to the area of ​​the two-dimensional cross-sectional image.

[0053] The average area of ​​manganese sulfide inclusions in the two-dimensional cross-sectional image refers to the ratio of the total area of ​​the apparent number of manganese sulfide inclusions in the two-dimensional cross-sectional image to the number of apparent manganese sulfide inclusions in the two-dimensional cross-sectional image.

[0054] The average perimeter of the manganese sulfide inclusions in the two-dimensional section image refers to the ratio of the perimeters of all manganese sulfide inclusions (the apparent number of manganese sulfide inclusions) in the two-dimensional section image to the apparent number of manganese sulfide inclusions in the two-dimensional section image.

[0055] The average sphericity of the manganese sulfide inclusions in the two-dimensional cross-sectional image refers to the ratio of the sum of the sphericities of the apparent number of manganese sulfide inclusions to the apparent number of manganese sulfide inclusions in the two-dimensional cross-sectional image.

[0056] First, the first true number, first area ratio, first average area, first average perimeter, first average sphericity and first apparent number of manganese sulfide inclusions in the two-dimensional cross-sectional image of the training sample are obtained, and then a statistical model is constructed based on the first true number, first area ratio, first average area, first average perimeter, first average sphericity and first apparent number. Therefore, the statistical model can reflect the relationship between the various parameters in the training sample (true number, area ratio, average area, average perimeter, average sphericity and apparent number). The second area ratio, second average area, second average perimeter, second average sphericity and second apparent number of the manganese sulfide inclusions in the metallographic image of the sample to be counted are substituted into the statistical model to obtain the number of manganese sulfide inclusions in the sample to be counted.

[0057] Because the model is constructed using the actual number, area percentage, average area, average perimeter, average sphericity, and apparent number of manganese sulfide inclusions in two-dimensional cross-sectional images, each parameter is closely related to manganese sulfide inclusions, and the variety of parameters is diverse, the resulting statistical model has a high degree of accuracy. Furthermore, the greater the number of two-dimensional cross-sectional images, the higher the accuracy of the statistical model's results. In other words, utilizing multiple parameters closely related to manganese sulfide inclusions and multiple two-dimensional cross-sectional images results in a very high accuracy statistical model. Therefore, the number of manganese sulfide inclusions calculated based on the high-precision model is closer to the actual number and more accurate.

[0058] In some embodiments, obtaining a first true number of manganese sulfide inclusions in a plurality of two-dimensional cross-sectional images of a training sample comprises:

[0059] S11, obtaining a CT scan image of a training sample, and reconstructing the CT scan image to obtain a three-dimensional inclusion distribution map of the training sample;

[0060] S12, performing multi-position cutting on the three-dimensional inclusion distribution map to obtain multiple two-dimensional cross-sectional images;

[0061] S13. Determine a first actual number of manganese sulfide inclusions in the plurality of two-dimensional cross-sectional images.

[0062] In step S11, CT stands for "Computed Tomography." A CT scan image is a computed tomography image. A CT scan image can be produced using a computed tomography device, which utilizes computed tomography technology. Computed tomography technology is generally used for medical examinations but can also be used for industrial inspections. Computed tomography uses an X-ray beam to perform layer-by-layer scanning of a free-cutting steel sample, and through computer processing, produces a detailed image of the sample's internal structure. The computed tomography device comprises a scanning system, a computer system, and an image display and storage system. The scanning system uses an X-ray beam and a detector to scan the training sample layer by layer. As the X-rays penetrate the training sample, the steel matrix and manganese sulfide inclusions absorb the X-rays to varying degrees, causing the intensity of the X-rays received by the detector to vary. These varying X-ray signals are converted into electrical signals, which are then converted to digital signals by a digitizer. The computer system then processes the signals to generate a CT scan image of the training sample, which is then displayed and stored in the image display and storage system. High-resolution equipment can be used in the computed tomography device to enhance the clarity of the CT scan image. Computerized tomography scanning devices are existing technologies. For more information, please refer to the existing technology disclosures, which will not be described in detail in this application.

[0063] The training sample can be made into a columnar shape with a diameter of 0.2mm~1mm, such as 0.3mm, 0.5mm, 0.7mm, 0.8mm or 0.9mm, etc., and a length of 5mm~20mm, such as 6mm, 7mm, 8mm, 9mm, 10mm, 12mm, 13mm, 15mm, 18mm or 19mm, etc. This kind of sample is relatively thin and long, and is easier to penetrate by X-ray scanning. Columnar samples can be prepared by wire electric discharge cutting. The columnar sample is placed on the stage of the computed tomography device, and the parameters can be set as needed. For example, the X-ray energy can be 0~160kV, the exposure time can be 0.1~8s, the X-ray transmittance can be 20%~35%, and the X-ray intensity can be , the rotation angle can be ,get Pixel or Pixel CT scan image.

[0064] The CT scan images are reconstructed to obtain a three-dimensional distribution map of needle-shaped inclusions in the training sample. In some embodiments, the CT scan images can be reconstructed using three-dimensional image processing software (e.g., Avizo). Alternatively, the CT scan images can be reconstructed using other methods such as multi-planar reconstruction (MPR).

[0065] The reconstructed 3D inclusion distribution map is then sliced ​​at multiple locations to produce multiple 2D cross-sectional images. This 3D slice refers to the slices along the rolling direction, with multiple locations spaced perpendicular to the rolling direction. These 2D cross-sectional images are essentially the same as traditional 2D metallographic images, showing closed patterns distributed across the steel matrix. Since the 3D inclusion distribution map has already been constructed, the true number of inclusions in the 2D cross-sectional images can be easily determined.

[0066] In some embodiments, the actual number of inclusions in the two-dimensional slice image can be obtained by the following method:

[0067] First, different grayscale values ​​are assigned to each inclusion in a three-dimensional inclusion distribution map. Then, the three-dimensional inclusion distribution map is cut at multiple locations to obtain a plurality of two-dimensional cross-sectional images. Image coding is performed on the plurality of two-dimensional cross-sectional images, and the grayscale values ​​of manganese sulfide inclusions are extracted to obtain image codes for the plurality of two-dimensional cross-sectional images and the number of grayscale values ​​of non-repeated manganese sulfide inclusions in the plurality of two-dimensional cross-sectional images. A first true number of manganese sulfide inclusions in the plurality of two-dimensional cross-sectional images is determined based on the image codes and the number of grayscale values ​​in the corresponding two-dimensional cross-sectional images.

[0068] In other embodiments, the number of actual inclusions can also be determined manually. In a two-dimensional cross-sectional image, if the same inclusion is cut to form two closed figures, then the two closed figures are linked. In the three-dimensional image processing software (Avizo), if one of the closed figures is selected, the other closed figure belonging to the same manganese sulfide inclusion will also appear in the same selection color or be highlighted, thereby indicating that the two belong to the same manganese sulfide inclusion.

[0069] In some embodiments, the first area fraction, first average area, first average perimeter, first average sphericity, and first apparent number are obtained by performing feature extraction on multiple two-dimensional cross-sectional images to determine the first area fraction, first average area, first average perimeter, first average sphericity, and first apparent number of manganese sulfide inclusions in the multiple two-dimensional cross-sectional images. In implementation, parameters for the area fraction, average area, average perimeter, average sphericity, and apparent number can be directly extracted from the two-dimensional cross-sectional images using three-dimensional image processing software. Alternatively, parameters for the area fraction, average area, average perimeter, average sphericity, and apparent number can be extracted from the two-dimensional cross-sectional images using image processing software (imageJ). Numerous types of image processing software are available, and the above is merely a list. One or more of these software programs can be selected based on actual needs. Since image processing software is currently available, further information can be found in the prior art and will not be further elaborated herein.

[0070] In some embodiments, constructing a statistical model based on the first real number, the first area percentage, the first average area, the first average perimeter, the first average sphericity, and the first apparent number includes:

[0071] An improved BP neural network is trained based on the first real quantity, the first area proportion, the first average area, the first average perimeter, the first average sphericity and the first apparent quantity to obtain a statistical model, wherein the first to fifth layers of the improved BP neural network each include a linear transformation module and a nonlinear activation module arranged in sequence, the sixth layer is a linear transformation layer, the output end of the second layer is jump-connected to the input end of the fourth layer, the output end of the third layer is jump-connected to the input end of the fifth layer, and the output end of the fourth layer is jump-connected to the input end of the sixth layer.

[0072] During the implementation process, an improved BP neural network architecture can be constructed based on the PyTorch deep learning framework. The hierarchical structure and related parameters of the improved BP neural network architecture can be referred to in Table 1 below:

[0073] Table 1

[0074]

[0075] In an embodiment of the present application, the construction method of the residual connection in the improved BP neural network architecture is: the output end of the second layer (layer index is 1) is jump-connected to the input end of the fourth layer (layer index is 3), the output end of the third layer (layer index is 2) is jump-connected to the input end of the fifth layer (layer index is 4), and the output end of the fourth layer (layer index is 3) is jump-connected to the input end of the sixth layer (layer index is 5), forming a jump-type gradient transmission channel.

[0076] It should be noted that traditional residual connections are usually jump connections across two or three layers, while the residual connections established in the embodiment of the present application are accumulated layer by layer and do not span multiple layers. This connection method can increase the nonlinear expression ability of the model and alleviate the gradient disappearance problem.

[0077] In some embodiments, training the improved BP neural network based on the first real quantity, the first area ratio, the first average area, the first average perimeter, the first average sphericity, and the first apparent quantity includes:

[0078] S21, inputting the first true quantity, the first area ratio, the first average area, the first average perimeter, the first average sphericity, and the first apparent quantity into the improved BP neural network to obtain a predicted quantity output by the last layer of the improved BP neural network;

[0079] S22. Determine a deviation between the predicted quantity and the first true quantity using a mean square error function;

[0080] S23, calculating the derivative of the deviation value with respect to the training parameters of the improved BP neural network to obtain the gradient of the training parameters;

[0081] S24, updating the training parameters according to the gradient of the training parameters and the adaptive moment estimation optimization algorithm;

[0082] S25, accumulating the number of training times, and returning to the step of inputting the first real quantity, the first area ratio, the first average area, the first average perimeter, the first average sphericity, and the first apparent quantity into the improved BP neural network, until the training is terminated when the number of training times reaches a preset threshold.

[0083] After constructing the improved BP neural network, it can be initialized first. During the implementation process, the initialization rules can be referred to as follows:

[0084] Initialization method of weight matrix: Use PyTorch's default uniform distribution initialization algorithm to initialize the parameters of the weight matrix of the linear transformation module. Its mathematical expression can be:

[0085] ;

[0086] Where Wi is the weight matrix, d in is the input dimension (such as d in the first layer in is 1), It is an abbreviation for uniform distribution in probability theory and statistics.

[0087] Initialization method of bias vector: Use zero vector to initialize the bias items of all linear transformation modules, that is, b i =0, where b i is the bias vector.

[0088] Configuration method of activation function parameters: Each nonlinear activation module adopts the LeakReLU activation function, and the activation function parameter α is uniformly set to 0.01.

[0089] In step S21, after the first real quantity, the first area proportion, the first average area, the first average perimeter, the first average sphericity and the first apparent quantity are input into the improved BP neural network, the improved BP neural network realizes the forward feature extraction function by combining hierarchical feature changes with residual connections.

[0090] First enter the data (N is the batch size, d in is the input dimension), when the layer index Perform the following operations:

[0091]

[0092] Where h i is the output of the i-th layer; LeakyReLU() is the activation function; (d out is the output dimension) is the weight matrix; is the output of the previous layer; is the bias vector.

[0093] Furthermore, in the layer index When the output h of the current layer i With the output h of the previous layer i-1 Perform feature fusion and perform the following residual connection operations:

[0094] .

[0095] The final output of the improved BP neural network is generated by the computational unit of the sixth layer. When the current layer index is 5, the feature tensor output by the previous layer is Perform a linear mapping operation, and the calculation formula can be:

[0096]

[0097] Where, is the output result of the improved BP neural network, , is the number of predictions output by the last layer, and its dimension is .

[0098] In step S22, the mean square error function can be used as a loss function to quantify the deviation between the predicted quantity and the actual quantity. Its mathematical expression can be:

[0099]

[0100] Where, is the deviation value, N is the total number of batch training samples, is the predicted number corresponding to the i-th sample, is the true number corresponding to the i-th sample.

[0101] In step S23, the loss function L can be calculated layer by layer based on the chain derivation rule to calculate the weight matrix W i and the bias vector b i Gradient and , and its calculation formula can be:

[0102] ;

[0103] .

[0104] In step S24, an adaptive moment estimation optimization algorithm may be used to perform iterative updates of the training parameters. Assuming the gradient is ,in, W i or b i , you can dynamically adjust the training parameters by following the four steps below:

[0105] S241. First-order moment estimation calculation: Construct the first-order statistics of the gradient vector to represent the exponential moving average of the historical gradient direction. The calculation formula can be:

[0106] ;

[0107] Where m t is the first-order moment estimation vector at the t-th iteration, is the first-order moment decay rate, is the current training parameter gradient.

[0108] S242, second-order moment estimation calculation: Generate a second-order moment estimator of the square of the gradient, which is used to quantify the fluctuation characteristics of the gradient. The calculation formula can be:

[0109] ;

[0110] Where, is the second-order moment estimate of the current time step, is the second-order moment decay rate.

[0111] S243, bias correction: Compensate for the initial moment estimation bias of the iteration. The correction formula can be:

[0112] ;

[0113] Where, is the corrected first-order moment estimate; is the corrected second moment estimate.

[0114] S244, parameter update: adjust the parameter update step size according to the corrected moment estimate to complete the iterative mapping of the parameter space coordinates. The calculation formula can be:

[0115] ;

[0116] Where, is the initial learning rate (range is 0.01~0.1), is the numerical stability coefficient, Element-wise square root of the second-order moment estimate.

[0117] In step S25, the first actual number, first area ratio, first average area, first average perimeter, first average sphericity and first apparent number of manganese sulfide inclusions in the multiple two-dimensional cross-sectional images of the training sample obtained in step S1 can be divided into a training subset D train and the test subset D test , where the training subset D train Used to input into the improved BP neural network to perform iterative training.

[0118] During the implementation process, the improved BP neural network generates the predicted quantity through feedforward processing. , and then calculate the deviation value L between the predicted quantity Y and the actual data T based on the mean square error function, where , and then calculate the gradient of each level training parameter based on the chain back propagation algorithm and , and finally use the Adam optimization algorithm to update the set of training parameters .

[0119] The training process can be looped by the controller. When the cumulative number of training times reaches a preset maximum training round threshold (for example, 1000 times), the training process is terminated and the optimized weight file (.pth file, containing the trained parameters) is solidified to a persistent storage medium.

[0120] After the improved BP neural network training is completed, the test subset D test Evaluate the trained network. In the implementation process, the validation sample can be Input into the trained improved BP neural network, and output the predicted quantity set after activation function mapping , the relative error of each sample point can be calculated according to the following formula:

[0121] ;

[0122] Where, is the actual number of calibration. Define the verification evaluation index To satisfy Percentage of effective predictions:

[0123] ;

[0124] Where M is the total number of data in the test subset, is an indicator function if and only if the relative error value satisfies the condition The value is 1.

[0125] During implementation, the improved BP neural network used for assessment compliance can be used as a statistical model. A manganese sulfide inclusion statistical system program can be constructed based on this statistical model, and a weight file can be configured in the system. The second area ratio, second average area, second average perimeter, second average sphericity, and second apparent number of manganese sulfide inclusions in the metallographic image of the sample to be counted are input into the manganese sulfide inclusion statistical system program, thereby achieving the number statistics of manganese sulfide inclusions.

[0126] For the target grade of free-cutting steel, a data set with steel grade identification is generated according to the above method. The data set is then input into the improved BP neural network for transfer learning training to obtain a weight file for manganese sulfide inclusions in the target grade of free-cutting steel. This weight file is then imported into the manganese sulfide inclusion statistics system program, which can realize the statistical analysis of the number of manganese sulfide inclusions in the metallographic images of the target grade of free-cutting steel.

[0127] The improved BP neural network obtained by the above scheme can quickly realize the number statistics of manganese sulfide inclusions in metallographic images of different grades of free-cutting steel, improve the speed and efficiency of the number statistics of manganese sulfide inclusions, and reduce the statistical cost.

[0128] Based on the same technical concept as the first aspect, the second embodiment of the present application provides a device for counting the number of inclusions.

[0129] The inclusion quantity counting device includes an acquisition module, a model building module and a statistical module. Among them:

[0130] The acquisition module is used to obtain a first real number, a first area ratio, a first average area, a first average perimeter, a first average sphericity and a first apparent number of manganese sulfide inclusions in multiple two-dimensional cross-sectional images of a training sample.

[0131] The model building module is used to build a statistical model based on the first real number, the first area ratio, the first average area, the first average perimeter, the first average sphericity and the first apparent number;

[0132] The statistical module is used to obtain the second area ratio, second average area, second average perimeter, second average sphericity and second apparent number of manganese sulfide inclusions in the metallographic image of the sample to be counted, and substitute them into the statistical model to obtain the number of manganese sulfide inclusions in the sample to be counted output by the statistical model.

[0133] In some embodiments, the acquisition module is further used to obtain a CT scan image of the training sample, reconstruct the CT scan image to obtain a three-dimensional inclusion distribution map of the training sample; perform multi-position cutting on the three-dimensional inclusion distribution map to obtain multiple two-dimensional cross-sectional images; and determine a first true number of manganese sulfide inclusions in the multiple two-dimensional cross-sectional images.

[0134] In some embodiments, each inclusion in the three-dimensional inclusion distribution map is assigned a different grayscale value. The acquisition module is further configured to perform image coding on the plurality of two-dimensional cross-sectional images and extract the grayscale values ​​of the manganese sulfide inclusions, thereby obtaining image codes for the plurality of two-dimensional cross-sectional images and a number of non-repeated grayscale values ​​of the manganese sulfide inclusions in the plurality of two-dimensional cross-sectional images; and determine a first true number of manganese sulfide inclusions in the plurality of two-dimensional cross-sectional images based on the image codes and the number of grayscale values ​​in the corresponding two-dimensional cross-sectional images.

[0135] In some embodiments, the acquisition module is further used to perform feature extraction on the multiple two-dimensional cross-sectional images to determine the first area ratio, first average area, first average perimeter, first average sphericity and first apparent number of manganese sulfide inclusions in the multiple two-dimensional cross-sectional images.

[0136] In some embodiments, the model building module is also used to train an improved BP neural network based on the first real quantity, the first area ratio, the first average area, the first average perimeter, the first average sphericity and the first apparent quantity to obtain a statistical model, wherein the first to fifth layers of the improved BP neural network each include a linear transformation module and a nonlinear activation module in sequence, the sixth layer is a linear transformation layer, the output end of the second layer is jump-connected to the input end of the fourth layer, the output end of the third layer is jump-connected to the input end of the fifth layer, and the output end of the fourth layer is jump-connected to the input end of the sixth layer.

[0137] In some embodiments, the model building module is also used to input the first true number, the first area ratio, the first average area, the first average perimeter, the first average sphericity and the first apparent number into the improved BP neural network to obtain the predicted number output by the last layer of the improved BP neural network; use the mean square error function to determine the deviation value between the predicted number and the true number; calculate the derivative of the deviation value with respect to the training parameters of the improved BP neural network to obtain the gradient of the training parameters; update the training parameters according to the gradient of the training parameters and the adaptive moment estimation optimization algorithm; accumulate the number of training times and return to the step of inputting the first true number, the first area ratio, the first average area, the first average perimeter, the first average sphericity and the first apparent number into the improved BP neural network until the training is terminated when the number of training times reaches a preset threshold.

[0138] In some embodiments, the training sample is a cylindrical sample having a diameter of 0.2 mm to 1 mm and a length of 5 mm to 20 mm.

[0139] In some embodiments, the free-cutting steel has a manganese content of 1.20% to 1.50% by mass, and a sulfur content of 0.25% to 0.40% by mass.

[0140] In some embodiments, in the free-cutting steel, the mass fraction of manganese is 1.20% to 1.30% or 1.40% to 1.50%, and the mass fraction of sulfur is 0.25% to 0.30% or 0.35% to 0.40%.

[0141] The inclusion number counting method and counting device provided by this application have at least the following advantages:

[0142] (1) The parameters of manganese sulfide inclusions in the training samples of free-cutting steel (real number, area proportion, average area, average perimeter, average sphericity and apparent number) are used as the data basis for constructing the model. The parameters are diverse and numerous, and the constructed statistical model has high statistical accuracy. Therefore, the deviation of the number of manganese sulfide inclusions calculated by this statistical model is small.

[0143] (2) After the statistical model is constructed, it is only necessary to obtain the metallographic image in a conventional way, and then extract the area ratio, average area, average sphericity and apparent number of manganese sulfide inclusions, and substitute them into the statistical model to obtain the number of manganese sulfide inclusions. After the statistical model is constructed, it can be applied multiple times to different heats and different grades of free-cutting steel. The statistical process is simple, easy to operate, efficient, and suitable for industrial production.

[0144] In this application, unless otherwise expressly specified or limited, a first feature being "above" or "below" a second feature may include the first and second features being in direct contact, or may include the first and second features being in contact not directly but through another feature between them. Moreover, a first feature being "above," "above," and "above" a second feature may include the first feature being directly above or obliquely above the second feature, or may simply mean that the first feature is higher in level than the second feature. A first feature being "below," "below," and "below" a second feature may include the first feature being directly below or obliquely below the second feature, or may simply mean that the first feature is lower in level than the second feature.

[0145] In the description of the present application, it should be understood that the terms "center", "longitudinal", "lateral", "length", "width", "thickness", "up", "down", "front", "back", "left", "right", "vertical", "horizontal", "top", "bottom", "inside", "outside", "clockwise" and "counterclockwise" indicate orientations or positional relationships based on the orientations or positional relationships shown in the accompanying drawings, and are only for the convenience of describing the present application and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore should not be understood as a limitation on the present application.

[0146] In this application, unless otherwise specified or limited, the terms "connect," "fix," etc. should be understood broadly. For example, "fix" can mean fixed connection, detachable connection, or integration; it can mean mechanical connection or electrical connection; it can mean direct connection or indirect connection through an intermediate medium; it can mean internal communication between two elements or interaction between two elements. Those skilled in the art will understand the specific meanings of the above terms in this application based on specific circumstances.

[0147] In addition, the terms "first," "second," and so on, used in this application are for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Therefore, features specified as "first" or "second" may explicitly or implicitly include one or more features. In the description of this application, "plurality" means two or more, unless otherwise specifically defined.

[0148] Although the embodiments of the present application have been shown and described, those skilled in the art will appreciate that various changes, modifications, substitutions, and variations may be made to the embodiments without departing from the principles and intent of the present application, and that the scope of the present application is defined by the claims and their equivalents.

Claims

1. A method for counting inclusion numbers, applied to counting manganese sulfide inclusions in free-cutting steel, characterized in that: The statistical methods include: Obtaining a first true number, a first area ratio, a first average area, a first average perimeter, a first average sphericity, and a first apparent number of manganese sulfide inclusions in a plurality of two-dimensional cross-sectional images of a training sample; An improved BP neural network is trained based on the first real quantity, the first area proportion, the first average area, the first average perimeter, the first average sphericity, and the first apparent quantity to obtain a statistical model, wherein the first to fifth layers of the improved BP neural network each include a linear transformation module and a nonlinear activation module arranged in sequence, the sixth layer is a linear transformation layer, the output end of the second layer is jump-connected to the input end of the fourth layer, the output end of the third layer is jump-connected to the input end of the fifth layer, and the output end of the fourth layer is jump-connected to the input end of the sixth layer; The second area ratio, second average area, second average perimeter, second average sphericity and second apparent number of manganese sulfide inclusions in the metallographic image of the sample to be counted are obtained, and are substituted into the statistical model to obtain the number of manganese sulfide inclusions in the sample to be counted output by the statistical model.

2. The method for counting the number of inclusions according to claim 1, characterized in that: The obtaining of a first true number of manganese sulfide inclusions in a plurality of two-dimensional cross-sectional images of a training sample comprises: Obtaining a CT scan image of a training sample, and reconstructing the CT scan image to obtain a three-dimensional inclusion distribution map of the training sample; Performing multi-position cutting on the three-dimensional inclusion distribution map to obtain a plurality of two-dimensional cross-sectional images; A first actual number of manganese sulfide inclusions in the plurality of two-dimensional slice images is determined.

3. The method for counting the number of inclusions according to claim 2, characterized in that: Each inclusion in the three-dimensional inclusion distribution map is assigned a different grayscale value. Determining a first true number of manganese sulfide inclusions in the plurality of two-dimensional cross-sectional images includes: performing image coding on the plurality of two-dimensional cross-sectional images and extracting grayscale values ​​of manganese sulfide inclusions to obtain image codes of the plurality of two-dimensional cross-sectional images and a number of non-repeated grayscale values ​​of manganese sulfide inclusions in the plurality of two-dimensional cross-sectional images; A first actual number of manganese sulfide inclusions in the plurality of two-dimensional section images is determined according to the image code and the number of grayscale values ​​in the corresponding two-dimensional section images.

4. The method for counting the number of inclusions according to claim 2, characterized in that: The first area ratio, the first average area, the first average perimeter, the first average sphericity, and the first apparent number are obtained by the following steps: Feature extraction is performed on the plurality of the two-dimensional cross-sectional images to determine the first area ratio, the first average area, the first average perimeter, the first average sphericity, and the first apparent number of manganese sulfide inclusions in the plurality of the two-dimensional cross-sectional images.

5. The method for counting the number of inclusions according to claim 1, characterized in that: The training of the improved BP neural network based on the first real quantity, the first area proportion, the first average area, the first average perimeter, the first average sphericity, and the first apparent quantity includes: Inputting the first true quantity, the first area proportion, the first average area, the first average perimeter, the first average sphericity, and the first apparent quantity into the improved BP neural network to obtain a predicted quantity output by the last layer of the improved BP neural network; Determining a deviation between the predicted quantity and the first true quantity using a mean square error function; Calculating the derivative of the deviation value with respect to the training parameters of the improved BP neural network to obtain the gradient of the training parameters; updating the training parameters according to the gradient of the training parameters and an adaptive moment estimation optimization algorithm; The number of training times is accumulated, and the step of inputting the first real quantity, the first area proportion, the first average area, the first average perimeter, the first average sphericity, and the first apparent quantity into the improved BP neural network is returned to, and the training is terminated when the number of training times reaches a preset threshold.

6. The method for counting the number of inclusions according to any one of claims 1 to 5, characterized in that: The training sample is a cylindrical sample with a diameter of 0.2 mm to 1 mm and a length of 5 mm to 20 mm.

7. The method for counting the number of inclusions according to any one of claims 1 to 5, characterized in that: In the free-cutting steel, the mass fraction of manganese is 1.20% to 1.50%, and the mass fraction of sulfur is 0.25% to 0.40%.

8. The method for counting the number of inclusions according to claim 7, characterized in that: In the free-cutting steel, the mass fraction of manganese is 1.20% to 1.30% or 1.40% to 1.50%, and the mass fraction of sulfur is 0.25% to 0.30% or 0.35% to 0.40%.

9. An inclusion number counting device based on the inclusion number counting method according to any one of claims 1 to 8, characterized in that: include: an acquisition module, configured to obtain a first true number, a first area ratio, a first average area, a first average perimeter, a first average sphericity, and a first apparent number of manganese sulfide inclusions in a plurality of two-dimensional cross-sectional images of a training sample; a model building module, configured to build a statistical model based on the first real quantity, the first area proportion, the first average area, the first average perimeter, the first average sphericity, and the first apparent quantity; A statistical module is used to obtain a second area ratio, a second average area, a second average perimeter, a second average sphericity, and a second apparent number of manganese sulfide inclusions in the metallographic image of the sample to be counted, and substitute them into the statistical model to obtain the number of manganese sulfide inclusions in the sample to be counted output by the statistical model.

Citation Information

Patent Citations

  • Method for calculating number of non-metallic inclusions in steel

    CN113418921A

  • Bearing steel inclusion level evaluation method and system

    CN118398101A