A method and medium for evaluating ice lake extraction effect based on semantic segmentation
The ice lake extraction effect evaluation method of the semantic segmentation model solves the problem of unreasonable ice lake extraction effect evaluation in the existing technology by calculating the intersection and union ratio and multiplication factor of the ice lake matrix, and achieves more efficient ice lake extraction. Effectiveness evaluation.
Patent Information
- Application Number
- CN202410852786.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-28
- Publication Date
- 2024-08-27
- Estimated Expiration
- 2044-06-28
AI Technical Summary
The existing ice lake extraction model based on semantic segmentation is unreasonable when evaluating the extraction effect, resulting in poor extraction effect and failing to effectively evaluate how multiple entities under the same category intersect and union.
The ice lake extraction effect evaluation method based on semantic segmentation is used to detect connectivity by obtaining the annotated and predicted matrices, calculate the intersection and union of each pixel area, and use the multiplication factor for processing to obtain the intersection of each annotated patch. Compare and average them as evaluation indicators.
A more reasonable evaluation of the extraction effect of glacial lakes is achieved, the extraction effect is improved, and the extraction situation of different glacial lakes can be more accurately reflected, especially in the case of imbalance between classes and area size imbalance within classes.
Smart Images

Figure CN118397629B
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of object extraction based on semantic segmentation, and in particular to a method and medium for evaluating ice lake extraction effect based on semantic segmentation. Background Art
[0002] As a sensitive body of climate change, the state of glacial lakes is constantly changing. Therefore, accurate monitoring and timely detection of changes in glacial lakes can provide important evidence for the development of global climate change, and also have predictive and early warning value for the lives and property of residents and social infrastructure under the threat of glacial lake outburst disasters.
[0003] Remote sensing is often used to monitor glacial lakes. Because they are often located in high altitude areas, it is difficult to obtain direct meteorological and hydrological observation data. In the past few decades, humans have achieved surface change monitoring, resource management and environmental monitoring through satellite remote sensing. For example, Landsat and Sentinel series satellites have acquired images of the earth's surface for decades. The time span is large, the spatial distribution is wide, and the types of sensors are many. The study of these data has always been a hot topic in the current big data and artificial intelligence research.
[0004] It is a challenge for researchers to timely detect changes in glacial lakes from massive satellite images and extract knowledge from data. In recent years, with the development of big data technology, artificial intelligence algorithms and hardware computing power, computer vision has made rapid progress. Semantic segmentation models represented by U-Net, FCN, DeepLab, and HRNet have become increasingly popular and have performed well. Through training, they can calculate a classification label for each pixel in the image.
[0005] Semantic segmentation models combined with massive satellite images are an effective means of monitoring glacial lakes. More and more studies use semantic segmentation models to extract glacial lakes from satellite images.
[0006] In the current ice lake extraction model based on semantic segmentation, in order to improve the extraction effect, some solutions use the U-net model in the semantic segmentation model and adopt the self-attention mechanism to enhance the extraction effect. There are also better extraction effects by integrating the Edge structure into the U-net model, and also include better extraction effects based on the improved neural network architecture. It also includes using Zernike polynomials to generate phase-unwrapped optical images and improving the extraction effect through an improved training process. In one solution, a method for ice lake extraction that integrates spectral features and multi-scale spatial features is provided. This method is used to obtain the probability that each pixel category belongs to an ice lake pixel, and then obtain an ice lake model. By training the model, a network model for ice lake extraction is finally obtained, and the automatic extraction of ice lakes is completed by inputting remote sensing images.
[0007] However, all the above solutions use models to infer the pixel category for each pixel, and do not involve the field of how to evaluate multiple entities in the same category after classification. The evaluation method of the extraction effect directly affects the extraction effect, which leads to the problem of poor extraction effect due to the irrationality of the extraction effect evaluation method. Summary of the invention
[0008] The technical problem to be solved by the present application is to provide a method and medium for evaluating ice lake extraction effect based on semantic segmentation, which has the characteristics of being able to more reasonably evaluate the extraction effect and thus promote a higher extraction effect.
[0009] In a first aspect, an embodiment provides a method for evaluating ice lake extraction effect based on semantic segmentation, including:
[0010] Get the annotated real lake pixel grid matrix;
[0011] Performing connectivity detection on the real lake pixel grid matrix, marking each connected pixel area as a labeled spot, numbering each labeled spot, and assigning the number 0 to the background;
[0012] Get the result matrix based on semantic segmentation model training or prediction;
[0013] Performing connectivity check on the result matrix and removing isolated islands smaller than the minimum mapping unit, marking each connected pixel area as a prediction spot, numbering each prediction spot, and assigning the number 0 to the background;
[0014] Based on the maximum value of the marked spot number plus 1 and the maximum value of the predicted spot number plus 1, the maximum value is selected and used as the multiplication factor;
[0015] The multiplication factor is used as the multiplication factor of the real lake pixel grid matrix, combined with the result matrix, to obtain the multiplication matrix; or, the multiplication factor is used as the multiplication factor of the result matrix, combined with the real lake pixel grid matrix, to obtain the multiplication matrix;
[0016] Processing the magnification spots in the magnification matrix based on the multiplication magnification factor to obtain the number of each magnification spot, wherein the number of the magnification spot includes a marked number and a predicted number, thereby obtaining the intersection and union corresponding to each marked spot number;
[0017] Based on the obtained intersection and union corresponding to each labeled spot number, the intersection-and-union ratio corresponding to each labeled spot number is calculated;
[0018] The average IoU ratio corresponding to all the labeled patch numbers is averaged to obtain the average IoU ratio, and the average IoU ratio is used as the evaluation indicator for this training or prediction.
[0019] In one embodiment, the method of adding 1 to the maximum value of the marked spot number and adding 1 to the maximum value of the predicted spot number, selecting the maximum value, and using the maximum value as the multiplication factor includes:
[0020] ;
[0021] Where f represents the multiplication factor, It represents the real lake pixel grid matrix after the labeled spots are numbered. Represents the result matrix after the prediction spots are numbered.
[0022] In one embodiment, the multiplication factor is used as the multiplication factor of the real lake pixel grid matrix, and the result matrix is combined to obtain the multiplication matrix, including:
[0023] ;
[0024] Where f represents the multiplication factor, It represents the real lake pixel grid matrix after the labeled spots are numbered. It represents the result matrix after the prediction spots are numbered, and C represents the multiplication matrix.
[0025] In one embodiment, the multiplication factor is used to process the magnification spots in the magnification matrix to obtain the number of each magnification spot, and the number of the magnification spot includes a marked number and a predicted number, so as to obtain the intersection and union corresponding to each marked spot number, including:
[0026] Connectivity detection is performed on the magnification matrix, and each connected pixel region with the same pixel value is identified as a magnification spot, and each magnification spot is numbered, including: for any pixel in any magnification spot, the quotient of the pixel value of any pixel divided by the multiplication factor is used as the marked number, and the remainder of the pixel value of any pixel divided by the multiplication factor is used as the predicted number; the number composed of the marked number and the predicted number is used as the number of the any magnification spot;
[0027] For any magnification spot whose annotation number is not 0, the cumulative number of pixels of all magnification spots with the same annotation number and whose prediction number is not 0 is counted, and the cumulative number of pixels is taken as the intersection corresponding to the annotation spot number with the same annotation number;
[0028] For any magnification spot whose label number is not 0, find all magnification spots with the same label number and predicted number not 0, and count the label numbers and predicted numbers contained in these magnification spots, count the cumulative number of pixels of the magnification spots with the same label number as the first number of pixels, and count the cumulative number of pixels of the magnification spots with the same predicted number as the second number of pixels; take the difference between the sum of the first number of pixels and the second number of pixels and the intersection corresponding to the label number as the union corresponding to the label spot number with the same label number.
[0029] In one embodiment, the multiplication factor is used as the multiplication factor of the result matrix, combined with the real lake pixel grid matrix, to obtain the multiplication matrix, including:
[0030] ;
[0031] Where f represents the multiplication factor, It represents the real lake pixel grid matrix after the labeled spots are numbered. It represents the result matrix after the prediction spots are numbered, and C represents the multiplication matrix.
[0032] In one embodiment, the multiplication factor is used to process the magnification spots in the magnification matrix to obtain the number of each magnification spot, and the number of the magnification spot includes a marked number and a predicted number, so as to obtain the intersection and union corresponding to each marked spot number, including:
[0033] Connectivity detection is performed on the magnification matrix, and each connected pixel region with the same pixel value is identified as a magnification spot, and each magnification spot is numbered, including: for any pixel in any magnification spot, the quotient of the pixel value of any pixel divided by the multiplication factor is used as the predicted number, and the remainder of the pixel value of any pixel divided by the multiplication factor is used as the marked number; the number composed of the marked number and the predicted number is used as the number of the any magnification spot;
[0034] For any magnification spot whose annotation number is not 0, the cumulative number of pixels of all magnification spots with the same annotation number and whose prediction number is not 0 is counted, and the cumulative number of pixels is taken as the intersection corresponding to the annotation spot number with the same annotation number;
[0035] For any magnification spot whose label number is not 0, find all magnification spots with the same label number and predicted number not 0, and count the label numbers and predicted numbers contained in these magnification spots, count the cumulative number of pixels of the magnification spots with the same label number as the first number of pixels, and count the cumulative number of pixels of the magnification spots with the same predicted number as the second number of pixels; take the difference between the sum of the first number of pixels and the second number of pixels and the intersection corresponding to the label number as the union corresponding to the label spot number with the same label number.
[0036] In one embodiment, the calculation of the intersection-and-union ratio corresponding to each labeled spot number based on the obtained intersection and union corresponding to each labeled spot number includes:
[0037] ;
[0038] in, It represents the intersection-and-union ratio of the labeled patch numbered n. It represents the intersection of the labeled spots numbered n. It represents the union of the labeled spots numbered n, 1≤n≤N, and N represents the maximum value of the labeled spots.
[0039] In one embodiment, the average I / O ratios corresponding to all the labeled spot numbers are averaged to obtain an average I / O ratio, and the average I / O ratio is used as an evaluation indicator for this training or prediction, including:
[0040] ;
[0041] in, It represents the intersection-and-union ratio of the labeled patch numbered n. Represents the average intersection-over-union ratio, 1≤n≤N, where N represents the maximum value of the labeled patch.
[0042] In a second aspect, an embodiment provides a computer-readable storage medium, wherein the medium stores a program, and the program can be loaded by a processor and execute the ice lake extraction effect evaluation method based on semantic segmentation described in any of the above embodiments.
[0043] The beneficial effects of the present invention are:
[0044] Based on the selected multiplication factor, the annotated real lake pixel grid matrix and the result matrix obtained by training or prediction are multiplied and added to obtain the multiplication matrix. Then, the independent intersection-and-union ratio of each ice lake is calculated through the real lake pixel grid matrix, the result matrix and the multiplication matrix. Then, the average value of each independent intersection-and-union ratio is obtained to achieve a more reasonable evaluation of the extraction effect, thereby further improving the extraction effect. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] Figure 1 This is a schematic diagram of a real ice lake in one embodiment of the present application;
[0046] Figure 2 This is a flow chart of a method for evaluating ice lake extraction effect based on semantic segmentation according to an embodiment of the present application;
[0047] Figure 3 This application Figure 2 A method flow chart of an embodiment of step S70;
[0048] Figure 4 This application Figure 2 FIG. 5 is a schematic diagram of a method flow chart of another embodiment of step S70 in FIG. DETAILED DESCRIPTION
[0049] The present invention is further described in detail below by specific embodiments in conjunction with the accompanying drawings. Wherein similar elements in different embodiments adopt associated similar element numbers. In the following embodiments, many detailed descriptions are for making the present application better understood. However, those skilled in the art can easily recognize that some features can be omitted in different situations, or can be replaced by other elements, materials, methods. In some cases, some operations related to the present application are not shown or described in the specification, this is to avoid the core part of the present application being overwhelmed by too much description, and for those skilled in the art, it is not necessary to describe these related operations in detail, and they can fully understand the related operations according to the description in the specification and the general technical knowledge in the art.
[0050] In addition, the features, operations or characteristics described in the specification can be combined in any appropriate manner to form various implementations. At the same time, the steps or actions in the method description can also be interchanged or adjusted in a manner that is obvious to those skilled in the art. Therefore, the various sequences in the specification and the drawings are only for the purpose of clearly describing a certain embodiment and are not meant to be a required sequence, unless otherwise specified that a certain sequence must be followed.
[0051] The serial numbers assigned to the components in this article, such as "first", "second", etc., are only used to distinguish the objects described and do not have any order or technical meaning.
[0052] To facilitate the description of the inventive concept of the present application, the extraction effect evaluation technology is briefly described below.
[0053] In the field of semantic segmentation, the technology that is currently of particular interest in evaluating segmentation effects is to use the average intersection over union (IoU) of each type of pixel to evaluate segmentation effects. The intersection over union (IoU) comes from set operations in mathematics and is used to measure the degree of similarity between two sets A and B, including:
[0054] ;
[0055] Semantic segmentation uses this IoU metric to evaluate the performance of the model. In practice, the IoU of each category of pixels is calculated through the confusion matrix in Table 1, and then the average IoU of multiple categories is taken as the basis for comparison. The confusion matrix in Table 1 includes three types of semantic segmentation results, where the numbers represent the number of pixels. In Table 1, the IoU of the A pixel category is 1000 / (1000+5+20+10+10)=95.7%, the IoU of the B pixel category is 100 / (5+100+15+10+0)=76.9%, and the IoU of the C pixel category is 100 / (20+0+100+15+10)=69.0%, so the overall average IoU is 80.5%.
[0056] Table 1
[0057] .
[0058] However, the applicant found in the research that the above evaluation index calculated by the total number of pixels of each type has the following two problems:
[0059] First, there is the problem of class imbalance. Usually, there are far more background pixels than extracted pixels (lakes, mountain shadows, clouds, cloud shadows, etc.). Mistaking a background pixel for an ice lake and mistaking a mountain shadow pixel for an ice lake have different effects.
[0060] Second, the size of each instance in a class is unbalanced. Taking ice lake extraction as an example, the impact of wrong or missed extraction on a large lake or a small lake is different. Figure 1 In Example 1, there are four ice lakes A, B, C, and D in the field of view, and their pixel area sizes are 2409, 25157, 21, and 17 pixel units, respectively. Suppose that when a semantic segmentation model predicts it, exactly 17 pixels are missed. If this error occurs in Lake B, it will be considered that the impact is not significant and acceptable. If the missing 17 pixels occur in Lake D, causing Lake D to disappear, it will be unacceptable. The current average intersection-over-union ratio evaluation indicator defaults to calculating the intersection-over-union ratio based on the total amount of each type of pixels. Because the total amount is the same, it cannot reflect this difference.
[0061] In view of this, an embodiment of the present application provides an ice lake extraction effect evaluation method and medium based on semantic segmentation. The calculation is no longer based on the total number of classified pixels, but based on the selected multiplication factor, the labeled real lake pixel grid matrix and the result matrix obtained by training or prediction are multiplied and added to obtain a multiplication matrix. Then, the independent intersection-and-union ratio of each ice lake is calculated through the real lake pixel grid matrix, the result matrix and the multiplication matrix, and then the average value of each independent intersection-and-union ratio is obtained to achieve a more reasonable evaluation of the extraction effect, thereby improving the extraction effect.
[0062] An evaluation method for ice lake extraction effect based on semantic segmentation is provided in one embodiment of the present application. Please refer to Figure 2 ,include:
[0063] Step S10, obtaining the labeled real lake pixel grid matrix.
[0064] For a clear understanding, the following Figure 1 The four ice lakes included in the embodiment shown are used as an example for explanation. Figure 1 The actual lake volume pixel grid matrix of the four glacial lakes marked in Figure 2.
[0065] Step S20, performing connectivity detection on the real lake pixel grid matrix, marking each connected pixel area as a labeled spot, numbering each labeled spot, and assigning the number 0 to the background.
[0066] In one embodiment, based on Figure 1 In the embodiment, the connectivity of pixels is detected based on the connected region labeling method to obtain four ice lakes. The following description is given by assuming that the labeled spots of ice lake A are numbered 1, the labeled spots of ice lake B are numbered 2, the labeled spots of ice lake C are numbered 3, and the labeled spots of ice lake D are numbered 4, wherein the labeled spots of the background are numbered 0. Then, a real lake pixel grid matrix with five numbers 0, 1, 2, 3, and 4 is obtained.
[0067] Step S30, obtaining a result matrix based on semantic segmentation model training or prediction.
[0068] Step S40, performing connectivity check on the result matrix and removing isolated islands smaller than the minimum mapping unit, marking each connected pixel area as a predicted spot, numbering each predicted spot, and assigning the number 0 to the background.
[0069] In one embodiment, it is assumed that the ice lake B is identified as two ice lakes, B1 and B2, and the following description is given with the predicted spot number of ice lake B1 being 1, the predicted spot number of ice lake B2 being 2, the predicted spot number of ice lake A being 3, the predicted spot number of ice lake C being 4, and the predicted spot number of ice lake D being 5, wherein the predicted spot number of the background is 0. Then, a result matrix having six numbers of 0, 1, 2, 3, 4, and 5 is obtained.
[0070] Step S50, based on the maximum value of the marked spot number plus 1 and the maximum value of the predicted spot number plus 1, the maximum value is selected and used as the multiplication factor.
[0071] In one embodiment, the maximum value of the marked spot number 4 plus 1 is used to obtain the number 5, and the maximum value of the predicted spot number 5 plus 1 is used to obtain the number 6. In one embodiment, the maximum value 6 of the obtained numbers can be used as a multiplication factor.
[0072] However, the applicant has found in research that in many cases, if the maximum value of the two numbers is directly used as the multiplication factor, the calculation efficiency of the computer is low. Therefore, in one embodiment, the above step S50 includes:
[0073] ;
[0074] Where f represents the multiplication factor, It represents the real lake pixel grid matrix after the labeled spots are numbered. Represents the result matrix after the prediction spots are numbered.
[0075] Thus, when the maximum value is 2 16 , then 2 16 As a multiplication factor to improve computational efficiency, when the maximum value is not 2 16 When , the maximum value of the number obtained by adding 1 to the maximum value of the marked spot number and the maximum value of the number obtained by adding 1 to the maximum value of the predicted spot number is used as the multiplication factor.
[0076] Step S60, using the multiplication factor as the multiplication factor of the real lake pixel grid matrix, combined with the result matrix, to obtain the multiplication matrix; or, using the multiplication factor as the multiplication factor of the result matrix, combined with the real lake pixel grid matrix, to obtain the multiplication matrix.
[0077] In one embodiment, the first method is adopted to use the multiplication factor as the multiplication factor of the real lake pixel grid matrix, and combine the result matrix to obtain the multiplication matrix, including:
[0078] ;
[0079] Where f represents the multiplication factor, It represents the real lake pixel grid matrix after the labeled spots are numbered. It represents the result matrix after the prediction spots are numbered, and C represents the multiplication matrix.
[0080] In one embodiment, the second method is adopted to use the multiplication factor as the multiplication factor of the result matrix, and combine it with the real lake pixel grid matrix to obtain the multiplication matrix, including:
[0081] .
[0082] Step S70, processing the magnification spots in the magnification matrix based on the multiplication magnification factor to obtain the number of each magnification spot, the number of the magnification spot includes the marked number and the predicted number, so as to obtain the intersection and union corresponding to each marked spot number.
[0083] With a multiplication factor of 2 16 For example, in the case where the magnification matrix is obtained by the above method, in one embodiment, please refer to Figure 3 , step S70 comprises:
[0084] Step S7011, perform connectivity check on the magnification matrix, identify each connected pixel area with the same pixel value as a magnification spot, and number each magnification spot, including: for any pixel in any magnification spot, use the quotient of the pixel value of any pixel divided by the multiplication factor as the labeling number, and the remainder of the pixel value of any pixel divided by the multiplication factor as the predicted number; and use the number composed of the labeling number and the predicted number as the number of the any magnification spot.
[0085] In combination with the above embodiment, there are five cases of marked numbers, namely 0, 1, 2, 3 and 4, and six cases of predicted numbers, namely 0, 1, 2, 3, 4 and 5.
[0086] In one embodiment, based on the annotated spots numbered 2 in the real lake pixel grid matrix and the predicted spots numbered 1 and 2 in the result matrix, five magnification spots numbered (2, 0), (2, 1), (2, 2), (0, 2) and (0, 1) can be obtained in the magnification matrix, wherein the numbering of the magnification spots, the front number is the annotated number, and the rear number is the predicted number. Those skilled in the art can understandably change the positions, using the front number as the predicted number and the rear number as the annotated number, which is also within the protection scope of the present application.
[0087] In conventional technology, each pixel is processed and then statistically accumulated one by one. In the embodiment of the present application, the area with the same pixel value is regarded as a spot, and the characteristics of one of the pixels are used as the characteristics of the spot, which improves the processing efficiency of the computer and saves computer resources.
[0088] Step S7012: for any magnification spot whose label number is not 0, count the cumulative number of pixels of all magnification spots with the same label number and predicted number not 0, and use the cumulative number of pixels as the intersection corresponding to the label spot number with the same label number.
[0089] According to the five magnification spots numbered (2, 0), (2, 1), (2, 2), (0, 2) and (0, 1) in the above embodiment, the number of pixels contained in the magnification spots numbered (2, 1) and (2, 2) can be used as the intersection corresponding to the labeled spot number 2. If the number of pixels of the magnification spot numbered (2, 1) is 147 and the number of pixels of the magnification spot numbered (2, 2) is 25000, the intersection corresponding to the labeled spot number 2 is 25147.
[0090] Step S7013, obtaining the union corresponding to any non-zero labeled spot number.
[0091] For any magnification spot whose label number is not 0, find all magnification spots with the same label number and predicted number not 0, and count the label numbers and predicted numbers contained in these magnification spots, count the cumulative number of pixels of the magnification spots with the same label number as the first number of pixels, and count the cumulative number of pixels of the magnification spots with the same predicted number as the second number of pixels; take the difference between the sum of the first number of pixels and the second number of pixels and the intersection corresponding to the label number as the union corresponding to the label spot number with the same label number.
[0092] According to the five magnification spots numbered (2, 0), (2, 1), (2, 2), (0, 2) and (0, 1) in the above embodiment, it can be found that among all the magnification spots whose labeled number is 2 and whose predicted number is not 0, there are two magnification spots numbered (2, 1) and (2, 2). In these two magnification spots, the labeled number is 2 and the predicted numbers are 1 and 2. The cumulative number of pixels of the magnification spots with the same annotation number 2 (three magnification spots numbered (2, 0), (2, 1) and (2, 2)) is counted as the first number of pixels, and the cumulative number of pixels of the magnification spots with the same prediction number (including the two magnification spots (2, 1) and (0, 1) with prediction number 1 and the two magnification spots (2, 2) and (0, 2) with prediction number 2) is counted as the second number of pixels; the difference between the sum of the first number of pixels and the second number of pixels and the intersection corresponding to the annotation number is taken as the union corresponding to the annotation spot number 2 with the same annotation number.
[0093] In this way, the intersection and union corresponding to the labeled spot number 2 are obtained. Similarly, the intersection and union corresponding to the labeled spot numbers 1, 3, and 4 can be obtained.
[0094] With a multiplication factor of 2 16 For example, when the multiplication matrix is obtained by the above method 2, in one embodiment, please refer to Figure 4 , step S70 comprises:
[0095] Step S7021, perform connectivity check on the magnification matrix, identify each connected pixel area with the same pixel value as a magnification spot, and number each magnification spot, including: for any pixel in any magnification spot, use the quotient of the pixel value of any pixel divided by the multiplication factor as the predicted number, and the remainder of the pixel value of any pixel divided by the multiplication factor as the labeled number; and use the number composed of the labeled number and the predicted number as the number of the any magnification spot.
[0096] In combination with the above embodiment, there are five cases of marked numbers, namely 0, 1, 2, 3 and 4, and six cases of predicted numbers, namely 0, 1, 2, 3, 4 and 5.
[0097] Step S7022: for any magnification spot whose label number is not 0, count the cumulative number of pixels of all magnification spots with the same label number and predicted number not 0, and use the cumulative number of pixels as the intersection corresponding to the label spot number with the same label number.
[0098] Step S7023, obtaining the union corresponding to any non-zero labeled spot number.
[0099] For any magnification spot whose label number is not 0, find all magnification spots with the same label number and predicted number not 0, and count the label numbers and predicted numbers contained in these magnification spots, count the cumulative number of pixels of the magnification spots with the same label number as the first number of pixels, and count the cumulative number of pixels of the magnification spots with the same predicted number as the second number of pixels; take the difference between the sum of the first number of pixels and the second number of pixels and the intersection corresponding to the label number as the union corresponding to the label spot number with the same label number.
[0100] Step S80, calculating the intersection-to-union ratio corresponding to each labeled spot number based on the obtained intersection and union corresponding to each labeled spot number.
[0101] In one embodiment, step S80 includes:
[0102] ;
[0103] in, It represents the intersection-and-union ratio of the labeled patch numbered n. It represents the intersection of the labeled spots numbered n. It represents the union of the labeled spots numbered n, 1≤n≤N, and N represents the maximum value of the labeled spots.
[0104] In this way, the intersection-over-union ratio of each labeled patch number can be obtained.
[0105] Step S90, averaging the IoUs corresponding to all the labeled spot numbers to obtain an average IoU, and using the average IoU as an evaluation indicator for this training or prediction.
[0106] In one embodiment, step S90 includes:
[0107] ;
[0108] in, It represents the intersection-and-union ratio of the labeled patch numbered n. Represents the average intersection-over-union ratio, 1≤n≤N, where N represents the maximum value of the labeled patch.
[0109] Through the scheme of any of the above embodiments, based on the selected multiplication factor, the annotated real lake pixel grid matrix and the result matrix obtained by training or prediction are multiplied and added to obtain a multiplication matrix, and then the independent intersection-and-union ratio of each ice lake is calculated through the real lake pixel grid matrix, the result matrix and the multiplication matrix, and then the average value of each independent intersection-and-union ratio is obtained to achieve a more reasonable evaluation of the extraction effect, thereby further improving the extraction effect.
[0110] In one embodiment of the present application, a computer-readable storage medium is provided, on which a program is stored. The stored program includes a method that can be loaded by a processor and process any of the above embodiments.
[0111] Those skilled in the art will appreciate that all or part of the functions of the various methods in the above-mentioned embodiments can be implemented by hardware or by computer programs. When all or part of the functions in the above-mentioned embodiments are implemented by computer programs, the program can be stored in a computer-readable storage medium, and the storage medium can include: read-only memory, random access memory, disk, optical disk, hard disk, etc., and the program is executed by a computer to implement the above-mentioned functions. For example, the program is stored in the memory of the device, and when the program in the memory is executed by the processor, all or part of the above-mentioned functions can be implemented. In addition, when all or part of the functions in the above-mentioned embodiments are implemented by computer programs, the program can also be stored in a storage medium such as a server, another computer, disk, optical disk, flash disk or mobile hard disk, and can be downloaded or copied and saved in the memory of the local device, or the system of the local device is updated, and when the program in the memory is executed by the processor, all or part of the functions in the above-mentioned embodiments can be implemented.
[0112] The above specific examples are used to illustrate the present invention, which is only used to help understand the present invention and is not intended to limit the present invention. For those skilled in the art, according to the concept of the present invention, some simple deductions, modifications or substitutions can be made.
Claims
1. A method for evaluating the effect of ice lake extraction based on semantic segmentation, characterized in that: include: Get the labeled real lake pixel grid matrix; Performing connectivity detection on the real lake pixel grid matrix, marking each connected pixel area as a labeled spot, numbering each labeled spot, and assigning the number 0 to the background; Get the result matrix based on semantic segmentation model training or prediction; Performing connectivity check on the result matrix and removing isolated islands smaller than the minimum mapping unit, marking each connected pixel area as a prediction spot, numbering each prediction spot, and assigning the number 0 to the background; Based on the maximum value of the marked spot number plus 1 and the maximum value of the predicted spot number plus 1, the maximum value is selected and used as the multiplication factor; The multiplication factor is used as the multiplication factor of the real lake pixel grid matrix, and combined with the result matrix to obtain a multiplication matrix; Or, the multiplication factor is used as the multiplication factor of the result matrix, combined with the real lake pixel grid matrix, to obtain a multiplication matrix; Processing the magnification spots in the magnification matrix based on the multiplication magnification factor to obtain the number of each magnification spot, wherein the number of the magnification spot includes a marked number and a predicted number, thereby obtaining the intersection and union corresponding to each marked spot number; Based on the obtained intersection and union corresponding to each labeled spot number, the intersection-and-union ratio corresponding to each labeled spot number is calculated; The average intersection-and-union ratio corresponding to all the labeled spot numbers is averaged to obtain the average intersection-and-union ratio, and the average intersection-and-union ratio is used as the evaluation index for this training or prediction; When the multiplication factor is used as the multiplication factor of the real lake pixel grid matrix and combined with the result matrix to obtain the multiplication matrix, the multiplication spots in the multiplication matrix are processed based on the multiplication factor to obtain the number of each multiplication spot, and the number of the multiplication spot includes the marked number and the predicted number, so as to obtain the intersection and union corresponding to each marked spot number, including: Connectivity detection is performed on the magnification matrix, and each connected pixel region with the same pixel value is identified as a magnification spot, and each magnification spot is numbered, including: for any pixel in any magnification spot, the quotient of the pixel value of any pixel divided by the multiplication factor is used as the marked number, and the remainder of the pixel value of any pixel divided by the multiplication factor is used as the predicted number; the number composed of the marked number and the predicted number is used as the number of the any magnification spot; For any magnification spot whose annotation number is not 0, the cumulative number of pixels of all magnification spots with the same annotation number and whose prediction number is not 0 is counted, and the cumulative number of pixels is taken as the intersection corresponding to the annotation spot number with the same annotation number; For any magnification spot whose label number is not 0, find all magnification spots with the same label number and predicted number that is not 0, and count the label numbers and predicted numbers contained in these magnification spots, count the cumulative number of pixels of the magnification spots containing the same label number as the first number of pixels, and count the cumulative number of pixels of the magnification spots containing the same predicted number as the second number of pixels; take the difference between the sum of the first number of pixels and the second number of pixels minus the intersection corresponding to the label number as the union corresponding to the label spot number with the same label number; When the multiplication factor is used as the multiplication factor of the result matrix and combined with the real lake pixel grid matrix to obtain the multiplication matrix, the multiplication spots in the multiplication matrix are processed based on the multiplication factor to obtain the number of each multiplication spot, and the number of the multiplication spot includes the marked number and the predicted number, so as to obtain the intersection and union corresponding to each marked spot number, including: Connectivity detection is performed on the magnification matrix, and each connected pixel region with the same pixel value is identified as a magnification spot, and each magnification spot is numbered, including: for any pixel in any magnification spot, the quotient of the pixel value of any pixel divided by the multiplication factor is used as the predicted number, and the remainder of the pixel value of any pixel divided by the multiplication factor is used as the marked number; the number composed of the marked number and the predicted number is used as the number of the any magnification spot; For any magnification spot whose annotation number is not 0, the cumulative number of pixels of all magnification spots with the same annotation number and whose prediction number is not 0 is counted, and the cumulative number of pixels is taken as the intersection corresponding to the annotation spot number with the same annotation number; For any magnification spot whose label number is not 0, find all magnification spots with the same label number and predicted number not 0, and count the label numbers and predicted numbers contained in these magnification spots, count the cumulative number of pixels of the magnification spots with the same label number as the first number of pixels, and count the cumulative number of pixels of the magnification spots with the same predicted number as the second number of pixels; take the difference between the sum of the first number of pixels and the second number of pixels and the intersection corresponding to the label number as the union corresponding to the label spot number with the same label number.
2. The ice lake extraction effect evaluation method based on semantic segmentation according to claim 1, characterized in that: The method of adding 1 to the maximum value of the marked spot number and adding 1 to the maximum value of the predicted spot number, selecting the maximum value, and using the maximum value as the multiplication factor includes: ; Where f represents the multiplication factor, It represents the real lake pixel grid matrix after the labeled spots are numbered. Represents the result matrix after the prediction spots are numbered.
3. The ice lake extraction effect evaluation method based on semantic segmentation according to claim 1, characterized in that: The multiplication factor is used as the multiplication factor of the real lake pixel grid matrix, and the result matrix is combined to obtain the multiplication matrix, including: ; Where f represents the multiplication factor, It represents the real lake pixel grid matrix after the labeled spots are numbered. It represents the result matrix after the prediction spots are numbered, and C represents the multiplication matrix.
4. The ice lake extraction effect evaluation method based on semantic segmentation according to claim 1, characterized in that: The multiplication factor is used as the multiplication factor of the result matrix, and combined with the real lake pixel grid matrix to obtain the multiplication matrix, including: ; Where f represents the multiplication factor, It represents the real lake pixel grid matrix after the labeled spots are numbered. It represents the result matrix after the prediction spots are numbered, and C represents the multiplication matrix.
5. The ice lake extraction effect evaluation method based on semantic segmentation according to claim 1, characterized in that: The calculation of the intersection-and-union ratio corresponding to each labeled spot number based on the obtained intersection and union corresponding to each labeled spot number includes: ; in, It represents the intersection-and-union ratio of the labeled patch numbered n. It represents the intersection of the labeled spots numbered n. It represents the union of the labeled spots numbered n, 1≤n≤N, and N represents the maximum value of the labeled spots.
6. The ice lake extraction effect evaluation method based on semantic segmentation according to claim 1, characterized in that:The said averaging the intersection-and-union ratios corresponding to all the labeled spot numbers to obtain an average intersection-and-union ratio, and using the average intersection-and-union ratio as an evaluation indicator for this training or prediction, includes: ; in, It represents the intersection-and-union ratio of the labeled patch numbered n. Represents the average intersection-over-union ratio, 1≤n≤N, where N represents the maximum value of the labeled patch.
7. A computer-readable storage medium, characterized in that: The medium stores a program, which can be loaded by a processor and execute the ice lake extraction effect evaluation method based on semantic segmentation as described in any one of claims 1 to 6.
