Data classification method, device, electronic device and storage medium
By constructing a hierarchical clustering tree in clustering analysis and segmenting it according to preset height, the problem of low classification accuracy in large-scale mixed data sets is solved, and more refined and accurate data classification is achieved.
Patent Information
- Application Number
- CN202310548903.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-05-15
- Publication Date
- 2024-11-19
- Estimated Expiration
- 2043-05-15
AI Technical Summary
In clustering analysis, existing methods are difficult to determine obvious critical distances or cluster counts in large-scale mixed dataset scenarios, resulting in low accuracy of classification results.
By constructing a hierarchical clustering tree, segmenting the hierarchical clustering tree according to the preset target height, obtaining initial clusters that meet specific conditions, and further segmenting these initial clusters according to the second target height, dynamically implementing multiple segmentation to improve The precision and accuracy of classification results.
The accuracy of data classification is improved, especially in large-scale mixed data set scenarios, and the classification results obtained are more refined and accurate.
Smart Images

Figure CN116645536B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of data analysis, and more specifically, to a data classification method, device, electronic device and computer-readable storage medium. Background Art
[0002] Cluster analysis is a technology for data classification analysis. Cluster analysis divides all data in a data set into multiple categories (clusters) according to similarity. It is widely used in many fields such as machine learning, data mining, pattern recognition, image analysis, and bioinformatics.
[0003] At present, in cluster analysis, a hierarchical clustering tree can be constructed according to the data set, and then the critical height of the hierarchical clustering tree can be set, and the hierarchical clustering tree can be segmented by the set critical height to obtain the classification result of the data set. However, using this method, the accuracy of data classification is low.
[0004] Therefore, there is an urgent need for a data classification method to improve the accuracy of data classification. Summary of the invention
[0005] The present application proposes a data classification method, device, electronic device and computer-readable storage medium to improve the above-mentioned defects.
[0006] In a first aspect, an embodiment of the present application provides a data classification method, the method comprising: constructing a hierarchical clustering tree based on multiple target video frames in driving video data; segmenting the hierarchical clustering tree according to a first target height to obtain multiple initial clusters; obtaining initial clusters that meet preset conditions from the multiple initial clusters, and meeting the preset conditions includes: the number of parent nodes of the corresponding cluster below the first target height is not less than a preset number; segmenting the initial cluster that meets the preset conditions according to a second target height to obtain multiple intermediate clusters, the second target height being less than the first target height; and obtaining classification results corresponding to the multiple target video frames based on the multiple initial clusters and the multiple intermediate clusters.
[0007] In a second aspect, an embodiment of the present application further provides a data classification device, the device comprising:
[0008] A construction module, used for constructing a hierarchical clustering tree according to a plurality of target video frames in the driving video data;
[0009] A first determination module is used to segment the hierarchical clustering tree according to a first target height to obtain a plurality of initial clusters;
[0010] An acquisition module is used to acquire an initial cluster that meets a preset condition from multiple initial clusters, where the preset condition includes: the number of parent nodes of the corresponding cluster below the first target height is not less than a preset number;
[0011] A second determination module, configured to segment the initial clusters satisfying the preset condition into a plurality of intermediate clusters according to a second target height, wherein the second target height is less than the first target height;
[0012] The output module is used to obtain classification results corresponding to multiple target video frames according to the multiple initial clusters and the multiple intermediate clusters.
[0013] In a third aspect, an embodiment of the present application further provides an electronic device, characterized in that the electronic device comprises: one or more processors; a memory; one or more applications, wherein the one or more applications are stored in the memory and configured to be executed by the one or more processors, and the one or more programs are configured to execute the above method.
[0014] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, which stores a program code executable by a processor, and when the program code is executed by the processor, the processor executes the above method.
[0015] The present application provides a data classification method, device, electronic device and computer-readable storage medium. In the present application, a hierarchical clustering tree is first constructed according to multiple target video frames in driving video data, and then the hierarchical clustering tree is segmented according to a first target height to obtain multiple initial clusters. Initial clusters that meet preset conditions are obtained from the multiple initial clusters, and the initial clusters that meet the preset conditions are segmented according to a second target height. Finally, classification results corresponding to the multiple target video frames are obtained. Through the first target height and the second target height, dynamic segmentation and multiple segmentations of the multiple target video frames in the driving video data are realized, and the obtained classification results are more precise and accurate, thereby improving the accuracy of data classification.
[0016] Other features and advantages of the embodiments of the present application will be described in the subsequent description, and partly become apparent from the description, or be understood by practicing the embodiments of the present application. The purposes and other advantages of the embodiments of the present application can be realized and obtained by the structures specifically pointed out in the written description, claims, and drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.
[0018] Figure 1 A flow chart of a data classification method proposed according to an embodiment of the present application is shown.
[0019] Figure 2 A schematic diagram of an initial cluster in an embodiment of the present application is shown.
[0020] Figure 3 A flow chart of a data classification method proposed according to yet another embodiment of the present application is shown.
[0021] Figure 4 A schematic diagram of a target mapping relationship in an embodiment of the present application is shown.
[0022] Figure 5 A schematic diagram of a classification result in an embodiment of the present application is shown.
[0023] Figure 6 A structural block diagram of a data classification device proposed in an embodiment of the present application is shown.
[0024] Figure 7 A schematic diagram of an electronic device provided in an embodiment of the present application is shown. DETAILED DESCRIPTION
[0025] In order to make those skilled in the art better understand the present application scheme, the technical scheme in the present application embodiment will be clearly and completely described below in conjunction with the drawings in the present application embodiment. Obviously, the described embodiment is only a part of the present application embodiment, rather than all the embodiments. The components of the present application embodiment usually described and shown in the drawings here can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the present application for protection, but merely represents the selected embodiment of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present application.
[0026] It should be noted that similar numbers and letters represent similar items in the following drawings, so once an item is defined in one drawing, it does not need to be further defined and explained in the subsequent drawings. At the same time, in the description of this application, the terms "first", "second", etc. are only used to distinguish the description and cannot be understood as indicating or implying relative importance.
[0027] Cluster analysis is a technology for data classification analysis. Cluster analysis divides all data in a data set into multiple categories (clusters) according to similarity. It is widely used in machine learning, data mining, pattern recognition, image analysis, bioinformatics and other fields.
[0028] At present, in cluster analysis, the hierarchical clustering tree is segmented according to the specified number of clusters and the hierarchical clustering tree is segmented according to the set critical height, and the segmentation result is used as the classification result of the hierarchical clustering tree. Among them, the number of clusters can be determined according to the scatter diagram of data points and statistics.
[0029] However, the inventors found in their research that in large-scale mixed data set scenarios, the hierarchical clustering tree often does not have an obvious critical distance, or the number of clusters is not so obvious. The above method is used to confirm the number of clusters of the data set and thus determine the classification results. The accuracy of the final classification results is low.
[0030] Therefore, in order to overcome the above-mentioned defects, the inventors proposed a data classification method, device, electronic device and computer-readable storage medium, by constructing a hierarchical clustering tree according to multiple target video frames in driving video data, and then segmenting the hierarchical clustering tree according to a first target height to obtain multiple initial clusters, obtaining initial clusters that meet preset conditions from the multiple initial clusters, and segmenting the initial clusters that meet the preset conditions according to a second target height, and finally obtaining classification results corresponding to the multiple target video frames. Through the first target height and the second target height, dynamic segmentation and multiple segmentations of multiple target video frames in the driving video data are realized, and the obtained classification results are more precise and accurate, thereby improving the accuracy of data classification.
[0031] See also Figure 1 , Figure 1 A flow chart of a data classification method proposed in an embodiment of the present application is shown, which is used in an electronic device. The method includes:
[0032] S101: construct a hierarchical clustering tree according to multiple target video frames in driving video data.
[0033] The driving video data refers to the video data of the vehicle surroundings collected by the vehicle camera or driving recorder. The target video frame refers to the video frame selected from multiple video frames of the driving video data. One video frame can be selected as a target video frame, or a video frame selected every few seconds can be selected as a target video frame. The actual selection can be determined according to business needs. The driving video data can be a video including pedestrians, trees, cars, etc.
[0034] Hierarchical Clustering is a type of clustering algorithm that creates a hierarchical nested clustering tree by calculating the similarity between data points of different categories. In a hierarchical clustering tree, the original data points of different categories are the lowest level of the tree, and the top level of the tree is the root node of a cluster. There are two ways to create a hierarchical clustering tree: bottom-up merging and top-down splitting. Here, a hierarchical clustering tree can be created by the bottom-up merging method.
[0035] In this embodiment, S101 may include: obtaining multiple target video frames as multiple clustering clusters; calculating the distance between any two clustering clusters in the multiple clustering clusters; merging two clustering clusters with the smallest distance in the multiple data clustering clusters, and retaining other clustering clusters to obtain multiple new clustering clusters; returning to execute the step of calculating the distance between any two clustering clusters in the multiple clustering clusters until the multiple clustering clusters are merged into one clustering cluster; constructing a hierarchical clustering tree corresponding to the multiple target video frames based on the multiple clustering clusters and the new clustering clusters after each merger.
[0036] Among them, clusters (or cluster-like) refer to subsets, and hierarchical clustering maximizes the similarity within clusters and minimizes the similarity between clusters.
[0037] When calculating the distance between multiple clusters for the first time, each cluster includes only one target video frame. To calculate the distance between two clusters, it is only necessary to calculate the distance between the two target video frames. The two clusters with the closest distance among the multiple clusters are merged to obtain multiple new clusters. When calculating the distance between multiple clusters this time, each cluster includes at least two target video frames. The distance between two clusters can be obtained by the shortest distance method, the longest distance method, the cluster average method, the centroid method and other methods.
[0038] Among them, the shortest distance method is to use the distance between the two closest data points in two clusters as the distance between the two clusters; the farthest distance method is to use the distance between the two farthest data points in two clusters as the distance between the two clusters; the cluster average method is to calculate the distance between each data point in the two clusters and all other data points, and use the mean of all distances as the distance between the two clusters; the centroid method is to first obtain the centroid of all data points in the two clusters, and use the distance between the centers of the two clusters as the distance between the two clusters. Among them, a target video frame is regarded as a data point.
[0039] For example, the driving video data includes 8 target video frames a1, a2, a3, a4, a5, a6, a7, and a8. These 8 target video frames are used as 8 clusters. The distances between the 8 clusters are calculated. The two clusters with the closest distance among the 8 clusters are merged to obtain 4 new clusters b1 (including clusters a1 and a2), cluster b2 (including clusters a3 and a4), cluster b3 (including clusters a5 and a6), and cluster b4 (including clusters a7 and a8). The distances between the 4 clusters are calculated again. The two clusters with the closest distance among the 8 clusters are merged to obtain 2 new clusters c1 (including clusters b1 and b2) and cluster c2 (including clusters b3 and b4). Finally, clusters c1 and c2 are merged to obtain one cluster, and a hierarchical clustering tree corresponding to multiple target video frames is constructed.
[0040] S102: Segment the hierarchical clustering tree according to the first target height to obtain a plurality of initial clusters.
[0041] In some embodiments, the first target height can be determined by a preset algorithm, such as a random height determination, a dichotomy height determination, or a trichotomy height determination. For example, if the height of the hierarchical clustering tree is D, the first target height determined by the dichotomy method may be D / 2.
[0042] In some embodiments, before step S102, the following may also be included: determining a target mapping relationship based on the height of the hierarchical clustering tree and the target angle range; determining a first target value within the target angle range; and determining a height corresponding to the first target value in the hierarchical clustering tree based on the target mapping relationship as the first target height.
[0043] The target angle interval may be an angle interval of any form such as [a°, b°], or may be expressed in radians.
[0044] In some implementations, the first target value may be selected in the target angle interval by a binary method, or the first target value may be selected in the target angle interval by a trisection method.
[0045] Taking the target angle interval as the degree interval of [0°, 90°], and selecting the first target value by binary search as an example, 45° is selected as the first target value in [0°, 90°]. If the highest height of the hierarchical clustering tree is h, then the height corresponding to the first target value, that is, the first target height, is h / 2.
[0046] In some embodiments, determining the target mapping relationship based on the height of the hierarchical clustering tree and the target angle interval can include: obtaining the maximum height of the hierarchical clustering tree, the minimum height of the hierarchical clustering tree, the minimum value of the target angle interval, and the maximum value of the target angle interval; determining the proportional relationship between the first difference and the second difference as the target mapping relationship, the first difference being the difference between the maximum value and the minimum value, and the second difference being the difference between the maximum height and the minimum height.
[0047] In some implementations, the maximum height of the hierarchical clustering tree, the minimum height of the hierarchical clustering tree, the minimum value of the target angle interval, and the maximum value of the target angle interval are obtained, and the mapping coefficient, that is, the proportional relationship, is calculated as follows:
[0048]
[0049] Among them, k is the proportional relationship, b° is the maximum value of the target angle interval, a° is the minimum value of the target angle interval, and h max is the maximum height of the hierarchical clustering tree, h min is the minimum height of the hierarchical clustering tree, usually h min is 0, and the value of any height h1 of the hierarchical clustering tree mapped to the target angle interval is k×h1.
[0050] S103 , obtaining an initial cluster that meets a preset condition from multiple initial clusters, where the preset condition is met including: the number of parent nodes of the corresponding cluster below the first target height is not less than a preset number.
[0051] The parent node refers to a node obtained by merging two clusters, and the preset number can be set according to the shape of the hierarchical clustering tree or directly set according to demand.
[0052] For Figure 2 The hierarchical clustering tree shown, Figure 2 The straight line 210 in the middle represents the dividing line where the first target height is located. The hierarchical clustering tree can be divided according to the straight line 210 to obtain two initial clusters as shown in area 220 and area 230. If the preset number is 2, the parent node of the initial cluster in area 220 is shown as 221, and the number of parent nodes of the initial cluster shown in area 220 is 2, which meets the preset condition; the parent node of the initial cluster in area 230 is shown as 231, and the number of parent nodes of the initial cluster shown in area 230 is 1, which does not meet the preset condition.
[0053] S104 , dividing the initial cluster that meets the preset condition into a plurality of intermediate clusters according to a second target height, wherein the second target height is smaller than the first target height.
[0054] In some implementations, the second target height may be determined based on the height of the initial cluster by bisection or trisection, etc. For example, if the height of the initial cluster is h1, then the second target height determined by bisection is h1 / 2.
[0055] If there are multiple initial clusters that meet the preset conditions, the second heights of the multiple initial clusters that meet the preset conditions may be the same, and the initial clusters that meet the preset conditions are segmented according to the second target height to obtain multiple intermediate clusters corresponding to each initial cluster that meets the preset conditions. For example, if the height of the multiple initial clusters obtained after segmentation is h2, the height of the initial cluster that meets the preset conditions is also h2. At this time, the second target height determined by the binary search method is h2 / 2, and the second target height is the second target height of each initial cluster that meets the preset conditions.
[0056] In some embodiments, before step S104, it may also include: determining a second target value corresponding to the initial cluster that meets the preset conditions from the target angle range; determining the height corresponding to the second target value of the initial cluster in the hierarchical clustering tree according to the target mapping relationship, as the second target height corresponding to the initial cluster that meets the preset conditions.
[0057] Taking the target angle interval of [0°, 90°], the height of the hierarchical clustering tree as h, and the first target value of 45° as an example, the initial cluster is obtained by segmenting the hierarchical clustering tree according to the first target height h / 2 corresponding to the first target value, and then the second target value is selected from the target angle interval of [0°, 90°], and the second target value is less than the first target value.
[0058] The target mapping relationship is shown in step S102. The proportional relationship and the second target value are known. The height of the hierarchical clustering tree corresponding to the second target value can be obtained by calculation. This height is the second target height corresponding to the initial cluster that meets the preset conditions. For example, there are multiple initial clusters that meet the preset conditions. If the second target value is determined to be 22.5°, the second target height corresponding to the second target value is h / 4. The multiple initial clusters that meet the preset conditions are divided at h / 4 to obtain multiple intermediate clusters corresponding to each of the multiple initial clusters that meet the preset conditions.
[0059] S105 . Obtain classification results corresponding to multiple target video frames according to the multiple initial clusters and the multiple intermediate clusters.
[0060] The classification results corresponding to the multiple target video frames at least include the number of clusters after the driving video data is segmented and the target video frames contained in each segmented cluster (each segmented cluster is also a classification result). Taking the driving video data as a video including pedestrians, trees and cars as an example, the target video frames are extracted from the video, the target video frames contain pedestrians, the target video frames contain trees, and the target video frames contain cars. The multiple target video frames are classified according to the objects in them, and the corresponding classification results are that the target video frames with pedestrians are one cluster, the target video frames with trees are one cluster, and the target video frames with cars are one cluster.
[0061] The number of clusters after the driving video data is segmented is the sum of the number of initial clusters that do not meet the preset conditions and the number of intermediate clusters. Each segmented cluster can be, or can be, an intermediate cluster obtained by segmenting an initial cluster that meets the preset conditions.
[0062] In this embodiment, each initial cluster that does not meet the preset conditions can be obtained as a segmented cluster in the classification results corresponding to multiple target video frames, and each intermediate cluster can be obtained as a segmented cluster in the classification results corresponding to multiple target video frames. Each intermediate cluster and the initial cluster that does not meet the preset conditions are summarized to obtain the classification results corresponding to multiple target video frames.
[0063] In this embodiment, the first target height is determined, and the hierarchical clustering tree is segmented according to the first target height to obtain multiple initial clusters. The initial clusters that meet the preset conditions are obtained from the multiple initial clusters, and the initial clusters that meet the preset conditions are segmented according to the second target height. Finally, classification results corresponding to multiple target video frames are obtained. Through the first target height and the second target height, dynamic segmentation and multiple segmentations of multiple target video frames are achieved, and the obtained classification results are more refined and accurate, thereby improving the accuracy of data classification.
[0064] See also Figure 3 , Figure 3 A flow chart of a data classification method proposed in another embodiment of the present application is shown, which is used in an electronic device. The method includes:
[0065] S201, constructing a hierarchical clustering tree according to a plurality of target video frames in the driving video data; segmenting the hierarchical clustering tree according to a first target height to obtain a plurality of initial clusters.
[0066] S202: Acquire an initial cluster that meets a preset condition from multiple initial clusters, where the preset condition includes: the number of parent nodes of the corresponding cluster below the first target height is not less than a preset number.
[0067] S203 , dividing the initial cluster that meets the preset condition into a plurality of intermediate clusters according to a second target height, wherein the second target height is smaller than the first target height.
[0068] The description of S201 to S203 refers to the description of S101 to S104 above, which will not be repeated here.
[0069] S204, if the intermediate cluster satisfies the first condition, determine the third target height corresponding to the intermediate cluster; the first condition includes: the number of parent nodes of the corresponding cluster below the second target height is not less than the target number; obtain the intermediate cluster that meets the first condition as a new initial cluster that meets the preset condition, and obtain the third target height as a new second target height.
[0070] In some embodiments, a method for obtaining the third target height may include: determining a third target value corresponding to an intermediate cluster that meets preset conditions within a target angle range; determining a height corresponding to the third target value of the initial cluster in a hierarchical clustering tree based on a target mapping relationship as the third target height corresponding to the intermediate cluster that meets preset conditions.
[0071] The third target height is smaller than the second target height, and a target mapping relationship between the third target height and the third target value is as shown in step S102.
[0072] Among them, when judging whether the intermediate clusters obtained by each segmentation meet the preset conditions, the target number in the first condition can be different or the same, the target number can be set according to the shape of the hierarchical clustering tree, or can be directly set according to the needs, and the target number can be the same as the preset number or different.
[0073] In some embodiments, the target number in the first condition can be set according to the number of segmentations. The more segmentations there are, the smaller the preset number. For example, if segmentation is performed for the second time, the target number can be set to 3; if segmentation is performed for the third time, the target number can be set to 2.
[0074] If the intermediate cluster does not meet the first condition, that is, the number of parent nodes of the corresponding cluster below the second target height is less than the target number, then after executing step 203, each initial cluster that does not meet the preset condition can be obtained as a segmented cluster in the classification results corresponding to the multiple target video frames, and each intermediate cluster can be obtained as a segmented cluster in the classification results corresponding to the multiple target video frames, and each intermediate cluster and the initial cluster that does not meet the preset condition are summarized to obtain the classification results corresponding to the multiple target video frames.
[0075] S205, returning to the step of segmenting the initial cluster that meets the preset condition according to the second target height to obtain multiple intermediate clusters, until the second condition is met, and obtaining classification results corresponding to multiple target video frames according to each cluster after each segmentation.
[0076] like Figure 4As shown, the target angle interval is [0°, 90°], the highest height of the hierarchical clustering tree is H, the selected first target value is 45°, and the hierarchical clustering tree is segmented according to the first target height H / 2 corresponding to the first target value to obtain multiple initial clusters, and the initial cluster whose number of parent nodes below the first target height is not less than a preset number is obtained from the multiple initial clusters, and the second target value 22.5° corresponding to the initial cluster is selected from [0°, 90°], and the initial cluster whose number of parent nodes below the first target height is not less than a preset number is segmented according to the second target height H / 4 corresponding to the second target value to obtain multiple intermediate clusters. , obtain an intermediate cluster whose number of parent nodes below the second target height is not less than the target number from multiple intermediate clusters, select a third target value 11.25° corresponding to the intermediate cluster from [0°, 90°], determine the third target height H / 8 corresponding to the intermediate cluster, obtain an intermediate cluster whose number of parent nodes below the second target height is not less than the target number as a new initial cluster, obtain the third target height corresponding to the intermediate cluster as a new second target height, segment the new initial cluster according to the new second target height until the second condition is met, and obtain classification results corresponding to multiple target video frames according to each cluster after each segmentation.
[0077] according to Figure 4 The target angle interval, the first target height, and the multiple second target heights shown in the figure are used to segment the hierarchical clustering tree corresponding to the multiple target video frames, and the classification results are as follows: Figure 5 As shown, straight line 401 represents the dividing line of the first target height corresponding to the first target value 45°, straight line 402 represents the dividing line of the second target height corresponding to the first second target value 22.5°, area 404 is an initial cluster that meets the preset conditions, and area 404 can be divided according to straight line 402 to obtain multiple intermediate clusters, straight line 403 represents the dividing line of the second target height corresponding to the second second target value 11.25°, and area 405 represents a new initial cluster that meets the preset conditions, and area 404 can be divided according to straight line 403 to obtain multiple new intermediate clusters.
[0078] In some implementations, the second condition includes: the number of clusters after segmentation is greater than a preset number of clusters and / or the number of segmentations is greater than a preset number of times. The preset number of clusters and the preset number of times can be set according to requirements.
[0079] For example, if the preset number of times is 3 times and the number of segmentation is greater than 3 times, stop returning to the step of segmenting the initial cluster that meets the preset conditions according to the second target height to obtain multiple intermediate clusters, and directly obtain the multiple initial clusters and intermediate clusters obtained by 3 segmentations and the target video frames included in each initial cluster and intermediate cluster as the classification results corresponding to the output multiple target video frames.
[0080] For another example, if the preset number of clusters is 8, no matter how many times the segmentation is performed, as long as the sum of the number of clusters of the multiple initial clusters and the intermediate clusters obtained by segmentation is greater than 8, stop returning to the step of segmenting the initial clusters that meet the preset conditions according to the second target height to obtain multiple intermediate clusters, and directly obtain the number of clusters at this time and the target video frames included in each cluster as the classification results corresponding to the multiple target video frames.
[0081] For another example, if the preset number of times is 4 and the preset number of clusters is 8, only when the number of segmentation is greater than 4 and the sum of the number of initial clusters and intermediate clusters obtained after segmentation is greater than 8, will the process stop and return to the step of segmenting the initial clusters that meet the preset conditions according to the second target height to obtain multiple intermediate clusters, and obtain the number of clusters at this time and the target video frames included in each cluster as the classification results corresponding to the multiple target video frames.
[0082] In this embodiment, an intermediate cluster that meets the preset conditions is obtained as a new initial cluster, a third target height corresponding to the intermediate cluster is determined, and the third target height is obtained as a new second target height. The step of segmenting the initial cluster that meets the preset conditions according to the second target height to obtain multiple intermediate clusters is returned to execute until the second condition is met. According to each cluster after each segmentation, classification results corresponding to multiple target video frames are obtained, and dynamic selection of segmentation heights, segmentation times and segmentation areas of the hierarchical clustering tree corresponding to multiple target video frames is realized, so that the obtained classification results are more refined and accurate, and large-scale mixed data sets can be effectively classified, thereby improving the accuracy of data classification.
[0083] See attached Figure 6 , Figure 6 The structure block diagram of a data classification device proposed in one embodiment of the present application is shown. For electronic equipment, the device 500 includes:
[0084] A construction module 501 is used to construct a hierarchical clustering tree according to multiple target video frames in the driving video data;
[0085] A first determination module 502 is used to segment the hierarchical clustering tree according to a first target height to obtain a plurality of initial clusters;
[0086] An acquisition module 503 is used to acquire an initial cluster that meets a preset condition from multiple initial clusters, where the preset condition includes: the number of parent nodes of the corresponding cluster below the first target height is not less than a preset number;
[0087] A second determination module 504 is used to divide the initial clusters that meet the preset conditions into multiple intermediate clusters according to a second target height, and the second target height is less than the first target height;
[0088] The output module 505 is used to obtain classification results corresponding to multiple target video frames according to the multiple initial clusters and the multiple intermediate clusters.
[0089] Optionally, the first determination module 502 is also used to determine the target mapping relationship based on the height of the hierarchical clustering tree and the target angle range; determine the first target value within the target angle range; and determine the height corresponding to the first target value in the hierarchical clustering tree based on the target mapping relationship as the first target height.
[0090] Optionally, the second determination module 504 is also used to determine the second target value of the initial cluster that meets the preset conditions from the target angle range; determine the height corresponding to the second target value of the initial cluster in the hierarchical clustering tree according to the target mapping relationship, as the second target height corresponding to the initial cluster that meets the preset conditions.
[0091] Optionally, the first determination module 502 is also used to obtain the maximum height of the hierarchical clustering tree, the minimum height of the hierarchical clustering tree, the minimum value of the target angle interval, and the maximum value of the target angle interval; determine the proportional relationship between the first difference and the second difference as the target mapping relationship, the first difference is the difference between the maximum value and the minimum value, and the second difference is the difference between the maximum height and the minimum height.
[0092] Optionally, the output module 505 is also used to determine the third target height corresponding to the intermediate cluster if the intermediate cluster satisfies the first condition; the first condition includes: the number of parent nodes of the corresponding cluster below the second target height is not less than the target number; the intermediate cluster that satisfies the first condition is obtained as a new initial cluster that satisfies the preset condition, and the third target height is obtained as a new second target height; return to execute the step of segmenting the initial cluster that meets the preset condition according to the second target height to obtain multiple intermediate clusters until the second condition is met, and obtain classification results corresponding to multiple target video frames according to each cluster after each segmentation.
[0093] Optionally, construction module 501 is also used to obtain multiple target video frames as multiple clustering clusters; calculate the distance between any two clustering clusters in the multiple clustering clusters; merge the two clustering clusters with the smallest distance in the multiple data clustering clusters, and retain the other clustering clusters to obtain multiple new clustering clusters; return to execute the step of calculating the distance between any two clustering clusters in the multiple clustering clusters until the multiple clustering clusters are merged into one clustering cluster; and construct a hierarchical clustering tree corresponding to the multiple target video frames based on the multiple clustering clusters and the new clustering clusters after each merger.
[0094] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described devices and modules can refer to the corresponding processes in the aforementioned method embodiments, and will not be repeated here.
[0095] In addition, each function in each embodiment of the present application can be integrated into one processing module, or each module can exist physically separately, or two or more modules can be integrated into one module. The above integrated module can be implemented in the form of hardware or in the form of software function module.
[0096] Please refer to Figure 7 , which shows a structural block diagram of an electronic device provided according to an embodiment of the present application. The electronic device 600 can be an electronic device capable of running applications, such as a smart phone, a tablet computer, an e-book, and a vehicle. The electronic device 600 in the present application may include one or more of the following components: a processor 610, a memory 620, and one or more applications. One or more applications may be stored in the memory 620 and configured to be executed by one or more processors 610, and one or more programs are configured to execute the method described in the aforementioned method embodiment.
[0097] The processor 610 may include one or more processing cores. The processor 610 uses various interfaces and lines to connect various parts of the entire electronic device 600, and executes various functions and processes data of the electronic device 600 by running or executing instructions, programs, code sets or instruction sets stored in the memory 620, and calling data stored in the memory 620. Optionally, the processor 610 can be implemented in at least one hardware form of digital signal processing (Digital Signal Processing, DSP), field programmable gate array (Field-Programmable Gate Array, FPGA), and programmable logic array (Programmable Logic Array, PLA). The processor 610 can integrate one or a combination of a central processing unit (Central Processing Unit, CPU), a graphics processing unit (Graphics Processing Unit, GPU) and a modem. Among them, the CPU mainly processes the operating system, user interface and application programs; the GPU is responsible for rendering and drawing display content; and the modem is used to process wireless communications. It can be understood that the above-mentioned modem may not be integrated into the processor 610, but may be implemented separately through a communication chip.
[0098] The memory 620 may include a random access memory (RAM) or a read-only memory (ROM). The memory 620 may be used to store instructions, programs, codes, code sets or instruction sets. The memory 620 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for implementing at least one function (such as a touch function, a sound playback function, an image playback function, etc.), instructions for implementing the following various method embodiments, etc. The data storage area may also store data (such as a phone book, audio and video data, chat record data) created by the electronic device 600 during use.
[0099] As another aspect, the present application further provides a computer-readable storage medium, in which program code is stored. The program code can be called by a processor to execute the method described in the above method embodiment.
[0100] The computer readable storage medium can be an electronic memory such as a flash memory, an EEPROM (electrically erasable programmable read-only memory), an EPROM, a hard disk, or a cluster of ROMs. Optionally, the computer readable storage medium includes a non-transitory computer-readable storage medium. The computer readable storage medium has storage space for program codes that execute any of the method steps in the above method. These program codes can be read from or written to one or more computer program products. The program code can be compressed, for example, in an appropriate form.
[0101] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A data classification method, characterized in that: The method comprises: Constructing a hierarchical clustering tree according to multiple target video frames in the driving video data; Segmenting the hierarchical clustering tree according to a first target height to obtain a plurality of initial clusters; Acquire an initial cluster that meets a preset condition from the multiple initial clusters, wherein the preset condition includes: the number of parent nodes of the corresponding cluster below the first target height is not less than a preset number; Segmenting the initial cluster that meets the preset condition to obtain a plurality of intermediate clusters according to a second target height, wherein the second target height is less than the first target height; If the middle cluster satisfies the first condition, determining a third target height corresponding to the middle cluster; Acquire the intermediate cluster that meets the first condition as a new initial cluster that meets the preset condition, and acquire the third target height as a new second target height; Return to the step of segmenting the initial cluster that meets the preset condition according to the second target height to obtain multiple intermediate clusters until the second condition is met, and obtain classification results corresponding to the multiple target video frames according to each cluster after each segmentation; wherein the first condition includes: the number of parent nodes of the corresponding cluster below the second target height is not less than the target number; the second condition includes: the number of clusters after segmentation is greater than the preset number of clusters and / or the number of segmentations is greater than the preset number of times.
2. The method according to claim 1, characterized in that The method further comprises: Determining a target mapping relationship according to the height of the hierarchical clustering tree and the target angle interval; determining a first target value within the target angle interval; The height corresponding to the first target value in the hierarchical clustering tree is determined according to the target mapping relationship as the first target height.
3. The method according to claim 2, characterized in that The method further comprises: Determine a second target value corresponding to the initial cluster that meets the preset condition from within the target angle interval; The height corresponding to the second target value of the initial cluster in the hierarchical clustering tree is determined according to the target mapping relationship as the second target height corresponding to the initial cluster that meets the preset condition.
4. The method according to claim 2, characterized in that: Determining the target mapping relationship according to the height of the hierarchical clustering tree and the target angle interval includes: Obtaining the maximum height of the hierarchical clustering tree, the minimum height of the hierarchical clustering tree, the minimum value of the target angle interval, and the maximum value of the target angle interval; A proportional relationship between the first difference and the second difference is determined as the target mapping relationship, wherein the first difference is the difference between the maximum value and the minimum value, and the second difference is the difference between the maximum height and the minimum height.
5. The method according to claim 1, characterized in that The step of constructing a hierarchical clustering tree according to a plurality of target video frames in the driving video data comprises: Acquire the multiple target video frames as multiple clustering clusters; Calculating the distance between any two clusters in the plurality of clusters; Merging two clusters with the smallest distance among the multiple clusters, and retaining other clusters to obtain multiple new clusters; Returning to the step of calculating the distance between any two clusters in the plurality of clusters, until the plurality of clusters are merged into one cluster; A hierarchical clustering tree corresponding to the multiple target video frames is constructed according to the multiple clustering clusters and the new clustering clusters after each merging.
6. A data classification device, characterized in that: The device comprises: A construction module, used for constructing a hierarchical clustering tree according to a plurality of target video frames in the driving video data; A first determination module, configured to segment the hierarchical clustering tree according to a first target height to obtain a plurality of initial clusters; An acquisition module, configured to acquire an initial cluster satisfying a preset condition from the multiple initial clusters, wherein satisfying the preset condition includes: the number of parent nodes of the corresponding cluster below the first target height is not less than a preset number; A second determining module, configured to segment the initial cluster satisfying the preset condition into a plurality of intermediate clusters according to a second target height, wherein the second target height is smaller than the first target height; An output module is used to determine the third target height corresponding to the intermediate cluster if the intermediate cluster satisfies the first condition; obtain the intermediate cluster that satisfies the first condition as a new initial cluster that satisfies the preset condition, and obtain the third target height as a new second target height; return to execute the step of segmenting the initial cluster that meets the preset condition according to the second target height to obtain multiple intermediate clusters until the second condition is met, and obtain the classification results corresponding to the multiple target video frames according to each cluster after each segmentation; wherein the first condition includes: the number of parent nodes of the corresponding cluster below the second target height is not less than the target number; the second condition includes: the number of segmented clusters is greater than the preset number of clusters and / or the number of segmentations is greater than the preset number.
7. An electronic device, characterized in that: include: one or more processors; Memory; One or more applications, wherein the one or more applications are stored in the memory and configured to be executed by the one or more processors, and the one or more applications are configured to execute the method according to any one of claims 1-5.
8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a program code executable by a processor, and when the program code is executed by the processor, the processor executes the method according to any one of claims 1 to 5.
