Image automatic semantic segmentation method and system

By performing grayscale histogram analysis and distance weighting on the image, the peak and valley grayscale of the image are automatically obtained, and the automatic semantic segmentation of the image is solved, which solves the problems of low manual labeling efficiency and high cost, and significantly improves the accuracy of image analysis.

CN119579890AActive Publication Date: 2025-03-07SHANDONG LANGCHAO YUNTOU INFORMATION TECH CO LTD
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202411623662.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-14
Publication Date
2025-03-07
Estimated Expiration
2044-11-14

AI Technical Summary

Technical Problem

In the prior art, the labeling process of image semantic segmentation is cumbersome and time-consuming, especially for large-scale data sets, which rely entirely on manual pixel-level labeling is inefficient and costly.

Method used

By converting the image into a grayscale map, calculating the histogram, determining the valley between the maximum peak and the second peak as the threshold, performing distance-weighted histogram processing, automatically obtaining the peak and valley bottom grayscale, performing binarization and contour extraction, and creating a mask layer to highlight the segmentation results.

Benefits of technology

It realizes automatic calculation of image grayscale peaks and valley grayscales, provides an automated semantic segmentation method, significantly improves the accuracy of image analysis and recognition, and is suitable for a variety of large-scale image data processing scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119579890A_ABST
    Figure CN119579890A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of digital image processing, and particularly provides an image automatic semantic segmentation method and system, and the method comprises the following steps: S1, converting an image into a gray-scale image, and then calculating a histogram of the obtained gray-scale image; s2, determining a gray value corresponding to the maximum peak value in the histogram as an initial reference point G1; s3, the square difference between each gray value and G1 is calculated and multiplied by the histogram value of the gray value, and a distance weighted histogram M (g) is obtained; s4, determining a gray value corresponding to a valley value between the two peak values as a threshold value T; and S5, creating a mask layer to highlight a segmentation result. Compared with the prior art, the method can remarkably improve the accuracy of image analysis and recognition.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of digital image processing, and specifically provides an automatic image semantic segmentation method and system. Background Art

[0002] In the field of image processing, semantic segmentation is a basic and critical task. In semantic segmentation, the model needs to understand the content of the image and be able to distinguish different objects and scene elements, such as people, vehicles, buildings, sky, etc., and predict the category of each pixel through pixel-level classification.

[0003] However, semantic segmentation annotation is a detailed and time-consuming process, which requires that each pixel in the image be assigned to the corresponding category. In actual operation, pixel-level details may also need to be considered to ensure that each pixel can be correctly classified. Especially for large-scale datasets, relying entirely on manual pixel-level annotation is very inefficient and costly. Summary of the invention

[0004] The present invention aims at the above-mentioned deficiencies of the prior art and provides a highly practical method for automatic semantic segmentation of images.

[0005] A further technical task of the present invention is to provide a reasonably designed, safe and applicable automatic image semantic segmentation system.

[0006] The technical solution adopted by the present invention to solve its technical problem is:

[0007] An automatic semantic segmentation method for an image has the following steps:

[0008] S1, first convert the image into a grayscale image, and then calculate the histogram of the obtained grayscale image;

[0009] S2, determine the gray value corresponding to the maximum peak in the histogram as the initial reference point G1;

[0010] S3, calculate the square difference between each gray value and G1 and multiply it by the histogram value of the gray value to obtain a distance weighted histogram M(g);

[0011] S4, determining the gray value corresponding to the valley between the two peaks as the threshold T;

[0012] S5. Create a mask layer to highlight the segmentation result.

[0013] Furthermore, in step S1, a histogram of the grayscale image is calculated to reveal the distribution of grayscale values ​​in the image. The histogram consists of two coordinate systems, the x-axis represents the grayscale value, and the y-axis represents the number of pixels and the grayscale value corresponding to the grayscale value.

[0014] Further, in step S2, the grayscale value corresponding to the maximum peak in the histogram is determined as the initial reference point G1, and the calculation formula is shown as follows:

[0015] G1 = arg max H(g);

[0016] Among them, H(g) is a grayscale histogram array.

[0017] Furthermore, in step S3, the square difference between each gray value and G1 is multiplied by the histogram value of the gray value to obtain a distance weighted histogram M(g), and the calculation formula is as follows:

[0018] M(g)=(g-G1) 2 ×H(g)

[0019] The gray value G2 corresponding to the second peak of the distance weighted histogram is obtained. The calculation formula is as follows:

[0020] G2 = arg max M(g).

[0021] Further, in step S4, the gray value corresponding to the valley value between the two peak values ​​is determined as the threshold T, and the calculation formula is shown as follows:

[0022]

[0023] It means finding the grayscale value g that minimizes the histogram H(g) in the interval [a, b] to determine the valley bottom grayscale.

[0024] Furthermore, in step S5, two peak grayscales and one valley grayscale are automatically obtained, and binarization is performed according to the applied threshold to obtain a preliminary segmentation result, and based on the binarization result, the contour image is extracted, a mask layer is created, and the segmented area is superimposed on the original image in a semi-transparent manner to highlight the segmentation result.

[0025] An automatic semantic segmentation system for an image first converts the image into a grayscale image, then calculates the histogram of the obtained grayscale image, and determines the grayscale value corresponding to the maximum peak in the histogram as an initial reference point G1;

[0026] Calculate the square difference between each gray value and G1 and multiply it by the histogram value of the gray value to obtain the distance weighted histogram M(g). Determine the gray value corresponding to the valley between the two peaks as the threshold T and create a mask layer to highlight the segmentation result.

[0027] Furthermore, a histogram of the obtained grayscale image is calculated to reveal the distribution of grayscale values ​​in the image, wherein the histogram is composed of two coordinate systems, the x-axis represents the grayscale value, and the y-axis represents the number of pixels and the grayscale value corresponding to the grayscale value, respectively;

[0028] Determine the grayscale value corresponding to the maximum peak in the histogram as the initial reference point G1. The calculation formula is as follows:

[0029] G1 = arg max H(g);

[0030] Among them, H(g) is a grayscale histogram array.

[0031] Furthermore, the square difference between each gray value and G1 is calculated and multiplied by the histogram value of the gray value to obtain the distance weighted histogram M(g). The calculation formula is shown as follows:

[0032] M(g)=(g-G1) 2 ×H(g)

[0033] The gray value G2 corresponding to the second peak of the distance weighted histogram is obtained. The calculation formula is as follows:

[0034] G2 = arg max M(g);

[0035] Determine the gray value corresponding to the valley between the two peaks as the threshold T, and the calculation formula is shown below;

[0036]

[0037] arg min means finding the grayscale value that minimizes the histogram H(g) in the interval [a, b].

[0038] g∈[a,b]

[0039] g, in order to determine the valley bottom grayscale.

[0040] Furthermore, two peak grayscales and one valley grayscale are automatically obtained, and binarization is performed according to the applied threshold to obtain a preliminary segmentation result. Based on the binarization result, the contour image is extracted, a mask layer is created, and the segmented area is superimposed on the original image in a semi-transparent manner to highlight the segmentation result.

[0041] Compared with the prior art, the automatic image semantic segmentation method and system of the present invention have the following outstanding beneficial effects:

[0042] The present invention automatically calculates the grayscale peaks of the image, that is, the number of pixels with the largest grayscale value, and automatically calculates the grayscale valley grayscale between the image peaks, that is, the number of pixels with less grayscale value than the peak value, providing an automated semantic segmentation method that is easily integrated into the existing image annotation training process.

[0043] It is suitable for a variety of large-scale image data processing scenarios, including autonomous driving, medical image analysis, robot vision, video surveillance, etc., and can significantly improve the accuracy of image analysis and recognition. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0045] Attached Figure 1 It is a grayscale histogram in the automatic semantic segmentation method of an image;

[0046] Attached Figure 2 It is the original image in the automatic semantic segmentation method of an image;

[0047] Attached Figure 3 It is a schematic diagram of a semantic segmentation mask layer in an automatic semantic segmentation method for an image. DETAILED DESCRIPTION

[0048] In order to enable those skilled in the art to better understand the solution of the present invention, the present invention is further described in detail below in conjunction with specific implementation methods. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0049] A best embodiment is given below:

[0050] An automatic image semantic segmentation method in this embodiment has the following steps:

[0051] S1, first convert the image into a grayscale image, and then calculate the histogram of the obtained grayscale image;

[0052] The histogram of the grayscale image is calculated to reveal the distribution of grayscale values ​​in the image, such as Figure 1 for Figure 2 Grayscale histogram of .

[0053] like Figure 1As shown, the histogram consists of two coordinate systems, the x-axis represents the grayscale value, and the y-axis represents the number of pixels and the grayscale value corresponding to the grayscale value.

[0054] S2, determine the gray value corresponding to the maximum peak in the histogram as the initial reference point G1;

[0055] The calculation formula is as follows:

[0056] G1=arg max H(g)

[0057] Among them, H(g) is a grayscale histogram array.

[0058] S3. Calculate the square difference between each gray value and G1 and multiply it by the histogram value of the gray value to obtain the distance weighted histogram M(g). The calculation formula is as follows:

[0059] M(g)=(g-G1) 2 ×H(g);

[0060] The gray value G2 corresponding to the second peak of the distance weighted histogram is obtained. The calculation formula is as follows:

[0061] G2 = arg max M(g).

[0062] S4, determining the gray value corresponding to the valley between the two peaks as the threshold T;

[0063] The calculation formula is shown below.

[0064]

[0065] It means finding the grayscale value g that minimizes the histogram H(g) in the interval [a,b] to determine the valley bottom grayscale.

[0066] S5, creating a mask layer to highlight the segmentation result;

[0067] like Figure 3 As shown in the figure, two peak grayscales and one valley grayscale are automatically obtained, and binarization is performed according to the applied threshold to obtain a preliminary segmentation result. Based on the binarization result, the contour image is extracted, a mask layer is created, and the segmented area is superimposed on the original image in a semi-transparent manner to highlight the segmentation result.

[0068] Based on the contour information, the semantic segmentation results can be annotated to achieve automatic image semantic segmentation annotation.

[0069] Based on the above method, an automatic semantic segmentation system for an image in this embodiment first converts the image into a grayscale image, then calculates the histogram of the obtained grayscale image, and determines the grayscale value corresponding to the maximum peak in the histogram as the initial reference point G1;

[0070] Calculate the square difference between each gray value and G1 and multiply it by the histogram value of the gray value to obtain the distance weighted histogram M(g). Determine the gray value corresponding to the valley between the two peaks as the threshold T and create a mask layer to highlight the segmentation result.

[0071] The histogram of the grayscale image is calculated to reveal the distribution of grayscale values ​​in the image. The histogram consists of two coordinate systems, the x-axis represents the grayscale value, and the y-axis represents the number of pixels and the grayscale value corresponding to the grayscale value respectively;

[0072] Determine the grayscale value corresponding to the maximum peak in the histogram as the initial reference point G1. The calculation formula is as follows:

[0073] G1 = arg max H(g);

[0074] Among them, H(g) is a grayscale histogram array.

[0075] Calculate the square difference between each gray value and G1 and multiply it by the histogram value of the gray value to obtain the distance weighted histogram M(g). The calculation formula is shown as follows:

[0076] M(g)=(g-G1) 2 ×H(g)

[0077] The gray value G2 corresponding to the second peak of the distance weighted histogram is obtained. The calculation formula is as follows:

[0078] G2 = arg max M(g);

[0079] Determine the gray value corresponding to the valley between the two peaks as the threshold T, and the calculation formula is shown below;

[0080]

[0081] It means finding the grayscale value g that minimizes the histogram H(g) in the interval [a, b] to determine the valley bottom grayscale.

[0082] Now two peak grayscales and one valley grayscale are automatically obtained, and binarization is performed according to the applied threshold to obtain the preliminary segmentation result. Based on the binarization result, the contour image is extracted, a mask layer is created, and the segmented area is superimposed on the original image in a semi-transparent manner to highlight the segmentation result.

[0083] The above-mentioned specific implementations are only specific cases of the present invention. The patent protection scope of the present invention includes but is not limited to the above-mentioned specific implementations. Any technical solutions that conform to the above-mentioned specific implementations of the present invention and any appropriate changes or substitutions made by ordinary technicians in the relevant technical field shall fall within the patent protection scope of the present invention.

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

Claims

1. A method for automatic semantic segmentation of an image, characterized in that: The steps are as follows: S1, first convert the image into a grayscale image, and then calculate the histogram of the obtained grayscale image; S2, determine the gray value corresponding to the maximum peak in the histogram as the initial reference point G1; S3, calculate the square difference between each gray value and G1 and multiply it by the histogram value of the gray value to obtain a distance weighted histogram M(g); S4, determining the gray value corresponding to the valley between the two peaks as the threshold T; S5. Create a mask layer to highlight the segmentation result.

2. The method for automatic semantic segmentation of an image according to claim 1, characterized in that: In step S1, a histogram of the grayscale image is calculated to reveal the distribution of grayscale values ​​in the image. The histogram consists of two coordinate systems, the x-axis represents the grayscale value, and the y-axis represents the number of pixels and the grayscale value corresponding to the grayscale value.

3. The method for automatic semantic segmentation of an image according to claim 2, characterized in that: In step S2, the grayscale value corresponding to the maximum peak in the histogram is determined as the initial reference point G1, and the calculation formula is as follows: G1 = arg max H(g); Among them, H(g) is a grayscale histogram array.

4. The method for automatic semantic segmentation of an image according to claim 3, characterized in that: In step S3, the square difference between each gray value and G1 is multiplied by the histogram value of the gray value to obtain a distance weighted histogram M(g). The calculation formula is as follows: M(g)=(g-G1) 2 ×H(g) The gray value G2 corresponding to the second peak of the distance weighted histogram is obtained. The calculation formula is as follows: G2 = arg max M(g).

5. The method for automatic semantic segmentation of an image according to claim 4, characterized in that: In step S4, the gray value corresponding to the valley between the two peaks is determined as the threshold T, and the calculation formula is shown as follows: It means finding the grayscale value g that minimizes the histogram H(g) in the interval [a, b] to determine the valley bottom grayscale.

6. The method for automatic semantic segmentation of an image according to claim 5, characterized in that: In step S5, two peak grayscales and one valley grayscale are automatically obtained, and binarization is performed according to the applied threshold to obtain a preliminary segmentation result. Based on the binarization result, the contour image is extracted, a mask layer is created, and the segmented area is superimposed on the original image in a semi-transparent manner to highlight the segmentation result.

7. An automatic image semantic segmentation system, characterized in that: First, the image is converted into a grayscale image, and then the histogram of the obtained grayscale image is calculated to determine the grayscale value corresponding to the maximum peak in the histogram as the initial reference point G1; Calculate the square difference between each gray value and G1 and multiply it by the histogram value of the gray value to obtain the distance weighted histogram M(g). Determine the gray value corresponding to the valley between the two peaks as the threshold T and create a mask layer to highlight the segmentation result.

8. The automatic image semantic segmentation system according to claim 7, characterized in that: The histogram of the grayscale image is calculated to reveal the distribution of grayscale values ​​in the image. The histogram consists of two coordinate systems, the x-axis represents the grayscale value, and the y-axis represents the number of pixels and the grayscale value corresponding to the grayscale value respectively; Determine the grayscale value corresponding to the maximum peak in the histogram as the initial reference point G1. The calculation formula is as follows: G1 = arg max H(g); Among them, H(g) is a grayscale histogram array.

9. The automatic image semantic segmentation system according to claim 8, characterized in that: Calculate the square difference between each gray value and G1 and multiply it by the histogram value of the gray value to obtain the distance weighted histogram M(g). The calculation formula is shown as follows: M(g)=(g-G1) 2 ×H(g) The gray value G2 corresponding to the second peak of the distance weighted histogram is obtained. The calculation formula is as follows: G2 = arg max M(g); Determine the gray value corresponding to the valley between the two peaks as the threshold T, and the calculation formula is shown below; It means finding the grayscale value g that minimizes the histogram H(g) in the interval [a, b] to determine the valley bottom grayscale.

10. The automatic image semantic segmentation system according to claim 9, characterized in that: Now two peak grayscales and one valley grayscale are automatically obtained, and binarization is performed according to the applied threshold to obtain the preliminary segmentation result. Based on the binarization result, the contour image is extracted, a mask layer is created, and the segmented area is superimposed on the original image in a semi-transparent manner to highlight the segmentation result.

Citation Information

Patent Citations

  • Mean-Shift tracking algorithm based on distance-weighted histogram

    CN106530323A

  • Image enhancement method and apparatus

    CN106780413A

  • Electrowetting display defect detection method based on gray histogram gradient weighted target variance

    CN112200800A

  • Image segmentation threshold determination method and device, terminal and storage medium

    CN112215856A

  • Infrared single small target detection method and system based on local differences and global features

    CN117953215A