Method for calculating image resolution of metallograph and related equipment

Through automatic recognition and calculation of the image resolution of the gold phase photo, the problem of low efficiency and high error rate in existing technologies has been solved, and more efficient and accurate image resolution calculations are achieved.

CN119379651APending Publication Date: 2025-01-28北京适创科技有限公司
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411510288.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-28
Publication Date
2025-01-28

AI Technical Summary

Technical Problem

In the prior art, the calculation of metallographic photograph images has low efficiency and high error rate, which requires the operator to have professional knowledge and experience.

Method used

By obtaining the digital images of the gold phase photo, the ruler positioning model, the ruler segmentation model and the ruler classification model are used to automatically identify the actual length and image coordinates of the line segment of the ruler, and the image resolution is calculated.

Benefits of technology

Improve the efficiency and accuracy of image resolution calculation, and reduce the demand and error rate of manual operation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119379651A_ABST
    Figure CN119379651A_ABST
Patent Text Reader

Abstract

The invention provides an image resolution calculation method of a metallograph and related equipment. The method is applied to the field of digital image processing, and comprises the following steps: firstly, obtaining a digital image of a metallographic photo, the digital image carrying a scale image, and accurately identifying the actual length of a line segment of a scale and an image coordinate difference value by utilizing a scale positioning model, a scale segmentation model and a scale classification model; and the image resolution of the metallograph is calculated according to the actual length of the line segment of the scale and the image coordinate difference, so that the accuracy of the image resolution of the metallograph is ensured. Moreover, the whole process of determining the image resolution of the metallograph is automatic, the model processing speed is high, and the efficiency of determining the image resolution of the metallograph is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the field of digital image processing, and in particular relates to a method for calculating the image resolution of a metallographic photograph and related equipment. Background Art

[0002] With the increasing maturity of digital image processing technology, many computational and statistical tasks involving digital images need to rely on the absolute size information of digital images. For example, for tasks such as microstructure size measurement and distribution statistics in metallographic photos, it is necessary to calculate the image resolution of metallographic photos.

[0003] Currently, experienced operators often observe the photographs and manually determine the image resolution information in the metallographic photographs based on the observation results.

[0004] However, the manual method of determining image resolution requires the operator to have high professional knowledge and experience, and also requires careful observation and measurement of the image, which is not only prone to errors but also inefficient. Summary of the invention

[0005] In view of the above problems, this application proposes a method for calculating the image resolution of metallographic photographs and related equipment. In order to solve the problem of low efficiency and high error rate in calculating the image resolution of metallographic photographs, the specific solution is as follows:

[0006] A method for calculating the image resolution of a metallographic photograph, comprising:

[0007] Acquire a digital image of the metallographic photograph, wherein the digital image carries a ruler image;

[0008] Inputting the digital image into a preset ruler positioning model to obtain a mask of the ruler image in the digital image, and using an image corresponding to the mask in the digital image as the ruler image;

[0009] Inputting the ruler image into a preset ruler segmentation model to obtain a line segment image and a length information image included in the ruler image;

[0010] Inputting the length information image into a preset ruler classification model to obtain the actual length of the line segment of the ruler;

[0011] Determine the image coordinate difference between two endpoints of the line segment image in the line segment extension direction;

[0012] The image resolution of the metallographic photograph is calculated based on the actual length of the line segment of the ruler and the image coordinate difference.

[0013] Optionally, the digital image includes a plurality of pixel points, each pixel point corresponds to a pixel value;

[0014] After obtaining the digital image of the metallographic photograph, the method further comprises:

[0015] Compressing the pixel value corresponding to each pixel point in the digital image according to a preset compression ratio to obtain a compressed digital image, wherein the compressed digital image carries a compressed ruler image;

[0016] The step of inputting the digital image into a preset ruler positioning model to obtain a mask of the ruler image in the digital image includes:

[0017] Inputting the compressed digital image into a preset ruler positioning model to obtain a mask of the compressed ruler image in the compressed digital image;

[0018] The mask of the compressed ruler image in the compressed digital image is enlarged according to a preset enlargement ratio to obtain the mask of the ruler image in the digital image, wherein the preset enlargement ratio and the preset compression ratio are reciprocals of each other.

[0019] Optionally, compressing the pixel value corresponding to each pixel point in the digital image according to a preset compression ratio to obtain a compressed digital image includes:

[0020] For each pixel point in the digital image, compress the coordinates of the pixel point according to a preset compression ratio to obtain the compressed coordinates of the pixel point, and determine the four integer coordinates closest to the compressed coordinates;

[0021] Based on the compressed coordinates and the four integer coordinates, a horizontal coordinate offset and a vertical coordinate offset are calculated;

[0022] Substituting the horizontal coordinate offset, the vertical coordinate offset and the four integer coordinates into a preset bilinear interpolation formula to obtain a compressed pixel value of the pixel point;

[0023] The compressed pixel values ​​of each of the pixel points are combined to obtain the compressed digital image.

[0024] Optionally, the training process of the ruler positioning model includes:

[0025] Obtaining a plurality of first training samples with first annotation information, wherein the first annotation information includes a mask of a ruler image, and each of the first training samples includes a digital image of a metallographic photograph;

[0026] The initial positioning model is trained based on the plurality of the first training samples to obtain a ruler positioning model, wherein the input of the ruler positioning model is a digital image of a metallographic photograph, and the output of the ruler positioning model is a mask of the ruler image in the digital image.

[0027] Optionally, the training process of the scale segmentation model includes:

[0028] Obtaining a plurality of second training samples with second annotation information, wherein the second annotation information includes a mask of a line segment image and a mask of a length information image, and each of the second training samples includes a ruler image;

[0029] The initial segmentation model is trained based on multiple second training samples to obtain a ruler segmentation model, the input of the ruler segmentation model is the image corresponding to the mask in the digital image, and the output of the ruler positioning model is the line segment image and the length information image included in the ruler image.

[0030] Optionally, the training process of the scale classification model includes:

[0031] Obtaining a plurality of third training samples with third annotation information, wherein the third annotation information includes the actual length of the line segment of the ruler, and each of the third training samples includes a length information image;

[0032] The initial classification model is trained based on the plurality of third training samples to obtain a ruler classification model, wherein the input of the ruler classification model is a length information image, and the output of the ruler classification model is the actual length of the line segment of the ruler.

[0033] A device for calculating the image resolution of a metallographic photograph, comprising:

[0034] An acquisition unit, used for acquiring a digital image of the metallographic photograph, wherein the digital image carries a ruler image;

[0035] A first input unit is used to input the digital image into a preset ruler positioning model to obtain a mask of the ruler image in the digital image, and use the image corresponding to the mask in the digital image as the ruler image;

[0036] A second input unit, used for inputting the ruler image into a preset ruler segmentation model to obtain a line segment image and a length information image included in the ruler image;

[0037] A third input unit is used to input the length information image into a preset ruler classification model to obtain the actual length of the line segment of the ruler;

[0038] A determination unit, used to determine the image coordinate difference between two end points of the line segment image in the line segment extension direction;

[0039] A calculation unit is used to calculate the image resolution of the metallographic photograph based on the actual length of the line segment of the ruler and the image coordinate difference.

[0040] An image resolution calculation device for a metallographic photograph, comprising a memory and a processor;

[0041] The memory is used to store programs;

[0042] The processor is used to execute the program to implement each step of the method for calculating the image resolution of a metallographic photograph described in any one of the above.

[0043] A readable storage medium stores a computer program, which, when executed by a processor, implements each step of the method for calculating the image resolution of a metallographic photograph described in any one of the above.

[0044] A computer program product comprises a computer program, wherein when the computer program is executed by a processor, each step of the method for calculating the image resolution of a metallographic photograph described in any one of the above items is implemented.

[0045] Based on the above technical solution, the present application provides a method for calculating the image resolution of a metallographic photograph and related equipment. First, a digital image of the metallographic photograph is obtained, wherein the digital image carries a ruler image, and the ruler positioning model, the ruler segmentation model, and the ruler classification model are used to accurately identify the actual length of the ruler line segment and the image coordinate difference. The image resolution of the metallographic photograph is calculated based on the actual length of the ruler line segment and the image coordinate difference, thereby ensuring the accuracy of the image resolution of the metallographic photograph. In addition, the entire process of determining the image resolution of the metallographic photograph is automated and the model processing speed is fast, thereby improving the efficiency of determining the image resolution of the metallographic photograph. BRIEF DESCRIPTION OF THE DRAWINGS

[0046] Various other advantages and benefits will become apparent to those of ordinary skill in the art by reading the detailed description of the preferred embodiments below. The accompanying drawings are only for the purpose of illustrating the preferred embodiments and are not to be considered as limiting the present application. Also, the same reference symbols are used throughout the accompanying drawings to represent the same components. In the accompanying drawings:

[0047] Figure 1 A schematic diagram of a process for calculating the image resolution of a metallographic photograph provided in an embodiment of the present application;

[0048] Figure 2 A schematic diagram of a digital image of a metallographic photograph disclosed in an embodiment of the present application;

[0049] Figure 3A schematic diagram of a ruler image disclosed in an embodiment of the present application;

[0050] Figure 4 A schematic diagram of a line segment image disclosed in an embodiment of the present application;

[0051] Figure 5 A schematic diagram of a length information image disclosed in an embodiment of the present application;

[0052] Figure 6 A schematic diagram of a compressed digital image of a metallographic photograph disclosed in an embodiment of the present application;

[0053] Figure 7 A schematic diagram of a process of inputting a digital image into a preset ruler positioning model to obtain a mask of the ruler image in the digital image disclosed in an embodiment of the present application;

[0054] Figure 8 A schematic diagram of the structure of an image resolution calculation device for a metallographic photograph disclosed in an embodiment of the present application;

[0055] Fig. 9 This is a hardware structure block diagram of an image resolution calculation device for metallographic photographs disclosed in an embodiment of the present application. DETAILED DESCRIPTION

[0056] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0057] The terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the terms used in this way can be interchangeable where appropriate, which is merely a way of distinguishing objects of the same attributes when describing the embodiments of the present invention. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, so that a process, method, system, product, or device that includes a series of units is not necessarily limited to those units, but may include other units that are not clearly listed or inherent to these processes, methods, products, or devices.

[0058] In order to solve the problem of low efficiency and extremely high error rate in calculating the image resolution of metallographic photographs, the present application provides a method for calculating the image resolution of metallographic photographs. The data processing method based on smart contracts provided by the present application is further described in detail below in conjunction with the accompanying drawings and specific implementation methods.

[0059] Please refer to the attached Figure 1 , Figure 1 A schematic flow chart of a method for calculating the image resolution of a metallographic photograph provided in an embodiment of the present application. The method may include the following steps:

[0060] Step S101: Acquire a digital image of a metallographic photograph, wherein the digital image carries a ruler image.

[0061] It should be noted that metallographic photographs are usually taken by optical microscopes or electron microscopes, which can clearly show the microscopic features of the material such as grains, phase boundaries, inclusions, etc. In order to conduct more in-depth analysis and processing, various image processing and analysis operations can be performed using computer software to obtain the corresponding digital images. The digital image includes multiple pixels, and each pixel corresponds to a pixel value.

[0062] In the present application, the metallographic photograph is taken together with the ruler image in the metallographic photograph. The digital image of the metallographic photograph carries the ruler image, which includes the line segment image and the length information. For ease of understanding, please refer to Figure 2 , Figure 2 A schematic diagram of a digital image of a metallographic photograph disclosed in an embodiment of the present application.

[0063] In order to maintain the consistency of digital images, the digital images of metallographic photographs can be uniformly converted into single-channel eight-bit images. By dividing the pixel values ​​by 255, the pixel values ​​can be normalized to the [0,1] interval to facilitate subsequent analysis and processing.

[0064] Step S102: inputting the digital image into a preset ruler positioning model, obtaining a mask of the ruler image in the digital image, and taking the image corresponding to the mask in the digital image as the ruler image.

[0065] It should be noted that the mask is used to indicate the image coordinate range.

[0066] In the present application, a plurality of first training samples with first annotation information may be obtained, wherein the first annotation information includes a mask of a ruler image, and each first training sample includes a digital image of a metallographic photograph. Then, the initial positioning model is trained based on the plurality of first training samples to obtain a ruler positioning model, wherein the input of the ruler positioning model is the digital image of the metallographic photograph, and the output of the ruler positioning model is the mask of the ruler image in the digital image. For details, please refer to Figure 3 , Figure 3 A schematic diagram of a ruler image disclosed in an embodiment of the present application.

[0067] The initial positioning model can be a Unet segmentation network. The Unet segmentation network is a deep learning model commonly used in image segmentation tasks. It can learn and identify different areas in an image and is very suitable for tasks that require positioning scale images. Of course, in addition to the Unet segmentation network, other suitable network structures can also be selected, such as the DeepLab network.

[0068] For the segmentation network, a mixture of cross entropy and Dice coefficient can be used as the loss function, which focuses on the classification accuracy of each pixel and considers the matching degree of the overall segmented area. As an optimization algorithm, Adam can adaptively adjust the learning step size to converge to the optimal solution faster. The learning rate is set to a relatively small learning rate of 1e-4, which helps the model to converge stably during training and avoid oscillation or divergence caused by excessive step size. On the validation set, if the loss value no longer decreases significantly in 5 consecutive rounds, it is determined that the model has converged, which helps to avoid unnecessary waste of training time and prevent the model from overfitting.

[0069] Step S103: inputting the ruler image into a preset ruler segmentation model to obtain a line segment image and a length information image included in the ruler image.

[0070] In the present application, a plurality of second training samples with second annotation information can be obtained first, wherein the second annotation information includes a mask of a line segment image and a mask of a length information image, and each second training sample includes a ruler image. Then, the initial segmentation model is trained based on the plurality of second training samples to obtain a ruler segmentation model, wherein the input of the ruler segmentation model is the image corresponding to the mask in the digital image, and the output of the ruler positioning model is the line segment image and the length information image included in the ruler image. For details, please refer to Figure 4 and Figure 5 , Figure 4 A schematic diagram of a line segment image disclosed in an embodiment of the present application; Figure 5 A schematic diagram of a length information image disclosed in an embodiment of the present application.

[0071] The initial segmentation model can be a Unet segmentation network, which is a deep learning model commonly used in image segmentation tasks. It can learn and identify different areas in an image and is very suitable for tasks that require segmenting scale images. Of course, in addition to the Unet segmentation network, other suitable network structures can also be selected, such as the DeepLab network.

[0072] Step S104: input the length information image into a preset ruler classification model to obtain the actual length of the line segment of the ruler.

[0073] It should be noted that the length information images may be uniformly scaled to the same size, such as 384*192, and then the length information images may be input into a preset scale classification model.

[0074] In the present application, a plurality of third training samples with third annotation information may be obtained first, wherein the third annotation information includes the actual length of the line segment of the ruler, and each third training sample includes a length information image. Then, the initial classification model is trained based on the plurality of third training samples to obtain a ruler classification model, wherein the input of the ruler classification model is the length information image, and the output of the ruler classification model is the actual length of the line segment of the ruler.

[0075] The initial classification model can be a ResNet classification network, which is a deep convolutional neural network widely used in image classification tasks. It introduces residual connections to solve the gradient vanishing and representation bottleneck problems in deep neural network training, thereby being able to train a deeper network structure and improve the classification performance of the model. Of course, in addition to the ResNet classification network, other suitable network structures can also be selected, such as the VGGNet convolutional neural network.

[0076] For classification networks, cross entropy can be used as the loss function, which can effectively measure the difference between the predicted probability distribution and the actual label. As an optimization algorithm, Adam can adaptively adjust the learning step size to converge to the optimal solution faster. The learning rate is set to a relatively reasonable learning rate of 1e-3, which helps the model to converge stably during training. On the validation set, if the loss value no longer decreases significantly in 5 consecutive rounds, the model is judged to have converged. This convergence judgment condition helps to avoid unnecessary waste of training time and prevent the model from overfitting.

[0077] Step S105: determining the image coordinate difference between the two endpoints of the line segment image in the extending direction of the line segment.

[0078] In this application, the image coordinates of the two endpoints of the line segment image in the line segment extension direction are first determined, such as xmin_scaleplate and xmax_scaleplate, and then the image coordinate difference Pixel_length=xmax_scaleplate-xmin_scaleplate is calculated.

[0079] Step S106: Calculate the image resolution of the metallographic photograph based on the actual length of the line segment of the ruler and the image coordinate difference.

[0080] In the present application, the image resolution of the metallographic photograph can be obtained by dividing the actual length of the line segment of the ruler by the image coordinate difference image resolution.

[0081] In view of the large size of the metallographic photograph and the need to determine only the approximate position of the scale image, after obtaining the digital image of the metallographic photograph, the pixel value corresponding to each pixel in the digital image can be further compressed according to a preset compression ratio to obtain a compressed digital image, which carries the compressed scale image. Figure 6 , Figure 6 A schematic diagram of a compressed digital image of a metallographic photograph disclosed in an embodiment of the present application.

[0082] Specifically, first, for each pixel in the digital image, the coordinates of the pixel can be compressed according to a preset compression ratio to obtain the compressed coordinates of the pixel, and the four integer coordinates closest to the compressed coordinates can be determined. For ease of understanding, an example is given below: downsampling to a preset compression ratio of 1 / n of the original size by bilinear interpolation, such as n=3, the compressed coordinates of the pixel are obtained as (x, y), and the coordinates of the four pixels closest to the position are found, which are (x1, y1), (x2, y1), (x1, y2) and (x 2, ,y2).

[0083] Then, based on the compressed coordinates and the four integer coordinates, the horizontal coordinate offset and the vertical coordinate offset are calculated, and then the horizontal coordinate offset, the vertical coordinate offset and the four integer coordinates are substituted into the preset bilinear interpolation formula to obtain the compressed pixel value of the pixel. For ease of understanding, the following example is given: the horizontal coordinate offset dx = x-x1 and the vertical coordinate offset dy = y-y1, and the bilinear interpolation formula is used to calculate the compressed pixel value of the pixel

[0084] NewPixelValue=(1−dx)(1−dy)Pixel(x1,y1)+dx(1−dy)Pixel(x2,y1)+(1−dx)dyPixel(x1,y2)+dxdyPixel(x2,y2)

[0085] Finally, the compressed pixel values ​​of each pixel are combined to obtain a compressed digital image.

[0086] In summary, the present application provides a method for calculating the image resolution of a metallographic photograph. First, a digital image of the metallographic photograph is obtained, wherein the digital image carries a ruler image, and the ruler positioning model, the ruler segmentation model, and the ruler classification model are used to accurately identify the actual length of the ruler line segment and the image coordinate difference. The image resolution of the metallographic photograph is calculated based on the actual length of the ruler line segment and the image coordinate difference, thereby ensuring the accuracy of the image resolution of the metallographic photograph. In addition, the entire process of determining the image resolution of the metallographic photograph is automated and the model processing speed is fast, thereby improving the efficiency of determining the image resolution of the metallographic photograph.

[0087] On the basis of the above-mentioned embodiments disclosed in the present application, in another embodiment of the present application, a specific implementation method of inputting a digital image into a pre-set ruler positioning model to obtain a mask of the ruler image in the digital image is described in detail.

[0088] As an example of an implementation method, please refer to the attached Figure 7 , is a schematic diagram of a method disclosed in the present application for inputting a digital image into a pre-set ruler positioning model to obtain a mask of the ruler image in the digital image. The method may include the following steps:

[0089] Step S201: inputting the compressed digital image into a preset ruler positioning model to obtain a mask of the compressed ruler image in the compressed digital image.

[0090] In the present application, a plurality of fourth training samples with fourth annotation information may be obtained first, wherein the fourth annotation information includes a mask of a compressed ruler image, and each fourth training sample includes a compressed digital image. Then, the initial positioning model is trained based on the plurality of fourth training samples to obtain a ruler positioning model, wherein the input of the ruler positioning model is a compressed digital image, and the output of the ruler positioning model is a mask of the compressed ruler image in the compressed digital image.

[0091] For ease of understanding, continue with the above example: the mask of the compressed ruler image in the compressed digital image is x min 、x max ,y min and max .

[0092] Step S202: enlarging the mask of the compressed ruler image in the compressed digital image according to a preset enlargement ratio to obtain the mask of the ruler image in the digital image, wherein the preset enlargement ratio is the reciprocal of the preset compression ratio.

[0093] For ease of understanding, continue with the above example: the mask of the compressed ruler image in the compressed digital image is x min 、x max ,y min and max The mask of the compressed ruler image in the compressed digital image is enlarged according to the preset enlargement ratio n of the image to obtain the mask nx of the ruler image in the digital image. min 、nx max ,ny min andny max .

[0094] In summary, the present application provides a method for inputting a digital image into a pre-set ruler positioning model to obtain a mask of the ruler image in the digital image. The compressed digital image file size is usually small, so the computing resources (such as memory and processor time) required for processing will also be reduced accordingly. Then, by presetting the enlargement ratio, the position of the ruler image in the original uncompressed digital image can be accurately restored, thereby solving the effect of compression on positioning accuracy. The method is described in detail in the embodiments disclosed in the above-mentioned present application. The method of the present application can be implemented by various forms of devices. Therefore, the present application also discloses a data processing device based on smart contracts, and specific embodiments are given below for detailed description.

[0095] Please refer to the attached Figure 8 , Figure 8 This is a schematic diagram of the structure of a device for calculating the image resolution of a metallographic photograph disclosed in an embodiment of the present application, the device comprising:

[0096] The acquisition unit 11 is used to acquire a digital image of the metallographic photograph, wherein the digital image carries a ruler image.

[0097] The first input unit 12 is used to input the digital image into a preset ruler positioning model to obtain a mask of the ruler image in the digital image, and use the image corresponding to the mask in the digital image as the ruler image.

[0098] The second input unit 13 is used to input the ruler image into a preset ruler segmentation model to obtain a line segment image and a length information image included in the ruler image.

[0099] The third input unit 14 is used to input the length information image into a preset ruler classification model to obtain the actual length of the line segment of the ruler.

[0100] The determination unit 15 is used to determine the image coordinate difference between two end points of the line segment image in the extending direction of the line segment.

[0101] The calculation unit 16 is used to calculate the image resolution of the metallographic photograph based on the actual length of the line segment of the ruler and the image coordinate difference.

[0102] As an implementation method, the digital image includes a plurality of pixels, each pixel corresponding to a pixel value;

[0103] The device also includes:

[0104] The compression unit is used to compress the pixel value corresponding to each pixel point in the digital image according to a preset compression ratio to obtain a compressed digital image, wherein the compressed digital image carries a compressed ruler image.

[0105] The first input unit 12 for inputting the digital image into a preset ruler positioning model to obtain a mask of the ruler image in the digital image is specifically configured as follows:

[0106] The compressed digital image is input into a preset ruler positioning model to obtain a mask of the compressed ruler image in the compressed digital image; the mask of the compressed ruler image in the compressed digital image is enlarged according to a preset enlargement ratio to obtain the mask of the ruler image in the digital image, and the preset enlargement ratio and the preset compression ratio are reciprocal of each other.

[0107] As an implementable embodiment, the compression unit comprises:

[0108] The compression subunit is used to compress the coordinates of each pixel in the digital image according to a preset compression ratio to obtain the compressed coordinates of the pixel and determine the four integer coordinates closest to the compressed coordinates.

[0109] The calculation subunit is used to calculate the horizontal coordinate offset and the vertical coordinate offset based on the compressed coordinate and the four integer coordinates.

[0110] The substitution subunit is used to substitute the horizontal coordinate offset, the vertical coordinate offset and the four integer coordinates into a preset bilinear interpolation formula to obtain the compressed pixel value of the pixel point.

[0111] The combining subunit is used to combine the compressed pixel values ​​of each pixel point to obtain the compressed digital image.

[0112] As an implementable embodiment, the device further includes:

[0113] The first obtaining unit is used to obtain a plurality of first training samples with first annotation information, wherein the first annotation information includes a mask of a ruler image, and each of the first training samples includes a digital image of a metallographic photograph.

[0114] The first training unit is used to train the initial positioning model based on the plurality of the first training samples to obtain a ruler positioning model, wherein the input of the ruler positioning model is a digital image of a metallographic photograph, and the output of the ruler positioning model is a mask of the ruler image in the digital image.

[0115] As an implementable embodiment, the device further includes:

[0116] The second obtaining unit is used to obtain a plurality of second training samples with second annotation information, wherein the second annotation information includes a mask of a line segment image and a mask of a length information image, and each of the second training samples includes a ruler image.

[0117] The second training unit is used to train the initial segmentation model based on multiple second training samples to obtain a ruler segmentation model, the input of the ruler segmentation model is the image corresponding to the mask in the digital image, and the output of the ruler positioning model is the line segment image and length information image included in the ruler image.

[0118] As an implementable embodiment, the device further includes:

[0119] The third obtaining unit is used to obtain a plurality of third training samples with third annotation information, wherein the third annotation information includes the actual length of the line segment of the ruler, and each of the third training samples includes a length information image.

[0120] The third training unit is used to train the initial classification model based on the plurality of third training samples to obtain a ruler classification model, wherein the input of the ruler classification model is a length information image, and the output of the ruler classification model is the actual length of the line segment of the ruler.

[0121] Reference Fig. 9 , Fig. 9 A hardware structure block diagram of an image resolution calculation device for a metallographic photograph provided in an embodiment of the present application, the hardware structure of the image resolution calculation device for a metallographic photograph may include: at least one processor 1, at least one communication interface 2, at least one memory 3 and at least one communication bus 4.

[0122] In the embodiment of the present application, the number of the processor 1 , the communication interface 2 , the memory 3 , and the communication bus 4 is at least one, and the processor 1 , the communication interface 2 , and the memory 3 communicate with each other through the communication bus 4 .

[0123] The processor 1 may be a central processing unit CPU, or an application-specific integrated circuit ASIC (Application Specific Integrated Circuit), or one or more integrated circuits configured to implement the embodiments of the present application.

[0124] The memory 3 may include a high-speed RAM memory, and may also include a non-volatile memory (non-volatile memory), etc., for example, at least one disk memory.

[0125] The memory stores a program, and the processor can call the program stored in the memory, and the program is used to:

[0126] Acquire a digital image of the metallographic photograph, wherein the digital image carries a ruler image;

[0127] Inputting the digital image into a preset ruler positioning model to obtain a mask of the ruler image in the digital image, and using an image corresponding to the mask in the digital image as the ruler image;

[0128] Inputting the ruler image into a preset ruler segmentation model to obtain a line segment image and a length information image included in the ruler image;

[0129] Inputting the length information image into a preset ruler classification model to obtain the actual length of the line segment of the ruler;

[0130] Determine the image coordinate difference between two endpoints of the line segment image in the line segment extension direction;

[0131] The image resolution of the metallographic photograph is calculated based on the actual length of the line segment of the ruler and the image coordinate difference.

[0132] Optionally, the detailed and extended functions of the program may refer to the above description.

[0133] The embodiment of the present application further provides a readable storage medium, which may store a program suitable for execution by a processor, the program being used to:

[0134] Acquire a digital image of the metallographic photograph, wherein the digital image carries a ruler image;

[0135] Inputting the digital image into a preset ruler positioning model to obtain a mask of the ruler image in the digital image, and using an image corresponding to the mask in the digital image as the ruler image;

[0136] Inputting the ruler image into a preset ruler segmentation model to obtain a line segment image and a length information image included in the ruler image;

[0137] Inputting the length information image into a preset ruler classification model to obtain the actual length of the line segment of the ruler;

[0138] Determine the image coordinate difference between two endpoints of the line segment image in the line segment extension direction;

[0139] The image resolution of the metallographic photograph is calculated based on the actual length of the line segment of the ruler and the image coordinate difference.

[0140] Optionally, the detailed and extended functions of the program may refer to the above description.

[0141] The present application also provides a computer program product, which may store a program suitable for execution by a processor, and the program is used to:

[0142] Acquire a digital image of the metallographic photograph, wherein the digital image carries a ruler image;

[0143] Inputting the digital image into a preset ruler positioning model to obtain a mask of the ruler image in the digital image, and using an image corresponding to the mask in the digital image as the ruler image;

[0144] Inputting the ruler image into a preset ruler segmentation model to obtain a line segment image and a length information image included in the ruler image;

[0145] Inputting the length information image into a preset ruler classification model to obtain the actual length of the line segment of the ruler;

[0146] Determine the image coordinate difference between two endpoints of the line segment image in the line segment extension direction;

[0147] The image resolution of the metallographic photograph is calculated based on the actual length of the line segment of the ruler and the image coordinate difference.

[0148] Optionally, the detailed and extended functions of the program may refer to the above description.

[0149] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.

[0150] It should also be noted that the device embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. In addition, in the accompanying drawings of the device embodiments provided by the present application, the connection relationship between the modules indicates that there is a communication connection between them, which may be specifically implemented as one or more communication buses or signal lines. A person of ordinary skill in the art may understand and implement it without paying any creative effort.

[0151] Through the description of the above implementation methods, the technicians in the relevant field can clearly understand that the present application can be implemented by means of software plus necessary general hardware, and of course it can also be implemented by special hardware including special integrated circuits, special CPUs, special memories, special components, etc. In general, all functions completed by computer programs can be easily implemented by corresponding hardware, and the specific hardware structures used to implement the same function can also be various, such as analog circuits, digital circuits or special circuits. However, for the present application, software program implementation is a better implementation method in more cases. Based on such an understanding, the technical solution of the present application is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a readable storage medium, such as a computer floppy disk, a U disk, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a disk or an optical disk, etc., including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods of each embodiment of the present application.

[0152] In summary, the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application is described in detail with reference to the above embodiments, a person of ordinary skill in the art should understand that the technical solutions described in the above embodiments can still be modified, or some of the technical features can be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.

Claims

1. A method for calculating the image resolution of a metallographic photograph, characterized in that: include: Acquire a digital image of the metallographic photograph, wherein the digital image carries a ruler image; Inputting the digital image into a preset ruler positioning model to obtain a mask of the ruler image in the digital image, and using an image corresponding to the mask in the digital image as the ruler image; Inputting the ruler image into a preset ruler segmentation model to obtain a line segment image and a length information image included in the ruler image; Inputting the length information image into a preset ruler classification model to obtain the actual length of the line segment of the ruler; Determine the image coordinate difference between two endpoints of the line segment image in the line segment extension direction; The image resolution of the metallographic photograph is calculated based on the actual length of the line segment of the ruler and the image coordinate difference.

2. The method for calculating the image resolution of a metallographic photograph according to claim 1, characterized in that: The digital image includes a plurality of pixels, each pixel corresponding to a pixel value; After obtaining the digital image of the metallographic photograph, the method further comprises: Compressing the pixel value corresponding to each pixel point in the digital image according to a preset compression ratio to obtain a compressed digital image, wherein the compressed digital image carries a compressed ruler image; The step of inputting the digital image into a preset ruler positioning model to obtain a mask of the ruler image in the digital image includes: Inputting the compressed digital image into a preset ruler positioning model to obtain a mask of the compressed ruler image in the compressed digital image; The mask of the compressed ruler image in the compressed digital image is enlarged according to a preset enlargement ratio to obtain the mask of the ruler image in the digital image, wherein the preset enlargement ratio and the preset compression ratio are reciprocals of each other.

3. The method for calculating the image resolution of a metallographic photograph according to claim 2, characterized in that: The step of compressing the pixel value corresponding to each pixel point in the digital image according to a preset compression ratio to obtain a compressed digital image includes: For each pixel point in the digital image, compress the coordinates of the pixel point according to a preset compression ratio to obtain the compressed coordinates of the pixel point, and determine the four integer coordinates closest to the compressed coordinates; Based on the compressed coordinates and the four integer coordinates, a horizontal coordinate offset and a vertical coordinate offset are calculated; Substituting the horizontal coordinate offset, the vertical coordinate offset and the four integer coordinates into a preset bilinear interpolation formula to obtain a compressed pixel value of the pixel point; The compressed pixel values ​​of each of the pixel points are combined to obtain the compressed digital image.

4. The method for calculating the image resolution of a metallographic photograph according to claim 1, characterized in that: The training process of the ruler positioning model includes: Obtaining a plurality of first training samples with first annotation information, wherein the first annotation information includes a mask of a ruler image, and each of the first training samples includes a digital image of a metallographic photograph; The initial positioning model is trained based on the plurality of the first training samples to obtain a ruler positioning model, wherein the input of the ruler positioning model is a digital image of a metallographic photograph, and the output of the ruler positioning model is a mask of the ruler image in the digital image.

5. The method for calculating the image resolution of a metallographic photograph according to claim 1, characterized in that: The training process of the scale segmentation model includes: Obtaining a plurality of second training samples with second annotation information, wherein the second annotation information includes a mask of a line segment image and a mask of a length information image, and each of the second training samples includes a ruler image; The initial segmentation model is trained based on multiple second training samples to obtain a ruler segmentation model, the input of the ruler segmentation model is the image corresponding to the mask in the digital image, and the output of the ruler positioning model is the line segment image and the length information image included in the ruler image.

6. The method for calculating the image resolution of a metallographic photograph according to claim 1, characterized in that: The training process of the scale classification model includes: Obtaining a plurality of third training samples with third annotation information, wherein the third annotation information includes the actual length of the line segment of the ruler, and each of the third training samples includes a length information image; The initial classification model is trained based on the plurality of third training samples to obtain a ruler classification model, wherein the input of the ruler classification model is a length information image, and the output of the ruler classification model is the actual length of the line segment of the ruler.

7. A device for calculating the image resolution of a metallographic photograph, characterized in that: include: An acquisition unit, used for acquiring a digital image of the metallographic photograph, wherein the digital image carries a ruler image; A first input unit is used to input the digital image into a preset ruler positioning model to obtain a mask of the ruler image in the digital image, and use the image corresponding to the mask in the digital image as the ruler image; A second input unit, used for inputting the ruler image into a preset ruler segmentation model to obtain a line segment image and a length information image included in the ruler image; A third input unit is used to input the length information image into a preset ruler classification model to obtain the actual length of the line segment of the ruler; A determination unit, used to determine the image coordinate difference between two end points of the line segment image in the line segment extension direction; A calculation unit is used to calculate the image resolution of the metallographic photograph based on the actual length of the line segment of the ruler and the image coordinate difference.

8. An image resolution calculation device for metallographic photographs, characterized in that: including memory and processor; The memory is used to store programs; The processor is used to execute the program to implement each step of the method for calculating the image resolution of a metallographic photograph according to any one of claims 1 to 6.

9. A readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, each step of the method for calculating the image resolution of a metallographic photograph according to any one of claims 1 to 6 is implemented.

10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, each step of the method for calculating the image resolution of a metallographic photograph according to any one of claims 1 to 6 is implemented.