Confusion matrix automatic generation method for AI segmentation

By automatically generating a confusion matrix using AI segmentation algorithms, the lack of flexibility and visualization in existing technologies is solved, enabling customized processing and efficient evaluation of complex situations, thereby improving the accuracy of image segmentation results and user experience.

CN119295487APending Publication Date: 2025-01-10BEIJING FOCUSIGHT TECH
View PDF 0 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

Existing image segmentation algorithms lack flexibility and adaptability when dealing with complex situations, cannot be customized, and lack visualization support, resulting in low accuracy and efficiency of segmentation results.

Method used

An automatic generation method for confusion matrix in AI segmentation is adopted. By setting the inflation decision coefficient, obtaining the IOU, labeling the color and the coordinates of the circumscribed rectangle, and customizing the decision rules according to the requirements, the method calculates the categories of over-detection, under-detection, and normal detection, and generates a multi-category confusion matrix to provide a visual display of the defect location.

Benefits of technology

It improves the efficiency and accuracy of automated evaluation of AI image segmentation results, supports flexible parameter adjustment to adapt to different application scenarios, and enhances user experience and ease of operation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119295487A_ABST
    Figure CN119295487A_ABST
Patent Text Reader

Abstract

The invention relates to a confusion matrix automatic generation method for AI segmentation, and the method comprises the following steps: S1, setting an expansion judgment coefficient according to a demand; s2, acquiring IOU (Input / Output Unit), annotation colors, annotations and external rectangle coordinates corresponding to the annotation image and the segmented image; s3, customizing judgment rules under complex conditions according to requirements; s4, calculating types and numbers of over-killing, missing detection, normal detection and incomplete detection, counting the numbers of over-killing, missing detection, normal detection and incomplete detection in different types, and generating a multi-type confusion matrix according to the types; and S5, giving the coordinates of the external rectangles of over-killing, missing detection, normal detection and incomplete detection to a UI (User Interface) display interface. The confusion matrix is automatically generated through the AI segmentation algorithm, manual intervention is eliminated, and efficiency and accuracy are improved; outputting a plurality of indexes such as IOU (Input / Output Unit), marking colors and bounding rectangular frames, and supporting the generation of a multi-category confusion matrix; the labor cost is saved, and the user experience and the operation convenience are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of image processing, and in particular to a method for automatically generating a confusion matrix for AI segmentation. Background Art

[0002] In the existing image processing technology, the image is segmented and inferred to obtain the results; based on the segmentation and inference results, the IOU value is directly calculated as the evaluation index; the area that meets the threshold is judged as a normal detection, and the area that does not meet the threshold is judged as an incomplete detection; the cases with annotations but no inference results and with inference results but no annotations are handled separately, and missed detection and over-kill are judged; the scene with annotations but no inference results is judged as missed detection; the area with inference results but no annotation is judged as over-kill.

[0003] However, the prior art has the following disadvantages and problems:

[0004] (1) Simple judgment rules:

[0005] Existing technologies are designed for simple situations, making trade-offs between reducing algorithm complexity and improving computational efficiency. Complex situations require more sophisticated algorithm design and more reasonable processing logic.

[0006] The simple IOU threshold determination limits the accuracy and detail of the segmentation results and cannot handle more complex situations, such as the complex situation of the intersection of the same annotated area and multiple segmentation results, the complex situation of the intersection of multiple annotated areas and the same segmentation result, and the complex situation of multiple inference results that may be the same target.

[0007] (2) Fixed IOU threshold:

[0008] Fixed IOU thresholds are usually used to simplify processing and reduce parameter settings, but this fixity limits the flexibility of the algorithm in different scenarios.

[0009] The IOU threshold cannot be adjusted according to task requirements and actual conditions, and customized adjustments cannot be made for specific tasks, which limits the optimization and customized processing of segmentation results.

[0010] (3) Poor visualization ability:

[0011] Existing technologies may focus more on algorithm performance and ignore the needs of user interaction and visualization. The lack of comprehensive consideration of user needs leads to insufficient visual support in the process of problem diagnosis and solution.

[0012] The lack of display of defect locations may make it difficult for users to locate problem areas, and they may not be able to accurately find the specific location of the problem in the segmentation results, reducing the efficiency of problem troubleshooting and repair.

[0013] (4) Poor adaptability:

[0014] The lack of adaptability is because the algorithm is not designed with the complexity of the specific scenario in mind, or is limited by the diversity of the dataset and insufficient coverage of test samples.

[0015] This method lacks flexibility and cannot easily adapt to and handle image segmentation requirements in various scenarios. It is difficult to conduct detailed evaluation of specific tasks, such as the need to determine whether similar objects are the same target, the need to customize the determination of multiple annotations and single inference results, and the need to customize the determination of single annotations and multiple inference results. It cannot generate multi-category confusion matrices with multiple defects. Summary of the invention

[0016] The technical problem to be solved by the present invention is: to provide a method for automatically generating a confusion matrix for AI segmentation, which solves the problems that the generation of confusion matrices in traditional processing segmentation algorithms requires manual intervention, which is time-consuming and labor-intensive; there is a lack of automated tools to quickly evaluate the accuracy of AI image segmentation results; it is difficult to objectively evaluate the consistency and accuracy of reasoning results and annotation results; there is a lack of the function of generating a multi-category confusion matrix with multiple defects in a single image; there is a lack of versatility and customization, and it is difficult to adapt to different engineering application requirements.

[0017] The technical solution adopted by the present invention to solve the technical problem is: a method for automatically generating a confusion matrix for AI segmentation, comprising the following steps:

[0018] S1. Set the expansion determination coefficient according to demand;

[0019] S2, obtain the IOU, annotation color, annotation and circumscribed rectangle coordinates corresponding to the annotated image and the segmented image;

[0020] S3. Customize the judgment rules in complex situations according to needs;

[0021] S4, calculating the categories and numbers of over-kill, missed detection, normal detection and incomplete detection, and counting the numbers of over-kill, missed detection, normal detection and incomplete detection in different categories, and then generating a multi-category confusion matrix according to the categories;

[0022] S5. Provide the coordinates of the bounding rectangle of each over-detection, missed detection, normal detection and incomplete detection to the UI display interface.

[0023] Furthermore, in step S1 of the present invention, a threshold value of the expansion coefficient is used to determine whether two similar targets are the same object.

[0024] Furthermore, in step S3 of the present invention, the determination rule in complex situations is:

[0025] 1) If the same annotated area and multiple segmentation results have an intersection, the segmentation area with the maximum IOU value is selected as the corresponding relationship with the annotated area, and the over-detection, missed detection, normal detection, and incomplete detection are classified; or the IOU, annotation color, and the circumscribed rectangle of the annotation and segmentation of the annotated area and all segmented areas are selected and classified;

[0026] 2) If multiple annotated regions intersect with the same segmentation result, select the annotated region with the maximum IOU value and output a unique result, or select all annotated regions;

[0027] 3) Labels of different colors are classified by category.

[0028] Furthermore, in step S4 of the present invention, the calculation method includes the following steps:

[0029] (1) Create four feature containers: to store the four features of IOU, label color, label and segmentation bounding rectangle;

[0030] (2) Image preprocessing: read a label image and a segmentation image, and determine the number of label and segmentation image channels;

[0031] (3) Features are calculated in four cases: the number of connected regions extracted by label and segmentation is 0, the number of connected regions of label is 0 but the number of connected regions of segmentation is not 0, the number of connected regions of label is not 0 but the number of connected regions of segmentation is 0, and the number of connected regions of both label and segmentation is not 0.

[0032] (4) Perform feature extraction in each case.

[0033] Furthermore, in step S4 of the present invention, the method for generating a multi-category confusion matrix is:

[0034] I. Traverse the feature results corresponding to each image;

[0035] II. Take out the marked color of the first position;

[0036] III. Judge iou=0: if there is a marked bounding rectangle, it is judged as missed detection, otherwise it is judged as over-detection, and the result is written into the corresponding color position of the confusion matrix, and the coordinates of the marked or segmented bounding rectangle are given;

[0037] IV. Judge iou>0: If a marked area corresponds to multiple segmented areas, choose to take the maximum iou value and output the result, or choose to output all results according to the needs; if multiple marked areas correspond to a single segmented area, choose to take the maximum iou value and output the result, or choose to output all results; if none of the above situations occurs, directly judge it as normal detection according to iou>threshold, and judge it as incomplete detection according to iou<threshold.

[0038] Furthermore, in step (4) of the present invention, when the number of connected regions of the label map label and the segmentation map segmentation is not 0, the feature extraction method is:

[0039] A. Traverse each labeled connected domain and generate an empty region have_compared_RegionG to save the processed segmented region; calculate the intersection of a selected label connected domain and label_region; calculate the center point of the intersection, and first find the corresponding region A in the segmentation map according to the center point;

[0040] B. If region A is found, the intersection of region A and seg_region is calculated and saved in have_compared_RegionG; then the iou value of the intersection and region A and the minimum enclosing rectangle predict_bbox of the segmentation are calculated; finally, the intersection area is connected, each intersection connected area is traversed, and the coordinates of the label enclosing rectangle tag_bbox and the color tag_color are calculated;

[0041] C. If region A is not found, the selected label connected domain is intersected with all seg_dilatation_region regions;

[0042] If the intersection is empty, the output iou value is 0, predict_bbox = [0,0,0,0]; connect the intersection area and traverse, calculate the label color tag_color of the intersection connected domain, and label the circumscribed rectangle coordinates tag_bbox;

[0043] If the intersection is not empty, traverse the intersection area; first find the area B corresponding to the point in the segmented area seg_region according to the point in each intersection area; then calculate the iou value and the outer rectangle coordinates predict_bbox of the intersection area and area B; finally connect the intersection area and traverse, calculate the label color tag_color and the label outer rectangle coordinates tag_bbox;

[0044] D. Subtract the processed have_compared_RegionG region from the unexpanded segmented region seg_region to obtain the unprocessed segmented region C; calculate the area of ​​region C;

[0045] If the area is greater than 0, then expand region C to obtain region D; connect region D and traverse each connected domain of D; calculate the intersection of the connected domain of D and the labeled original region label_region;

[0046] If there is no intersection, then output tag_color = "000000000", iou value is 0, tag_bbox = [0,0,0,0], and calculate the circumscribed rectangle coordinates predict_bbox of the dilated area C;

[0047] If there is an intersection, traverse each connected domain of the intersection, and find a connected domain E corresponding to the point in the labeled area label_region according to the points of each connected domain of the intersection. Finally, merge all connected domains E into area F; connect area F and traverse each F connected domain, and find the intersection of the F connected domain and label_region to get area G, calculate the intersection of each F connected domain and the segmented area C, and calculate the iou value and the coordinates of the circumscribed rectangle of the segmented area predict_bbox; finally, traverse the connected domain of each area G, calculate the label color tag_color and the coordinates of the circumscribed rectangle of the label tag_bbox.

[0048] The beneficial effects of the present invention are that the defects existing in the background technology are solved.

[0049] The present invention uses the inference graph and annotation graph obtained by the AI ​​segmentation algorithm to automatically generate a confusion matrix, eliminating the need for manual intervention and improving efficiency and accuracy. Output multiple indicators such as Intersection over Union (IOU), annotation color (the color of unannotated objects is "0"), annotation and inference external rectangular boxes to provide users with detailed data analysis. Post-processing can generate multi-category confusion matrices for multiple defects based on the annotation colors. Provide adjustable parameters (such as IOU threshold, expansion coefficient) and custom functions to meet user personalized needs. By displaying the external rectangular box and defect location, provide users with intuitive result display and optimization path;

[0050] The present invention improves the automation level of AI algorithm segmentation result evaluation, saving manpower and time. By outputting rich indicators and automatically generating confusion matrices, it helps users to evaluate and optimize AI image segmentation models more deeply. It improves user experience and operational convenience, allowing users to understand and analyze confusion matrix results more intuitively. It supports flexible adjustment of parameters and custom functions to meet the needs of different application scenarios, and improves the applicability and flexibility of the algorithm. BRIEF DESCRIPTION OF THE DRAWINGS

[0051] Figure 1 is a flow chart of the present invention;

[0052] Figure 2 It is a flow chart of calculating various indicators of the present invention;

[0053] Figure 3 It is a flow chart of generating confusion matrix of the present invention. DETAILED DESCRIPTION

[0054] The present invention will now be described in further detail in conjunction with the accompanying drawings and preferred embodiments. These drawings are simplified schematic diagrams, which only illustrate the basic structure of the present invention in a schematic manner, and therefore only show the components related to the present invention.

[0055] like Figure 1-Figure 3 A method for automatically generating a confusion matrix for AI segmentation is shown in FIG.

[0056] 1. The overall process is as follows:

[0057] (1) Set the expansion coefficient. If this function is not required, just set the expansion coefficient to 0.

[0058] (2) Obtain the IOU, annotation color, and circumscribed rectangle coordinates corresponding to the annotated image and the segmented image.

[0059] (3) Customization of complex situations: If the same annotated area and multiple segmentation results intersect, you can select the segmentation area with the maximum IOU value, or you can choose to output all segmentation areas. If there are complex situations where multiple annotated areas intersect with the same segmentation result, you can select the annotated area with the maximum IOU value, or you can choose to output all annotated areas.

[0060] (4) Count the number of over-detections, missed detections, normal detections, and incomplete detections in different categories and generate a multi-category confusion matrix according to the categories.

[0061] (5) The coordinates of the bounding rectangle of each overkill, missed detection, normal detection and incomplete detection are given to the UI display interface.

[0062] 2. Principle of determining whether the expansion coefficient is the same object

[0063] The expansion coefficient is usually used in the field of image processing and computer vision to control or adjust the size, shape or expansion degree of the area of ​​the object in the image. The invention describes the distance between two target objects in pixel units and uses the threshold setting of the expansion coefficient to determine whether two close targets are the same object. If this function is not needed, just set the expansion coefficient to 0.

[0064] 3. Principles of judgment rules in complex situations

[0065] If the same annotated area and multiple segmentation results have an intersection, you can select the segmentation area with the maximum IOU value as the corresponding relationship with the annotated area, and classify it (over-killing, missed detection, normal detection, incomplete detection), so that only one result with the largest IOU value is retained; you can also choose to output the four features of the annotated area and all segmented areas (IOU, annotation color, and the bounding rectangle of annotation and segmentation) and classify them.

[0066] If multiple annotated regions intersect with the same segmentation result, you can select the annotated region with the maximum IOU value and output a unique result, or you can select all annotated regions. Of course, the annotations of different colors must be classified by category.

[0067] 4. Algorithm logic for calculating the four major features of the annotation map and segmentation map

[0068] Figure 2 The process of calculating the four major features of the defect area in the annotation map and segmentation map is shown as follows:

[0069] (1) Create four containers: used to store four features, namely: the container IOU for storing iou values, the container tagbox for storing the coordinates of the labeled circumscribed rectangle, the container predictbbox for storing the coordinates of the segmented circumscribed rectangle, and the container tagcolor for storing the labeled color.

[0070] (2) Preprocessing: Read a label image label and a segmentation image segmentation, and determine the number of label and segmentation image channels. If the number of label channels is 3 and the number of segmentation channels is 1, perform threshold processing to extract the label region and segmentation region respectively, and calculate the number of label and segmentation regions. Dilate the label region to obtain the expanded label region label_dilatation_region and retain the original label region label_region. Dilate the segmentation region to obtain the expanded segmentation region seg_dilatation_region and retain the original segmentation region seg_region. The label expansion coefficient label_dilatation and the segmentation expansion coefficient seg_dilatation are given to the interface parameters for easy modification by customers. If the number of label channels is not 3 and the number of segmentation channels is not 1, the log is output: the image type does not meet the standard.

[0071] (3) Features are calculated in four cases: In the first case, the number of connected regions extracted by label and segmentation is both 0. In the second case, the number of connected regions for label is 0 but the number of connected regions for segmentation is not 0. In the third case, the number of connected regions for label is not 0 but the number of connected regions for segmentation is 0. In the fourth case, the number of connected regions for both label and segmentation is not 0 (the most complex case).

[0072] (4) In the first case (the number of connected regions of label and segmentation is 0), feature extraction is performed:

[0073] Save the label color as "000000000", the coordinates of the bounding rectangles of the label and segmentation as [0,0,0,0], and the iou value as 0. Finally, store them in the four containers in (1).

[0074] (5) In the second case (the number of label connected regions is 0 but the number of segmentation connected regions is not 0), feature extraction is performed:

[0075] Traverse each segmented connected region. Output label color as "000000000", label's bounding rectangle coordinates [0,0,0,0], and iou value as 0. Calculate the intersection of each connected region of segmentation and seg_region, and obtain the bounding rectangle coordinates of segmentation predict_bbox. Finally, store them in the four containers in (1).

[0076] (6) In the third case (the number of label connected regions is not 0 and the number of segmentation connected regions is 0), feature extraction is performed:

[0077] Traverse each labeled connected region. The output iou value is 0, and the coordinates of the segmentation's bounding rectangle are [0,0,0,0]. Calculate the intersection of each connected region and label_region, and obtain the color tag_color of the label region (calculate the RGB value of the labeled image and convert it into characters) and the bounding rectangle coordinates tag_bbox. Finally, store them in the four containers in (1).

[0078] (7) In the fourth case (the number of connected regions of label and segmentation is not 0), feature extraction is performed:

[0079] 1). Traverse each labeled connected domain and generate an empty region have_compared_RegionG to save the processed segmented region. Calculate the intersection of the selected label connected domain and label_region. Calculate the center point of the intersection, and first find the corresponding region A in the segmentation map based on the center point.

[0080] 2). If region A is found, the intersection of region A and seg_region is calculated and saved in have_compared_RegionG. Then the iou value of the intersection and region A and the minimum enclosing rectangle predict_bbox of the segmentation are calculated. Finally, the intersection region is connected, and each intersection connected region is traversed to calculate the coordinates of the enclosing rectangle tag_bbox and the color tag_color. Here, each traversal is performed to save the features into the four containers in (1).

[0081] 3). If region A is not found, the selected label connected domain is intersected with all seg_dilatation_region regions.

[0082] If the intersection is empty, the output iou value is 0, and predict_bbox = [0,0,0,0]. Connect the intersection area and traverse it, calculate the label color tag_color of the intersection connected domain, and label the circumscribed rectangle coordinates tag_bbox. Here, each traversal must save the feature once to the four containers in (1).

[0083] If the intersection is not empty, traverse the intersection area. First, find the region B corresponding to each point in the intersection area in the segmented area seg_region. Here, each traversal saves the compared segmented area B to have_compared_RegionG. Then calculate the iou value and the outer rectangle coordinates predict_bbox of the intersection area and area B. Finally, connect the intersection area and traverse, calculate the label color tag_color and the label outer rectangle coordinates tag_bbox, and save the features once in each traversal to the four containers in (1).

[0084] Subtract the processed have_compared_RegionG region from the unexpanded segmented region seg_region to obtain the unprocessed segmented region C. Calculate the area of ​​region C.

[0085] If the area is 0, return to (1).

[0086] If the area is greater than 0, then expand region C to obtain region D. Connect region D and traverse each connected domain of D. Calculate the intersection of the connected domain of D and the original region labeled label_region.

[0087] If there is no intersection, then the output tag_color = "000000000", the iou value is 0, tag_bbox = [0,0,0,0], and the coordinates of the circumscribed rectangle of the expansion area C are calculated predict_bbox. Here, each traversal saves the feature once to the four containers in (1).

[0088] If there is an intersection, traverse each intersection connected domain, and find a connected domain E corresponding to the point in the labeled area label_region according to the points of each intersection connected domain, and finally merge all connected domains E into area F.

[0089] Connect the region F and traverse each F connected domain, and find the intersection of the F connected domain and label_region to get region G, calculate the intersection of each F connected domain and the segmented region C, and calculate the iou value and the segmented region circumscribed rectangle coordinates predict_bbox. Finally, traverse the connected domain of each region G, calculate the label color tag_color and the label circumscribed rectangle coordinates tag_bbox, and save the features once each traversal to the four containers in (1).

[0090] After all the traversals are completed, return to (1).

[0091] 5. Generate confusion matrix process

[0092] Figure 3 Shows the process of generating a confusion matrix:

[0093] Traverse the feature results corresponding to each image.

[0094] First, take out the marked color of the first position.

[0095] Then judge iou=0: if there is a marked bounding rectangle, it is judged as missed detection, otherwise it is judged as over-detection, and the result is written into the corresponding color position of the confusion matrix, and the coordinates of the marked or segmented bounding rectangle are given.

[0096] Then judge iou>0: if a marked area corresponds to multiple segmented areas, according to customer needs, you can choose to take the maximum iou value and output the result, or you can choose to output all the results.

[0097] For multiple labeled areas corresponding to single segmented areas, you can choose to take the maximum iou value and output the result, or you can choose to output all the results. If neither of the above is the case, it is directly judged as normal detection based on iou>threshold, and iou<threshold as incomplete detection.

[0098] Corresponding interfaces are provided for the judgment rules of one marked area corresponding to multiple segmented areas, the judgment rules of multiple marked areas corresponding to a single segmented area, and the iou threshold to facilitate customer modification.

[0099] therefore,

[0100] (1) The present invention solves the problem that simple judgment rules cannot handle complex scenarios:

[0101] The adjustable IOU threshold and expansion coefficient functions provided by the present invention design the processing logic for the intersection of multiple annotations and single inference results, the processing logic for the intersection of single annotations and multiple inference results, and the processing logic for complex situations where similar results are determined to be the same object. Customized adjustments are implemented according to task requirements and actual conditions, optimizing segmentation results and improving flexibility to meet the needs of different tasks.

[0102] (2) The present invention solves the problem that the fixed IOU threshold is inflexible:

[0103] The function of adjusting the IOU threshold provided by the present invention meets the customization requirements of different customers.

[0104] (3) The present invention solves the problem of poor visualization ability:

[0105] The present invention introduces the display of defect external rectangular frames and color classifications (colors correspond to different segmentation types) to help users intuitively locate problem areas, improve the efficiency of problem troubleshooting and repair, enhance users' understanding and adjustment of segmentation results, and improve the operability of the system and user experience.

[0106] (4) The present invention solves the problem of poor adaptability:

[0107] The present invention realizes customized demand processing for complex scenarios such as processing similar objects, multiple annotations and single inference results, single annotation and multiple inference results, etc., improves the adaptability and flexibility of the algorithm, and meets more detailed evaluation requirements in different scenarios. At the same time, the confusion matrix generation is divided into two steps: the first step is to output IOU, color, and circumscribed rectangle coordinates, and the second step is to customize the output of the confusion matrix according to customer needs, which can greatly improve the efficiency of outputting the confusion matrix after changing the requirements.

[0108] The above description only describes the specific implementation mode of the present invention. Various examples do not limit the essential content of the present invention. After reading the description, ordinary technicians in the relevant technical field can modify or deform the specific implementation modes described above without departing from the essence and scope of the invention.

Claims

1. A method for automatically generating a confusion matrix for AI segmentation, characterized by: The following steps are included: S1. Set the expansion determination coefficient according to demand; S2, obtain the IOU, annotation color, annotation and circumscribed rectangle coordinates corresponding to the annotated image and the segmented image; S3. Customize the judgment rules in complex situations according to needs; S4, calculating the categories and numbers of over-kill, missed detection, normal detection and incomplete detection, and counting the numbers of over-kill, missed detection, normal detection and incomplete detection in different categories, and then generating a multi-category confusion matrix according to the categories; S5. Provide the coordinates of the bounding rectangle of each over-detection, missed detection, normal detection and incomplete detection to the UI display interface.

2. The method for automatically generating a confusion matrix for AI segmentation according to claim 1, characterized in that: In the step S1, a threshold value of the expansion coefficient is used to determine whether two close targets are the same object.

3. The method for automatically generating a confusion matrix for AI segmentation according to claim 1, characterized in that: In step S3, the decision rule in complex situations is: 1) If the same annotated area and multiple segmentation results have an intersection, the segmentation area with the maximum IOU value is selected as the corresponding relationship with the annotated area, and the over-detection, missed detection, normal detection, and incomplete detection are classified; or the IOU, annotation color, and the circumscribed rectangle of the annotation and segmentation of the annotated area and all segmented areas are selected and classified; 2) If multiple annotated regions intersect with the same segmentation result, select the annotated region with the maximum IOU value and output a unique result, or select all annotated regions; 3) Labels of different colors are classified by category.

4. The method for automatically generating a confusion matrix for AI segmentation according to claim 1, characterized in that: In step S4, the calculation method includes the following steps: (1) Create four feature containers: to store the four features of IOU, label color, label and segmentation bounding rectangle; (2) Image preprocessing: read a label image and a segmentation image, and determine the number of label and segmentation image channels; (3) Features are calculated in four cases: the number of connected regions extracted by label and segmentation is 0, the number of connected regions of label is 0 but the number of connected regions of segmentation is not 0, the number of connected regions of label is not 0 but the number of connected regions of segmentation is 0, and the number of connected regions of both label and segmentation is not 0. (4) Perform feature extraction in each case.

5. The method for automatically generating a confusion matrix for AI segmentation according to claim 1, characterized in that: In step S4, the method for generating a multi-category confusion matrix is: I. Traverse the feature results corresponding to each image; II. Take out the marked color of the first position; III. Judge iou=0: if there is a marked bounding rectangle, it is judged as missed detection, otherwise it is judged as over-detection, and the result is written into the corresponding color position of the confusion matrix, and the coordinates of the marked or segmented bounding rectangle are given; IV. Judge iou>0: If a marked area corresponds to multiple segmented areas, choose to take the maximum iou value and output the result, or choose to output all results according to the needs; if multiple marked areas correspond to a single segmented area, choose to take the maximum iou value and output the result, or choose to output all results; if none of the above situations occurs, directly judge it as normal detection according to iou>threshold, and judge it as incomplete detection according to iou<threshold.

6. The method for automatically generating a confusion matrix for AI segmentation according to claim 4, characterized in that: In the step (4), when the number of connected regions in the label map label and the segmentation map segmentation is not 0, the feature extraction method is: A. Traverse each labeled connected domain and generate an empty region have_compared_RegionG to save the processed segmented region; calculate the intersection of a selected label connected domain and label_region; calculate the center point of the intersection, and first find the corresponding region A in the segmentation map according to the center point; B. If region A is found, the intersection of region A and seg_region is calculated and saved in have_compared_RegionG; then the iou value of the intersection and region A and the minimum enclosing rectangle predict_bbox of the segmentation are calculated; finally, the intersection area is connected, each intersection connected area is traversed, and the coordinates of the label enclosing rectangle tag_bbox and the color tag_color are calculated; C. If region A is not found, the selected label connected domain is intersected with all seg_dilatation_region regions; If the intersection is empty, the output iou value is 0, predict_bbox = [0,0,0,0]; connect the intersection area and traverse, calculate the label color tag_color of the intersection connected domain, and label the circumscribed rectangle coordinates tag_bbox; If the intersection is not empty, traverse the intersection area; first find the area B corresponding to the point in the segmented area seg_region according to the point in each intersection area; then calculate the iou value and the outer rectangle coordinates predict_bbox of the intersection area and area B; finally connect the intersection area and traverse, calculate the label color tag_color and the label outer rectangle coordinates tag_bbox; D. Subtract the processed have_compared_RegionG region from the unexpanded segmented region seg_region to obtain the unprocessed segmented region C; calculate the area of ​​region C; If the area is greater than 0, then expand region C to obtain region D; connect region D and traverse each connected domain of D; calculate the intersection of the connected domain of D and the labeled original region label_region; If there is no intersection, then output tag_color = "000000000", iou value is 0, tag_bbox = [0,0,0,0], and calculate the circumscribed rectangle coordinates predict_bbox of the dilated area C; If there is an intersection, traverse each connected domain of the intersection, and find a connected domain E corresponding to the point in the labeled area label_region according to the points of each connected domain of the intersection. Finally, merge all connected domains E into area F; connect area F and traverse each F connected domain, and find the intersection of the F connected domain and label_region to get area G, calculate the intersection of each F connected domain and the segmented area C, and calculate the iou value and the coordinates of the circumscribed rectangle of the segmented area predict_bbox; finally, traverse the connected domain of each area G, calculate the label color tag_color and the coordinates of the circumscribed rectangle of the label tag_bbox.