Clustering method and device, computer equipment, storage medium and program product
By using the difference matrix in the clustering method for clustering analysis, the semantic category error problem caused by the segmentation algorithm is solved, and the accuracy and fault tolerance of clustering are improved.
Patent Information
- Application Number
- CN202311412296.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-10-27
- Publication Date
- 2025-04-29
AI Technical Summary
In autonomous driving perception algorithms, segmentation algorithms may lead to semantic category errors, which in turn affects the accuracy of clustering.
The data to be processed are segmented using the segmentation algorithm to obtain the semantic categories of each segmentation unit, and cluster analysis is performed on each segmentation unit based on the difference matrix and semantic categories. The difference matrix is determined based on the confusion matrix corresponding to the segmentation algorithm to take into account the error of the segmentation algorithm.
By considering the error of the segmentation algorithm, clustering analysis is performed using the difference matrix, which improves the accuracy of clustering and reduces the impact of undersegment or oversegment caused by the segmentation algorithm on the clustering effect.
Smart Images

Figure CN119904659A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to a clustering method, apparatus, computer equipment, storage medium and program product. Background Art
[0002] In the field of autonomous driving, the autonomous driving perception algorithms used involve a variety of clustering scenarios. For example, for point clouds, points belonging to the same object are clustered into one category, treated as a single object, and given a common label; or pixels in an image are clustered into a single object. The most commonly used clustering criteria include category and distance, among which category refers to the semantic classification of each point in the point cloud, or the semantic classification of each pixel in the image.
[0003] Before clustering, a segmentation algorithm is often used to determine the semantic category corresponding to each point cloud or each pixel, and clustering is performed based on the segmentation results. However, the segmentation algorithm may have the problem of determining the wrong semantic category, which will lead to inaccurate clustering. Summary of the invention
[0004] Based on this, it is necessary to provide a clustering method, apparatus, computer device, storage medium and program product that can improve the accuracy of clustering in order to solve the above technical problems.
[0005] In a first aspect, the present application provides a clustering method, the method comprising:
[0006] The segmentation algorithm is used to segment the data to be processed to obtain the semantic category of each segmentation unit;
[0007] Based on the difference matrix and the semantic category of each segmentation unit, cluster analysis is performed on each segmentation unit; the difference matrix is determined according to the confusion matrix corresponding to the segmentation algorithm.
[0008] In one embodiment, the method of determining the difference matrix includes:
[0009] According to the confusion matrix, determine the conditional probability matrix corresponding to each semantic category;
[0010] Based on the conditional probability matrix, determine the difference matrix.
[0011] In one embodiment, cluster analysis is performed on each segmentation unit according to the difference matrix and the semantic category of each segmentation unit, including:
[0012] Determine a seed unit from all segmentation units;
[0013] Traversing all first segmentation units in the neighborhood of the seed unit, and determining a first target difference value between each first segmentation unit and the seed unit according to the difference matrix;
[0014] According to the first target difference value, the cluster corresponding to the seed unit is determined; and after traversing all the first segmentation units in the neighborhood of the seed unit, returning to execute the step of determining the seed unit from all the segmentation units.
[0015] In one embodiment, determining the cluster corresponding to the seed unit according to the first target difference value includes:
[0016] Adding a first segmentation unit corresponding to a first target difference value that is less than a preset difference threshold to the first set;
[0017] If the number of the first segmentation units in the first set is greater than a preset number threshold, a cluster corresponding to the seed unit is determined according to the first segmentation units in the first set.
[0018] In one embodiment, the method further comprises:
[0019] If the number of the first segmentation units in the first set is not greater than a preset number threshold, the seed unit is determined to be a noise unit.
[0020] In one embodiment, determining a cluster corresponding to a seed unit according to a first segmentation unit in a first set includes:
[0021] Establishing a cluster corresponding to the seed unit, and adding the seed unit to the cluster;
[0022] Each first segmentation unit in the first set is traversed to determine the segmentation unit to be added to the cluster.
[0023] In one embodiment, after determining the seed unit from all the segmentation units, the method further includes:
[0024] Marking the seed units;
[0025] Traverse each first segmentation unit in the first set to determine the segmentation unit to be added to the cluster, including:
[0026] For each first segmentation unit in the first set, determining whether the first segmentation unit is a marked seed unit;
[0027] If the first segmentation unit is a labeled seed unit, then the first segmentation unit is added to the cluster;
[0028] If the first segmentation unit is not a marked seed unit, the first segmentation unit is marked, and all second segmentation units in the neighborhood of the marked first segmentation unit are traversed to determine a second set; based on the second set, the segmentation unit added to the cluster is determined.
[0029] In one embodiment, traversing all second segmentation units in the neighborhood of the marked first segmentation unit to determine the second set includes:
[0030] Traversing all second segmentation units in the neighborhood of the marked first segmentation unit, and determining a second target difference value between each second segmentation unit and the marked first segmentation unit according to the difference matrix;
[0031] The second segmentation unit corresponding to the second target difference value less than the preset difference threshold is added to the second set.
[0032] In one embodiment, determining the segmentation unit to be added to the cluster according to the second set includes:
[0033] If the number of second segmentation units in the second set is greater than a preset number threshold, the second set is merged into the first set to obtain a new first set, and for the first segmentation units that have not been traversed in the new first set, the step of determining whether the first segmentation unit is a marked seed unit is returned to be executed until all the first segmentation units in the new first set are traversed;
[0034] If the number of the second segmentation units in the second set is not greater than the preset number threshold, the marked first segmentation unit is determined to be a boundary unit, and the marked first segmentation unit is added to the cluster.
[0035] In one embodiment, determining the first target difference value between each first segmentation unit and the seed unit according to the difference matrix includes:
[0036] Determine the initial difference value between each first segmentation unit and the seed unit according to the difference matrix;
[0037] Determine the distance value between each first segmentation unit and the seed unit;
[0038] A first target difference value is determined according to the distance value and the initial difference value.
[0039] In one embodiment, determining the first target difference value between each first segmentation unit and the seed unit according to the difference matrix includes:
[0040] Determine the initial difference value between each first segmentation unit and the seed unit according to the difference matrix;
[0041] Determine the absolute value of the difference between the maximum height value of each first segmentation unit and the maximum height value of the seed unit;
[0042] A first target difference value is determined according to the absolute value of the difference and the initial difference value.
[0043] In one embodiment, determining a first target difference value according to the distance value and the initial difference value includes:
[0044] Determine the absolute value of the difference between the maximum height value of each first segmentation unit and the maximum height value of the seed unit;
[0045] A first target difference value is determined according to the distance value, the absolute value of the difference value and the initial difference value.
[0046] In a second aspect, an embodiment of the present application provides a clustering device, the device comprising:
[0047] A segmentation module is used to segment the data to be processed using a segmentation algorithm to obtain the semantic category of each segmentation unit;
[0048] The clustering module is used to perform cluster analysis on each segmentation unit based on a difference matrix and a semantic category of each segmentation unit; the difference matrix is determined according to a confusion matrix corresponding to the segmentation algorithm.
[0049] In a third aspect, an embodiment of the present application provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the method provided in the first aspect when executing the computer program.
[0050] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps of the method provided in the first aspect are implemented.
[0051] In a fifth aspect, an embodiment of the present application provides a computer program product, including a computer program, which implements the steps of the method provided in the first aspect when the computer program is executed by a processor.
[0052] The clustering method, device, computer equipment, storage medium and program product above segment the processed data by adopting a segmentation algorithm to obtain the semantic category of each segmentation unit; based on the difference matrix and the semantic category of each segmentation unit, cluster analysis is performed on each segmentation unit; the difference matrix is determined according to the confusion matrix corresponding to the segmentation algorithm. In this embodiment, the confusion matrix can characterize the quantitative confusion degree between different semantic categories obtained by the segmentation algorithm. When performing cluster analysis, the difference matrix determined according to the confusion matrix corresponding to the segmentation algorithm is used to determine the similarity between the semantic categories. In this way, the segmentation error existing in the segmentation algorithm is taken into account when performing the clustering algorithm. The difference matrix determined according to the confusion matrix can obtain more accurate similarity of each semantic category, so that accurate cluster analysis can be performed on each segmentation unit, so that the clustering method has a high fault tolerance to the segmentation algorithm, reduces the influence of the under-segmentation or over-segmentation phenomenon caused by the segmentation algorithm on the clustering effect, and makes the clustering more accurate. BRIEF DESCRIPTION OF THE DRAWINGS
[0053] Figure 1 A schematic diagram of the structure of an intelligent terminal in an embodiment;
[0054] Figure 2 A schematic diagram of a clustering method in one embodiment;
[0055] Figure 3 A schematic diagram of data to be processed and data to be processed after segmentation in one embodiment;
[0056] Figure 4 A schematic diagram of a step flow of a clustering method in another embodiment;
[0057] Figure 5 A schematic diagram of a step flow of a clustering method in another embodiment;
[0058] Figure 6 A schematic diagram of a step flow of a clustering method in another embodiment;
[0059] Figure 7 A schematic diagram of a step flow of a clustering method in another embodiment;
[0060] Figure 8 A schematic diagram of a step flow of a clustering method in another embodiment;
[0061] Fig. 9 A schematic diagram of a step flow of a clustering method in another embodiment;
[0062] Fig.10 A schematic diagram of a step flow of a clustering method in another embodiment;
[0063] Fig.11 A schematic diagram of a step flow of a clustering method in another embodiment;
[0064] Fig.12 A schematic diagram of a step flow of a clustering method in another embodiment;
[0065] Fig.13 A schematic diagram of a step flow of a clustering method in another embodiment;
[0066] Fig.14 FIG. 4 is a schematic diagram of the structure of a clustering device in an embodiment. DETAILED DESCRIPTION
[0067] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0068] The serial numbers assigned to the components in this application, such as "first", "second", etc., are only used to distinguish the objects described and do not have any order or technical meaning.
[0069] First of all, before specifically accepting the technical solutions of the embodiments disclosed in this application, the background technology or technical evolution context on which the embodiments of this application are based is introduced. In the field of autonomous driving, the perception algorithm used in autonomous driving involves a variety of clustering scenarios. For example, for point clouds, points belonging to the same object will be clustered into one category, as a separate object, and given a common label; or pixels in an image will be clustered into a separate object. The most commonly used clustering basis includes category and distance, among which the category refers to the semantic classification of each point in the point cloud, or the semantic classification of each pixel in the image. Before clustering processing, a segmentation algorithm is often used to determine the semantic category corresponding to each point cloud or each pixel, and clustering processing is performed based on the segmentation results. However, the segmentation algorithm may have misclassification, resulting in the problem of incorrect semantic categories of each unit or each pixel, which makes subsequent clustering inaccurate. In this regard, the present application provides a clustering method.
[0070] The technical solution of the present application and how the technical solution of the present application solves the technical problem are described in detail below with specific embodiments.
[0071] The clustering method provided in the embodiment of the present application can be used in an automatic driving system in a vehicle, wherein the automatic driving system includes an intelligent terminal, and the intelligent terminal can be a control chip. The internal structure diagram of the intelligent terminal can be as follows: Figure 1 As shown, the intelligent terminal includes a processor, a memory, a communication interface, a display screen and an input device connected through a system bus. Among them, the processor of the intelligent terminal is used to provide computing and control capabilities. The memory of the intelligent terminal includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The communication interface of the intelligent terminal is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be implemented through WIFI, a mobile cellular network, NFC (near field communication) or other technologies. When the computer program is executed by the processor, a clustering method is implemented. The display screen of the intelligent terminal can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covered on the display screen, or a button, a trackball or a touch pad set on the housing of the computer device, or an external keyboard, touch pad or mouse, etc.
[0072] In one embodiment, Figure 2 As shown, a clustering method is provided. This embodiment uses the method applied to a smart terminal as an example. In this embodiment, the method includes the following steps:
[0073] Step 200: Use a segmentation algorithm to segment the data to be processed to obtain the semantic category of each segmentation unit.
[0074] The data to be processed may be data acquired by various sensors in the vehicle. The data to be processed may be a two-dimensional image, a three-dimensional image, or a three-dimensional point cloud data. The data to be processed may be pre-stored in a storage device of the smart terminal; or it may be acquired by various sensors and stored in a specific storage device, and the smart terminal acquires it from the specific storage device when needed. This embodiment does not limit the type of data to be processed and the method for acquiring the data to be processed, as long as its function can be achieved.
[0075] After acquiring the data to be processed, the intelligent terminal uses a segmentation algorithm to segment the data to be processed, and obtains the semantic category of each segmentation unit, that is, determines the semantic category to which each segmentation unit belongs. When the data to be processed is an image, each segmentation unit is each pixel in the image, and the segmentation algorithm can be used to obtain the semantic category of each pixel; when the data to be processed is three-dimensional point cloud data, each segmentation unit is each point cloud of the three-dimensional point cloud data, and the segmentation algorithm can be used to obtain the semantic category of each point cloud. This embodiment does not limit the segmentation algorithm, as long as it can achieve its function.
[0076] In an optional embodiment, the segmentation algorithm is a pre-trained segmentation model, and the intelligent terminal inputs the data to be processed into the segmentation model to obtain the semantic category of each segmentation unit. The training process of the segmentation model includes: obtaining data training samples; inputting the data training samples into the initial segmentation model, training the initial neural network model, and obtaining the segmentation model.
[0077] Step 210: Perform cluster analysis on each segmentation unit based on the difference matrix and the semantic category of each segmentation unit; the difference matrix is determined according to the confusion matrix corresponding to the segmentation algorithm.
[0078] The confusion matrix corresponds to the segmentation algorithm. Different segmentation algorithms have different corresponding confusion matrices. The confusion matrix is also called a probability table or an error matrix. The confusion matrix is used to visualize the performance of the segmentation algorithm. Each column of the confusion matrix represents the predicted value (segmentation result) obtained using the segmentation algorithm, and each row represents the actual value.
[0079] In an optional embodiment, a method for obtaining a confusion matrix includes: after training a segmentation model, obtaining a data test sample, inputting the data test sample into the segmentation model, and testing the segmentation model. A confusion matrix is generated based on the data test sample and the output result of the segmentation model. The data test sample includes test data and annotated segmentation results corresponding to the test data, and a confusion matrix is generated based on the segmentation results output by the segmentation model and the annotated segmentation results.
[0080] Assume that the data to be processed is 3D point cloud data, and divide the 3D point cloud data into multiple column units in the XY plane, such as Figure 3 shown. Figure 3 A represents the data to be processed, B represents the column units in the XY plane after segmentation, and C represents the column units in the three-dimensional space after segmentation. The semantic category of each column unit is determined by the segmentation algorithm, and the semantic category of each column unit is one of {vehicle, pedestrian, road, tree}.
[0081] Using the dataset containing the benchmark (i.e. the labeled segmentation results in the test data sample), the confusion matrix is shown in the following table:
[0082]
[0083] Each row in the confusion matrix represents the number of pillar units that are actually vehicles, pedestrians, roads, and trees; each column represents the number of pillar units that are obtained through the segmentation algorithm. From the above confusion matrix, it can be seen that there are 100 pillar units that are actually vehicles, 90 pillar units that are correctly classified as vehicles through the segmentation algorithm, and 5, 2, and 3 pillar units that are incorrectly classified as pedestrians, roads, and trees.
[0084] After obtaining the confusion matrix corresponding to the segmentation algorithm, the intelligent terminal can determine a difference matrix based on the confusion matrix, and the difference matrix is used to represent the difference values between the semantic categories in the segmentation results obtained using the segmentation algorithm. Each semantic category includes multiple segmentation units.
[0085] The discrepancy matrix determined from the confusion matrix can be expressed as:
[0086] Transportation pedestrian the way Trees Transportation <![CDATA[D 工具-工具 ]]> <![CDATA[D 工具-行人 ]]> <![CDATA[D 工具-道路 ]]> <![CDATA[D 工具-树木 <!-- 5 -->]]> pedestrian <![CDATA[D 工具-行人 ]]> <![CDATA[D 行人-行人 ]]> <![CDATA[D 行人-道路 ]]> <![CDATA[D 行人-树木 ]]> the way <![CDATA[D 工具-道路 ]]> <![CDATA[D 行人-道路 ]]> <![CDATA[D 道路-道路 ]]> <![CDATA[D 道路-树木 ]]> Trees <![CDATA[D 工具-树木 ]]> <![CDATA[D 行人-树木 ]]> <![CDATA[D 道路-树木 ]]> <![CDATA[D 树木-树木 ]]>
[0087] In the above difference matrix D i-j Represents the difference value between semantic category i and semantic category j. The difference matrix is a symmetric matrix.
[0088] After obtaining the semantic categories of each segmentation unit corresponding to the data to be processed, the intelligent terminal performs cluster analysis on each segmentation unit based on the difference matrix and the semantic categories of each segmentation unit. In other words, based on the difference matrix, the segmentation units with high similarity are clustered together to obtain clusters of semantic categories corresponding to the segmentation units with high similarity.
[0089] The clustering method provided in this embodiment uses a segmentation algorithm to segment the processed data to obtain the semantic category of each segmentation unit; based on the difference matrix and the semantic category of each segmentation unit, cluster analysis is performed on each segmentation unit; the difference matrix is determined according to the confusion matrix corresponding to the segmentation algorithm. In this embodiment, the confusion matrix can characterize the quantitative confusion degree between different semantic categories obtained by the segmentation algorithm. When performing cluster analysis, the difference matrix determined according to the confusion matrix corresponding to the segmentation algorithm is used to determine the similarity between the semantic categories. In this way, the segmentation error existing in the segmentation algorithm is taken into account when performing the clustering algorithm. The difference matrix determined according to the confusion matrix can obtain more accurate similarities of each semantic category, so that accurate cluster analysis can be performed on each segmentation unit, so that the clustering method has a high fault tolerance to the segmentation algorithm, reduces the influence of the under-segmentation or over-segmentation phenomenon caused by the segmentation algorithm on the clustering effect, and makes the clustering more accurate.
[0090] In one embodiment, Figure 4 As shown, it is an implementation method of performing cluster analysis on each segmentation unit according to the difference matrix and the semantic category of each segmentation unit, and the steps of the implementation method include:
[0091] Step 400: Determine a seed unit from all segmentation units.
[0092] The intelligent terminal uses a segmentation algorithm to segment the data to be processed into multiple segmentation units. When performing cluster analysis, one segmentation unit is selected from all the segmentation units obtained and determined as a seed unit.
[0093] In an optional embodiment, the intelligent terminal may randomly select a segmentation unit from all segmentation units to be determined as a seed unit.
[0094] In another optional embodiment, the intelligent terminal may number all segmentation units obtained by segmentation, and determine the first segmentation unit as a seed unit.
[0095] Step 410: traverse all first segmentation units in the neighborhood of the seed unit, and determine the first target difference value between each first segmentation unit and the seed unit according to the difference matrix.
[0096] After obtaining the seed unit, the intelligent terminal finds all the segmentation units in the neighborhood of the seed unit as the first segmentation unit. The segmentation unit in the neighborhood of the seed unit refers to the segmentation unit whose distance with the seed unit is less than or equal to the preset distance threshold. The preset distance threshold can be pre-set by the user and stored in the storage device of the intelligent terminal.
[0097] The difference value between the first segmentation unit and the seed unit represents the difference value between the semantic category to which the first segmentation unit belongs and the semantic category to which the seed unit belongs. After obtaining all the first segmentation units in the neighborhood of the seed unit, the intelligent terminal searches for the difference value between the first segmentation unit and the seed unit in the difference matrix for each first segmentation unit, and uses the difference value as the first target difference value between the first segmentation unit and the seed unit, thereby obtaining multiple first target difference values corresponding to all the first segmentation units.
[0098] Step 420: determine the cluster corresponding to the seed unit according to the first target difference value; and after traversing all first segmentation units in the neighborhood of the seed unit, return to the step of determining the seed unit from all the segmentation units.
[0099] After obtaining the first target difference value corresponding to each first segmentation unit, the intelligent terminal determines the cluster corresponding to the seed unit according to the first target difference value, that is, the segmentation units with high similarity to the seed unit are clustered together to generate a cluster corresponding to the seed unit, which includes a cluster of the semantic category corresponding to the seed unit, and the segmentation units included in the cluster have the same semantic category as the seed unit.
[0100] After traversing all the first segmentation units in the neighborhood of the seed unit, the process returns to execute steps 400-420.
[0101] In an optional embodiment, if the smart terminal randomly selects a segmentation unit from all segmentation units to determine as a seed unit, the smart terminal randomly selects a segmentation unit from the remaining segmentation units to determine as a seed unit, and executes steps 410 and 420 according to the seed unit.
[0102] In another optional embodiment, if the smart terminal numbers all segmentation units obtained by segmentation and determines the first segmentation unit as a seed unit, the smart terminal selects the next segmentation unit as a seed unit according to the number and executes steps 410 and 420 according to the seed unit.
[0103] In this embodiment, by selecting a segmentation unit from all the segmentation units as a seed unit, traversing all the first segmentation units in the neighborhood of the seed unit, and determining the cluster corresponding to the seed unit, the cluster corresponding to all the segmentation units can be determined using the same method. Cluster analysis of each segmentation unit is implemented. This method of clustering analysis of each segmentation unit is simple and easy to understand, and easy to implement, making the clustering method more practical.
[0104] In one embodiment, Figure 5 As shown, it is related to an implementation method of performing cluster analysis on each segmentation unit according to the first target difference value, and the steps of the implementation method include:
[0105] Step 500: Add a first segmentation unit corresponding to a first target difference value that is smaller than a preset difference threshold into a first set.
[0106] The preset difference threshold may be preset by a user and stored in a storage device of the smart terminal. The first set is an empty storage space preset by a user.
[0107] After obtaining the first target difference value corresponding to each first segmentation unit, the intelligent terminal compares the first target difference value with the preset difference threshold for each first target difference value to determine whether the first target difference value is less than the preset difference threshold. If the first target difference value is less than the preset difference threshold, it means that the first segmentation unit corresponding to the first target difference value has a high similarity with the seed unit; if the first target difference value is not less than the preset difference threshold, it means that the first segmentation unit corresponding to the first target difference value has a low similarity with the seed unit.
[0108] After comparing the first target difference value corresponding to each first segmentation unit with the preset difference threshold, the intelligent terminal adds the first segmentation unit corresponding to the first target difference value less than the preset difference threshold into the first set.
[0109] Step 510: If the number of first segmentation units in the first set is greater than a preset number threshold, determine the cluster corresponding to the seed unit according to the first segmentation units in the first set.
[0110] The preset number threshold may be pre-set by the user and stored in a storage device of the smart terminal. After adding all first segmentation units corresponding to the first target difference values less than the preset difference threshold to the first set, the smart terminal counts the number of first segmentation units in the first set. The number of first segmentation units in the first set is compared with the preset number threshold. If the number of first segmentation units in the first set is greater than the preset number threshold, the cluster corresponding to the seed unit is determined according to the first segmentation unit in the first set.
[0111] Please continue to see Figure 5In one embodiment, the steps of the clustering method further include:
[0112] Step 520: If the number of first segmentation units in the first set is not greater than a preset number threshold, determine that the seed unit is a noise unit.
[0113] If the intelligent terminal compares the number of first segmentation units in the first set with the preset number threshold and determines that the number of first segmentation units in the first set is not greater than the preset number threshold, the seed unit is determined to be a noise unit.
[0114] In this embodiment, by comparing the first target difference value corresponding to each first segmentation unit with the preset difference threshold, the first segmentation unit corresponding to the first target difference value less than the preset difference threshold is added to the first set; the number of first segmentation units in the first set is judged, and when the number is greater than the preset number threshold, the cluster corresponding to the seed unit is determined according to the first segmentation unit in the first set. This method of determining the cluster of the seed unit is quick and easy to implement, making the clustering method more practical.
[0115] In one embodiment, Figure 6 As shown, an implementation method of determining a cluster corresponding to a seed unit according to a first segmentation unit in a first set includes the following steps:
[0116] Step 600: Create a cluster corresponding to the seed unit and add the seed unit to the cluster.
[0117] After obtaining the first set, the intelligent terminal establishes a cluster corresponding to the seed unit and adds the seed unit to the cluster. The semantic category of the cluster is the semantic category corresponding to the seed unit.
[0118] Step 610: traverse each first segmentation unit in the first set to determine the segmentation unit to be added to the cluster.
[0119] The intelligent terminal determines, based on each first segmentation unit in the first set, a segmentation unit to be added to the cluster corresponding to the seed unit.
[0120] In this embodiment, the seed unit is added to the cluster, and other segmentation units added to the cluster are determined according to each segmentation in the first set to obtain the final cluster corresponding to the seed unit. This method of determining the cluster corresponding to the seed unit is simple and easy to implement, making the clustering method more practical.
[0121] In one embodiment, after determining the seed unit from all the segmentation units, the clustering method further comprises:
[0122] Mark the seed units.
[0123] After the intelligent terminal determines the seed unit from all the segmentation units, it first marks the seed unit, and then executes step 410 and step 420 according to the marked seed unit.
[0124] In an optional embodiment, after the intelligent terminal obtains each segmentation unit of the data to be processed by using the segmentation algorithm, all the segmentation units are marked as unvisited, indicating that the cluster analysis has not been performed on the segmentation unit. After determining the seed unit from all the segmentation units, the seed unit is marked as visited, indicating that the cluster analysis is performed on the seed unit.
[0125] In this case, if Figure 7 As shown, an implementation method involves traversing each first segmentation unit in the first set to determine the segmentation unit added to the cluster, and the steps of the implementation method include:
[0126] Step 700: For each first segmentation unit in the first set, determine whether the first segmentation unit is a marked seed unit.
[0127] For each first segmentation unit in the first set, the intelligent terminal determines whether the first segmentation unit is a marked seed unit to determine whether the first segmentation unit has been subjected to cluster analysis.
[0128] Step 710: If the first segmentation unit is a marked seed unit, then add the first segmentation unit to the cluster.
[0129] If the intelligent terminal determines that the first segmentation unit is a marked seed unit, the first segmentation unit is directly added to the cluster corresponding to the seed unit.
[0130] Step 720: If the first segmentation unit is not a marked seed unit, mark the first segmentation unit, traverse all second segmentation units in the neighborhood of the marked first segmentation unit, and determine a second set; determine the segmentation unit to be added to the cluster according to the second set.
[0131] If the intelligent terminal determines that the first segmentation unit is not a marked seed unit, it means that the first segmentation unit has not been subjected to cluster analysis, and then the first segmentation unit is marked. The method for marking the first segmentation unit is the same as the method for marking the seed unit.
[0132] After obtaining the marked first segmentation unit, the intelligent terminal finds all segmentation units in the neighborhood of the marked first segmentation unit as second segmentation units, and determines the second set according to all the found second segmentation units. The segmentation unit in the neighborhood of the marked first segmentation unit refers to the segmentation unit whose distance with the marked first segmentation unit is less than or equal to the preset distance threshold.
[0133] In one embodiment, Figure 8 As shown, an implementation method of traversing all second segmentation units in the neighborhood of the marked first segmentation unit to determine the second set includes the following steps:
[0134] Step 800: traverse all second segmentation units in the neighborhood of the marked first segmentation unit, and determine a second target difference value between each second segmentation unit and the marked first segmentation unit according to the difference matrix.
[0135] The difference value between the second segmentation unit and the marked first segmentation unit represents the difference value between the semantic category to which the second segmentation unit belongs and the semantic category to which the marked first segmentation unit belongs. For each second segmentation unit in the neighborhood of the marked first segmentation unit, the difference value between the second segmentation unit and the marked first segmentation unit is searched in the difference matrix, and the difference value is used as the second target difference value between the second segmentation unit and the marked first segmentation unit, thereby obtaining multiple second target difference values corresponding to all second segmentation units.
[0136] Step 810: Add the second segmentation unit corresponding to the second target difference value less than the preset difference threshold into the second set.
[0137] After obtaining the second target difference value corresponding to each second segmentation unit, the intelligent terminal compares the second target difference value with the preset difference threshold for each second target difference value to determine whether the second target difference value is less than the preset difference threshold. If the second target difference threshold is less than the preset difference threshold, it means that the second segmentation unit corresponding to the second target difference value has a high similarity with the marked first segmentation unit, and the second segmentation unit corresponding to the second target difference threshold is added to the second set.
[0138] After determining the second set, the intelligent terminal determines the segmentation unit added to the cluster of the seed unit according to the second set.
[0139] In one embodiment, Fig. 9 As shown, it is related to an implementation method of determining the segmentation unit added to the cluster according to the second set, and the steps of the implementation method include:
[0140] Step 900: If the number of second segmentation units in the second set is greater than a preset number threshold, the second set is merged into the first set to obtain a new first set. For the first segmentation units that have not been traversed in the new first set, return to the step of determining whether the first segmentation unit is a marked seed unit until all the first segmentation units in the new first set are traversed.
[0141] After obtaining the second set, the intelligent terminal counts the number of second segmentation units in the second set. The number of second segmentation units in the second set is compared with a preset number threshold. If the number of second segmentation units in the second set is greater than the preset number threshold, the second set is merged into the first set to obtain a new first set. That is, the second segmentation unit in the second set is merged with the first segmentation unit in the first set, and only one of the same first segmentation unit and second segmentation unit is retained in the new first set. The segmentation units in the new first set are all recorded as first segmentation units.
[0142] After obtaining the new first set, the intelligent terminal returns to execute step 700 for the first segmentation units that have not been traversed in the new first set, the step of determining whether the first segmentation unit is a marked seed unit, as well as steps 710 and 720, until all the first segmentation units in the new first set have been traversed.
[0143] Step 910: If the number of the second segmentation units in the second set is not greater than the preset number threshold, determine that the marked first segmentation unit is a boundary unit, and add the marked first segmentation unit to the cluster.
[0144] If the smart terminal determines that the number of second segmentation units in the second set is not greater than the preset number threshold by comparing the number of second segmentation units in the second set with the preset number threshold, the marked first segmentation unit is determined to be a boundary unit, and the marked first segmentation unit is added to the cluster corresponding to the seed unit.
[0145] In this embodiment, for each unlabeled first segmentation unit in the first set, it is labeled, and all second segmentation units in the neighborhood of the labeled first segmentation unit are traversed, and the second segmentation units corresponding to the second target difference value less than the preset difference threshold are added to the second set; the segmentation units added to the cluster corresponding to the seed unit are determined according to the second segmentation units in the second set. This method of determining the segmentation units added to the cluster is quick and easy to implement.
[0146] In one embodiment, Fig.10 As shown, an implementation method for determining the first target difference value between each first segmentation unit and the seed unit according to the difference matrix includes the following steps:
[0147] Step 101: Determine the initial difference value between each first segmentation unit and the seed unit according to the difference matrix.
[0148] When determining the first target difference value, the intelligent terminal can find the difference value between the first segmentation unit and the seed unit in the difference matrix determined by the confusion matrix, and determine the difference value as the initial difference value.
[0149] Step 102: Determine the distance value between each first segmentation unit and the seed unit.
[0150] The intelligent terminal calculates the distance value between each first segmentation unit and the seed unit. The distance value between the first segmentation unit and the seed unit can be a Euclidean distance value or a Manhattan distance value.
[0151] In an optional embodiment, the Manhattan distance value between the first segmentation unit and the seed unit can be expressed as H=ads(A_x-B_x)+ads(A_y-B_y), wherein H represents the Manhattan distance value, A_x and A_y are the position of the first segmentation unit on the X-axis and the position on the Y-axis, and B_x and B_y are the position of the seed unit on the X-axis and the position on the Y-axis.
[0152] Step 103: Determine a first target difference value according to the distance value and the initial difference value.
[0153] After obtaining the initial difference value and distance value between the first segmentation unit and the seed unit, the intelligent terminal determines the first target difference value according to the initial difference value and the distance value. In other words, the intelligent terminal can perform a weighted average of the distance value and the initial difference value to obtain the first target difference value. The first target difference value can be expressed as d=(a*H+b*Q) / 2, where a and b are weighting coefficients and Q is the initial difference value.
[0154] In one embodiment, Fig.11 As shown, if the data to be processed is three-dimensional point cloud data, the obtained segmentation unit includes a height value (i.e., the position of the point cloud data in the Z-axis direction). In this case, another implementation method for determining the first target difference value between each first segmentation unit and the seed unit according to the difference matrix includes the following steps:
[0155] Step 111: Determine the initial difference value between each first segmentation unit and the seed unit according to the difference matrix.
[0156] When determining the first target difference value, the intelligent terminal can find the difference value between the first segmentation unit and the seed unit in the difference matrix determined by the confusion matrix, and determine the difference value as the initial difference value.
[0157] Step 112: Determine the absolute value of the difference between the maximum height value of each first segmentation unit and the maximum height value of the seed unit.
[0158] For each first segmentation unit, the intelligent terminal determines the maximum height value of the first segmentation unit and the maximum height value of the seed unit, calculates the difference between the maximum height value of the first segmentation unit and the maximum height value of the seed unit, and calculates the absolute value of the difference.
[0159] Step 113: Determine a first target difference value according to the absolute value of the difference and the initial difference value.
[0160] After obtaining the initial difference value between the first segmentation unit and the seed unit, and the corresponding absolute value of the difference, the intelligent terminal determines the first target difference value according to the initial difference value and the absolute value of the difference. In other words, the intelligent terminal can perform a weighted average of the absolute value of the difference and the initial difference value to obtain the first target difference value. The first target difference value can be expressed as d = (c*K + b*Q) / 2, where a is the weighting coefficient and K is the absolute value of the difference.
[0161] In one embodiment, Fig.12 As shown, if the data to be processed is three-dimensional point cloud data, the obtained segmentation unit includes a height value (i.e., the position of the point cloud data in the Z-axis direction). In this case, an implementation method of determining a first target difference value according to the distance value and the initial difference value includes the following steps:
[0162] Step 121: Determine the absolute value of the difference between the maximum height value of each first segmentation unit and the maximum height value of the seed unit.
[0163] For each first segmentation unit, the intelligent terminal determines the maximum height value of the first segmentation unit and the maximum height value of the seed unit, calculates the difference between the maximum height value of the first segmentation unit and the maximum height value of the seed unit, and calculates the absolute value of the difference.
[0164] Step 122: Determine a first target difference value according to the distance value, the absolute value of the difference and the initial difference value.
[0165] The intelligent terminal determines the first target difference value according to the determined distance value between the first segmentation unit and the seed unit, the initial difference value, and the absolute value of the corresponding difference. In other words, the intelligent terminal can perform a weighted average of the absolute value of the difference, the initial difference value, and the distance value to obtain the first target difference value. The first target difference value can be expressed as d=(c*K+b*Q+a*H) / 3.
[0166] In the above embodiment, three methods for determining the first target difference value are provided, and the user can choose one according to actual needs, which makes the clustering method more practical.
[0167] Based on the same method, the second target difference value between each second segmentation unit and the marked first segmentation unit can also be determined by three methods according to the difference matrix. The first method is to determine the second initial difference value between each second segmentation unit and the marked first segmentation unit according to the difference matrix; determine the second distance value between each second segmentation unit and the marked first segmentation unit; and determine the second target difference value according to the second distance value and the second initial difference value. The second method is to determine the second initial difference value between each second segmentation unit and the marked first segmentation unit according to the difference matrix; determine the absolute value of the second difference between the maximum height value of each second segmentation unit and the maximum height value of the marked first segmentation unit; and determine the second target difference value according to the absolute value of the second difference and the second initial difference value. The third method is to determine the second target difference value according to the second initial difference value, the absolute value of the second difference and the second distance value.
[0168] In one embodiment, Fig.13 As shown, the steps of the method for determining the difference matrix include:
[0169] Step 130: Determine the conditional probability matrix corresponding to each semantic category according to the confusion matrix.
[0170] After obtaining the confusion matrix corresponding to the segmentation algorithm, the intelligent terminal calculates the conditional probability matrix corresponding to each semantic category according to the value of each column of the confusion matrix. Specifically, the intelligent terminal calculates the ratio between each value of the confusion matrix and the total value of the column to which the value belongs.
[0171] For the confusion matrix in the above embodiment, the obtained conditional probability matrix is shown in the following table:
[0172]
[0173] Step 131: Determine a difference matrix based on the conditional probability matrix.
[0174] After determining the conditional probability matrix corresponding to each semantic category, the intelligent terminal determines the difference matrix according to the conditional probability matrix. Specifically, the intelligent terminal calculates the same probability and different probabilities of the semantic categories corresponding to different segmentation units, and can determine the difference values of the semantic categories corresponding to different segmentation units according to the same probability and different probabilities.
[0175] For the conditional probability matrix in the above embodiment, assuming that the segmentation results of the two segmentation units pillar1 and pillar2 are vehicles and trees respectively, the probability P that the semantic categories corresponding to the two segmentation units are the same same It can be expressed as:
[0176] P same=P(pillar1=vehicle)*P(pillar2=vehicle)+P(pillar1=pedestrian)*P(pillar2=pedestrian)+P(pillar1=road)*P(pillar2=road)+P(pillar1=tree)*P(pillar2=tree)
[0177] =72%*7.9%+4%*63.5%+8%*4.8%+16%*23.8%
[0178] =12.4%
[0179] The probability P that the semantic categories corresponding to these two segmentation units are different diff It can be expressed as: diff =1-P same =87.6%.
[0180] Assume that the difference value D between the same semantic categories same Set to 0, the difference between different semantic categories D diff If it is set to 1, the difference value of the semantic category between the two segmentation units can be expressed as D 工具-行人 =D same *P same +D diff *P diff =0.876. The same method can be used to calculate the difference values between the semantic categories corresponding to other segmentation units, and the difference matrix can be obtained.
[0181] In this embodiment, the conditional probability matrix corresponding to each semantic category is determined by the confusion matrix, and the difference matrix is determined according to the conditional probability matrix. This method of determining the difference matrix is fast and easy to implement, making the clustering method more practical.
[0182] In one embodiment, a clustering method is provided, the steps of the method comprising:
[0183] Step 140: Use a segmentation algorithm to segment the data to be processed to obtain a semantic category of each segmentation unit;
[0184] Step 141, determining a conditional probability matrix corresponding to each semantic category according to the confusion matrix corresponding to the segmentation algorithm, and determining a difference matrix according to the conditional probability matrix;
[0185] Step 142: determine a seed unit from all the segmentation units and mark the seed unit;
[0186] Step 143, traversing all first segmentation units in the neighborhood of the marked seed unit, and determining a first target difference value between the first segmentation unit and the marked seed unit according to the difference matrix;
[0187] Step 144: adding the first segmentation unit corresponding to the first target difference value less than the preset difference threshold to the first set;
[0188] Step 145: if the number of first segmentation units in the first set is greater than a preset number threshold, a cluster corresponding to the marked seed unit is established, and the marked seed unit is added to the cluster;
[0189] Step 146, traverse each first segmentation unit in the first set to determine whether the first segmentation unit is a marked seed unit;
[0190] Step 147: if the first segmentation unit is a marked seed unit, then add the first segmentation unit to the cluster;
[0191] Step 148: If the first segmentation unit is not a marked seed unit, mark the first segmentation unit, and traverse all second segmentation units in the neighborhood of the marked first segmentation unit;
[0192] Step 149, determining a second target difference value between each second segmentation unit and the marked second segmentation unit according to the difference matrix, and adding the second segmentation unit corresponding to the second target difference value less than the preset difference threshold into the second set;
[0193] Step 150: if the number of second segmentation units in the second set is greater than a preset number threshold, the second set is merged into the first set to obtain a new first set, and for the untraversed second segmentation units in the new first set, the step of determining whether the first segmentation unit is a marked seed unit in step 146 is returned to be executed until all first segmentation units in the new first set are traversed;
[0194] Step 151: if the number of the second segmentation units in the second set is not greater than the preset number threshold, determine that the first segmentation unit of the marked dog is a boundary unit, and add the marked first segmentation unit to the cluster;
[0195] Step 152: After traversing all first segmentation units in the neighborhood of the marked seed unit, return to the step of determining the seed unit from all the segmentation units.
[0196] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0197] Based on the same inventive concept, the embodiment of the present application also provides a clustering device for implementing the clustering method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more clustering device embodiments provided below can refer to the limitations on the clustering method above, and will not be repeated here.
[0198] In one embodiment, Fig.14 As shown, a clustering device 10 is provided, comprising: a segmentation module 11 and a clustering module 12, wherein:
[0199] The segmentation module 11 is used to segment the data to be processed by using a segmentation algorithm to obtain the semantic category of each segmentation unit.
[0200] The clustering module 12 is used to perform cluster analysis on each segmentation unit based on the difference matrix and the semantic category of each segmentation unit; the difference matrix is determined according to the confusion matrix corresponding to the segmentation algorithm.
[0201] In one embodiment, the clustering module 12 includes a first determination unit, a traversal unit, and a second determination unit. The first determination unit is used to determine a seed unit from all segmentation units; the traversal unit is used to traverse all first segmentation units in the neighborhood of the seed unit, and determine the first target difference value between each first segmentation unit and the seed unit according to the difference matrix; the second determination unit is used to determine the cluster corresponding to the seed unit according to the first target difference value; and after traversing all first segmentation units in the neighborhood of the seed unit, return to use the first determination unit to perform the corresponding steps.
[0202] In one embodiment, the second determination unit includes an adding subunit and a determining subunit. The adding subunit is used to add the first segmentation unit corresponding to the first target difference value less than the preset difference threshold to the first set; the determining subunit is used to determine the cluster corresponding to the seed unit according to the first segmentation unit in the first set if the number of the first segmentation units in the first set is greater than the preset number threshold.
[0203] In one embodiment, the determination subunit is further configured to determine that the seed unit is a noise unit if the number of the first segmentation units in the first set is not greater than a preset number threshold.
[0204] In one embodiment, the subunit is determined to be specifically used to establish a cluster corresponding to the seed unit, and the seed unit is added to the cluster; each first segmentation unit in the first set is traversed to determine the segmentation unit added to the cluster.
[0205] In one embodiment, the first determination unit is also used to mark the seed unit, and the determination subunit is specifically used to determine, for each first segmentation unit in the first set, whether the first segmentation unit is a marked seed unit; if the first segmentation unit is a marked seed unit, the first segmentation unit is added to the cluster; if the first segmentation unit is not a marked seed unit, the first segmentation unit is marked, and all second segmentation units in the neighborhood of the marked first segmentation unit are traversed to determine the second set; based on the second set, the segmentation unit to be added to the cluster is determined.
[0206] In one embodiment, the determination subunit is specifically used to traverse all second segmentation units in the neighborhood of the marked first segmentation unit, and determine the second target difference value between each second segmentation unit and the marked first segmentation unit according to the difference matrix; and add the second segmentation unit corresponding to the second target difference value less than the preset difference threshold to the second set.
[0207] In one embodiment, the determination subunit is specifically used to merge the second set into the first set to obtain a new first set if the number of the second segmentation units in the second set is greater than the preset number threshold, and for the first segmentation units that have not been traversed in the new first set, return to execute the step of determining whether the first segmentation unit is a marked seed unit until all the first segmentation units in the new first set are traversed; if the number of the second segmentation units in the second set is not greater than the preset number threshold, determine that the marked first segmentation unit is a boundary unit, and add the marked first segmentation unit to the cluster.
[0208] In one embodiment, the traversal unit is used to determine the initial difference value between each first segmentation unit and the seed unit according to the difference matrix; determine the distance value between each first segmentation unit and the seed unit; and determine the first target difference value according to the distance value and the initial difference value.
[0209] In one embodiment, the traversal unit is also used to determine the initial difference value between each first segmentation unit and the seed unit according to the difference matrix; determine the absolute value of the difference between the maximum height value of each first segmentation unit and the maximum height value of the seed unit; and determine the first target difference value according to the absolute value of the difference and the initial difference value.
[0210] In one embodiment, the traversal unit is further used to determine the absolute value of the difference between the maximum height value of each first segmentation unit and the maximum height value of the seed unit; and determine the first target difference value according to the distance value, the absolute value of the difference and the initial difference value.
[0211] In one embodiment, the determination module is further used to determine a conditional probability matrix corresponding to each semantic category according to the confusion matrix; and determine a difference matrix according to the conditional probability matrix.
[0212] Each module in the above clustering device can be implemented in whole or in part by software, hardware or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each module.
[0213] In one embodiment, a computer device is provided. The computer device can be a smart terminal, and its internal structure diagram can be as follows: Figure 1 As shown. Those skilled in the art can understand that Figure 1 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0214] In one embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the following steps are implemented:
[0215] The segmentation algorithm is used to segment the data to be processed to obtain the semantic category of each segmentation unit;
[0216] Based on the difference matrix and the semantic category of each segmentation unit, a cluster analysis is performed on each segmentation unit; the difference matrix is determined according to the confusion matrix corresponding to the segmentation algorithm.
[0217] In one embodiment, a computer readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:
[0218] The segmentation algorithm is used to segment the data to be processed to obtain the semantic category of each segmentation unit;
[0219] Based on the difference matrix and the semantic category of each segmentation unit, a cluster analysis is performed on each segmentation unit; the difference matrix is determined according to the confusion matrix corresponding to the segmentation algorithm.
[0220] In one embodiment, a computer program product is provided, comprising a computer program, which, when executed by a processor, implements the following steps:
[0221] The segmentation algorithm is used to segment the data to be processed to obtain the semantic category of each segmentation unit;
[0222] Based on the difference matrix and the semantic category of each segmentation unit, a cluster analysis is performed on each segmentation unit; the difference matrix is determined according to the confusion matrix corresponding to the segmentation algorithm.
[0223] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.
[0224] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0225] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A clustering method, characterized in that: The method comprises: The segmentation algorithm is used to segment the data to be processed to obtain the semantic category of each segmentation unit; Based on the difference matrix and the semantic category of each segmentation unit, cluster analysis is performed on each segmentation unit; the difference matrix is determined according to the confusion matrix corresponding to the segmentation algorithm.
2. The method according to claim 1, characterized in that: The method of determining the difference matrix includes: Determine, according to the confusion matrix, a conditional probability matrix corresponding to each of the semantic categories; The difference matrix is determined according to the conditional probability matrix.
3. The method according to claim 1, characterized in that The step of performing cluster analysis on each segmentation unit according to the difference matrix and the semantic category of each segmentation unit comprises: Determining a seed unit from all of the segmentation units; Traversing all first segmentation units in the neighborhood of the seed unit, and determining a first target difference value between each of the first segmentation units and the seed unit according to the difference matrix; According to the first target difference value, the cluster corresponding to the seed unit is determined; and after traversing all the first segmentation units in the neighborhood of the seed unit, returning to execute the step of determining the seed unit from all the segmentation units.
4. The method according to claim 3, characterized in that The step of determining the cluster corresponding to the seed unit according to the first target difference value includes: Adding the first segmentation unit corresponding to the first target difference value that is less than a preset difference threshold to the first set; If the number of the first segmentation units in the first set is greater than a preset number threshold, the cluster corresponding to the seed unit is determined according to the first segmentation units in the first set.
5. The method according to claim 4, characterized in that The method further comprises: If the number of the first segmentation units in the first set is not greater than the preset number threshold, the seed unit is determined to be a noise unit.
6. The method according to claim 4, characterized in that The determining the cluster corresponding to the seed unit according to the first segmentation unit in the first set includes: Establishing a cluster corresponding to the seed unit, and adding the seed unit to the cluster; Each of the first segmentation units in the first set is traversed to determine a segmentation unit to be added to the cluster.
7. The method according to claim 6, characterized in that After determining the seed unit from all the segmentation units, the method further includes: marking the seed unit; The traversing each of the first segmentation units in the first set to determine a segmentation unit to be added to the cluster includes: For each of the first segmentation units in the first set, determining whether the first segmentation unit is a marked seed unit; If the first segmentation unit is a marked seed unit, adding the first segmentation unit to the cluster; If the first segmentation unit is not a marked seed unit, the first segmentation unit is marked, and all second segmentation units in the neighborhood of the marked first segmentation unit are traversed to determine a second set; and a segmentation unit added to the cluster is determined according to the second set.
8. The method according to claim 7, characterized in that The traversing all second segmentation units in the neighborhood of the marked first segmentation unit to determine a second set includes: Traversing all the second segmentation units in the neighborhood of the marked first segmentation unit, and determining a second target difference value between each of the second segmentation units and the marked first segmentation unit according to the difference matrix; The second segmentation unit corresponding to the second target difference value smaller than the preset difference threshold is added to the second set.
9. The method according to claim 7, characterized in that: The step of determining, according to the second set, a segmentation unit to be added to the cluster comprises: If the number of the second segmentation units in the second set is greater than the preset number threshold, the second set is merged into the first set to obtain a new first set, and for the first segmentation units that have not been traversed in the new first set, the step of determining whether the first segmentation unit is a marked seed unit is returned to be executed until all the first segmentation units in the new first set are traversed; If the number of the second segmentation units in the second set is not greater than the preset number threshold, the marked first segmentation unit is determined to be a boundary unit, and the marked first segmentation unit is added to the cluster.
10. The method according to any one of claims 3 to 9, characterized in that: The determining, according to the difference matrix, a first target difference value between each of the first segmentation units and the seed unit comprises: Determining, according to the difference matrix, an initial difference value between each of the first segmentation units and the seed unit; Determine the distance value between each of the first segmentation units and the seed unit; The first target difference value is determined according to the distance value and the initial difference value.
11. The method according to any one of claims 3 to 9, characterized in that: The determining, according to the difference matrix, a first target difference value between each of the first segmentation units and the seed unit comprises: Determining, according to the difference matrix, an initial difference value between each of the first segmentation units and the seed unit; Determine the absolute value of the difference between the maximum height value of each of the first segmentation units and the maximum height value of the seed unit; The first target difference value is determined according to the absolute value of the difference and the initial difference value.
12. The method according to claim 10, characterized in that The determining the first target difference value according to the distance value and the initial difference value includes: Determine the absolute value of the difference between the maximum height value of each of the first segmentation units and the maximum height value of the seed unit; The first target difference value is determined according to the distance value, the absolute value of the difference value and the initial difference value.
13. A clustering device, characterized in that: The device comprises: A segmentation module is used to segment the data to be processed using a segmentation algorithm to obtain the semantic category of each segmentation unit; A clustering module is used to perform cluster analysis on each segmentation unit based on a difference matrix and a semantic category of each segmentation unit; the difference matrix is determined according to a confusion matrix corresponding to the segmentation algorithm.
14. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 12 are implemented.
15. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 12 are implemented.
16. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 12 are implemented.