Anchor frame hyper-parameter setting method and device, storage medium and electronic equipment
By using the combination method of agglomeration hierarchical clustering and K-means clustering in the hyperparameter setting of anchor box, combined with the proportional weighting of the application scenarios, the problem of uneven clustering results is solved, and the detection accuracy and training of the object detection model are improved. efficiency.
Patent Information
- Application Number
- CN202411179553.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-26
- Publication Date
- 2024-12-06
- Estimated Expiration
- 2044-08-26
AI Technical Summary
In the prior art, cluster analysis methods tend to lead to uneven results when setting anchor box hyperparameters, especially for data sets with large sample size differences in category, the clustering results tend to be in categories with large sample sizes and ignore small sample size categories.
The combination method of two-step clustering algorithm is adopted: first group the data sets through the agglomeration hierarchical clustering algorithm to ensure that the in-class spacing and inter-class spacing meet the threshold, and then use the K-means clustering algorithm to target the target box of each grouped sample The sizes are clustered, and finally the anchor box hyperparameters are determined based on the clustering results and application scenarios.
Through this method, more balanced clustering results are obtained, which can better take into account all kinds of samples, and improve the detection accuracy and training convergence speed of the target detection model.
Smart Images

Figure CN119091171A_ABST
Abstract
Description
Background Art
[0002] In the object detection task, all possible pixel boxes on the input image are traversed, and then the correct object box is selected and the position and size are adjusted to complete the object detection task. These predicted pixel boxes are called anchor boxes. These anchor boxes are usually square. The parameters such as the width, height and layout position of the anchor box are called anchor box hyper parameters.
[0003] In related technologies, cluster analysis is used to set anchor box hyperparameters. By clustering the aspect ratio and size of the target box in the data set, the hyperparameters of the anchor box that best suits the data set are automatically learned and determined. Although cluster analysis can better reflect the distribution of the data set and has strong universality, cluster analysis clusters the entire training sample set. For data sets with large differences in category samples, the clustering results tend to favor the large sample size, and not pay enough attention to the small sample size category, resulting in an unbalanced clustering result.
[0004] It should be noted that the information disclosed in the above background technology section is only used to enhance the understanding of the background of the present disclosure, and therefore may include information that does not constitute the prior art known to ordinary technicians in the field. Summary of the invention
[0005] The present disclosure provides a method and device for setting anchor frame hyperparameters, a storage medium, and an electronic device, which at least to a certain extent overcome the problem of unbalanced clustering results in related technologies.
[0006] Other features and advantages of the present disclosure will become apparent from the following detailed description, or may be learned in part by the practice of the present disclosure.
[0007] According to one aspect of the present disclosure, a method for setting anchor box hyperparameters is provided, comprising: obtaining a target data set, wherein the target data set includes samples of multiple categories; grouping the samples of each category in the target data set according to a preset first clustering algorithm to determine multiple grouped samples; clustering the size of the target box of each grouped sample according to a preset second clustering algorithm to determine the clustering result of each grouped sample; and determining the anchor box hyperparameters of the target data set according to the clustering result of each grouped sample.
[0008] In some embodiments, grouping samples of each category in the target data set according to a preset first clustering algorithm to determine multiple grouped samples includes: grouping samples of each category in the target data set according to an agglomerative hierarchical clustering algorithm, based on the intra-class distance satisfying a first threshold and the inter-class distance satisfying a second threshold, to determine multiple grouped samples.
[0009] In some embodiments, clustering the size of the target frame of each grouped sample according to a preset second clustering algorithm to determine the clustering result of each grouped sample includes: clustering the size of the target frame of each grouped sample according to a k-means clustering algorithm to determine the clustering result of each grouped sample.
[0010] In some embodiments, determining the anchor box hyperparameters of the target data set based on the clustering results of each grouped sample includes: proportionally weighting the clustering results of each grouped sample according to the application scenario, and merging to determine the anchor box hyperparameters of the target data set.
[0011] In some embodiments, the clustering results of each grouped sample are weighted proportionally according to the application scenario, and combined to determine the anchor frame hyperparameters of the target data set, including: determining the number ratio of each group of samples after removing redundancy from the clustering results of each group of samples; determining the weight ratio of each group of samples based on the number ratio of each group of samples; determining the anchor frame hyperparameters of the target data set based on the weight ratio of each group of samples.
[0012] In some embodiments, the method further includes: evaluating whether the anchor box hyperparameters of the target data set meet preset conditions according to the application scenario.
[0013] In some embodiments, the method further includes: training a target detection model according to anchor box hyperparameters of the target data set.
[0014] According to another aspect of the present disclosure, there is also provided an anchor frame hyperparameter setting device, including: a target data set acquisition module, used to acquire a target data set, wherein the target data set includes samples of multiple categories; a sample grouping module, used to group samples of each category in the target data set according to a preset first clustering algorithm, and determine multiple grouped samples; a sample clustering module, used to cluster the size of the target frame of each grouped sample according to a preset second clustering algorithm, and determine the clustering result of each grouped sample; an anchor frame hyperparameter determination module, used to determine the anchor frame hyperparameters of the target data set according to the clustering result of each grouped sample.
[0015] According to another aspect of the present disclosure, an electronic device is also provided, comprising: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to execute any one of the above-mentioned anchor frame hyperparameter setting methods by executing the executable instructions.
[0016] According to another aspect of the present disclosure, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, any one of the above-mentioned anchor box hyperparameter setting methods is implemented.
[0017] According to another aspect of the present disclosure, a computer program product is also provided, including a computer program, and when the computer program is executed by a processor, the computer program implements any of the above-mentioned anchor box hyperparameter setting methods.
[0018] The method for setting anchor box hyperparameters provided in the embodiments of the present disclosure obtains a target data set, wherein the target data set includes samples of multiple categories; the samples of each category in the target data set are grouped according to a preset first clustering algorithm to determine multiple grouped samples; the size of the target box of each grouped sample is clustered according to a preset second clustering algorithm to determine the clustering result of each grouped sample; and the anchor box hyperparameters of the target data set are determined according to the clustering result of each grouped sample. The present disclosure performs data set grouping by the first clustering algorithm and clusters the target box by the second clustering algorithm, so that the clustering result takes into account the various types of samples more balanced.
[0019] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] The accompanying drawings herein are incorporated into the specification and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the specification are used to explain the principles of the present disclosure. Obviously, the accompanying drawings described below are only some embodiments of the present disclosure, and for ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without creative work.
[0021] Figure 1 A schematic diagram showing the structure of an anchor frame hyperparameter setting system in an embodiment of the present disclosure;
[0022] Figure 2 A flow chart of a method for setting hyperparameters of an anchor frame in an embodiment of the present disclosure is shown;
[0023] Figure 3 A flowchart showing a specific example of a method for setting anchor frame hyperparameters in an embodiment of the present disclosure is shown;
[0024] Figure 4 A flowchart showing a specific example of a method for setting anchor frame hyperparameters in an embodiment of the present disclosure is shown;
[0025] Figure 5 A schematic diagram showing the results of data set sample grouping in a method for setting anchor frame hyperparameters in an embodiment of the present disclosure;
[0026] Figure 6 A comparison diagram of cluster centers in an embodiment of the present disclosure is shown;
[0027] Figure 7 A schematic diagram of a device for setting hyperparameters of an anchor frame in an embodiment of the present disclosure is shown;
[0028] Figure 8 A structural block diagram of a computer device according to an embodiment of the present disclosure is shown;
[0029] Fig. 9 A schematic diagram showing a computer-readable storage medium in an embodiment of the present disclosure. DETAILED DESCRIPTION
[0030] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in a variety of forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that the disclosure will be more comprehensive and complete and to fully convey the concepts of the example embodiments to those skilled in the art. The described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments.
[0031] In addition, the accompanying drawings are only schematic illustrations of the present disclosure and are not necessarily drawn to scale. The same reference numerals in the figures represent the same or similar parts, and their repeated description will be omitted. Some of the block diagrams shown in the accompanying drawings are functional entities and do not necessarily correspond to physically or logically independent entities. These functional entities can be implemented in software form, or implemented in one or more hardware modules or integrated circuits, or implemented in different networks and / or processor devices and / or microcontroller devices.
[0032] For ease of understanding, before introducing the embodiments of the present disclosure, several terms involved in the embodiments of the present disclosure are first explained as follows:
[0033] Clustering: The process of dividing a collection of physical or abstract objects into multiple clusters of similar objects is called clustering;
[0034] K-means clustering algorithm: K-means clustering algorithm, a commonly used clustering algorithm, is used to obtain anchor box hyperparameters;
[0035] Anchor box hyperparameters: For the target detection task, one solution is to traverse all possible pixel boxes on the input image, then select the correct target box, and adjust the position and size to complete the target detection task. These predicted pixel boxes are called anchor boxes. These anchor boxes are usually square. The width, height, and layout of the anchor box are the anchor box hyperparameters.
[0036] DOTA dataset: Dataset for Object deTection in Aerial images.
[0037] The specific implementation of the embodiment of the present disclosure is described in detail below with reference to the accompanying drawings.
[0038] Figure 1 FIG. 2 shows an exemplary application system architecture diagram to which the anchor frame hyperparameter setting method in the embodiment of the present disclosure can be applied. Figure 1 As shown, the system architecture may include a terminal device 101 , a network 102 and a server 103 .
[0039] The network 102 is a medium for providing a communication link between the terminal device 101 and the server 103, and can be a wired network or a wireless network.
[0040] Optionally, the wireless network or wired network described above uses standard communication technology and / or protocol. The network is usually the Internet, but it can also be any network, including but not limited to a local area network (LAN), a metropolitan area network (MAN), a wide area network (WAN), a mobile, wired or wireless network, a dedicated network or any combination of a virtual private network). In some embodiments, the data exchanged through the network is represented by technologies and / or formats including Hyper Text Mark-up Language (HTML), Extensible Markup Language (XML), etc. In addition, conventional encryption technologies such as Secure Socket Layer (SSL), Transport Layer Security (TLS), Virtual Private Network (VPN), Internet Protocol Security (IPSec) can also be used to encrypt all or some links. In other embodiments, customized and / or dedicated data communication technologies can also be used to replace or supplement the above data communication technologies.
[0041] In a specific instance, the terminal device is used to perform: obtaining a target data set, wherein the target data set includes samples of multiple categories; grouping samples of each category in the target data set according to a preset first clustering algorithm to determine multiple grouped samples; clustering the size of the target box of each grouped sample according to a preset second clustering algorithm to determine the clustering result of each grouped sample; and determining the anchor box hyperparameters of the target data set based on the clustering result of each grouped sample.
[0042] The terminal device 101 can be various electronic devices, including but not limited to smart phones, tablet computers, laptop computers, desktop computers, smart speakers, smart watches, wearable devices, augmented reality devices, virtual reality devices, etc.
[0043] Optionally, the client of the application installed in different terminal devices 101 is the same, or the client of the same type of application based on different operating systems. Based on the different terminal platforms, the specific form of the client of the application can also be different, for example, the application client can be a mobile client, a PC client, etc.
[0044] In a specific instance, the server is used to perform: obtaining a target data set, wherein the target data set includes samples of multiple categories; grouping samples of each category in the target data set according to a preset first clustering algorithm to determine multiple grouped samples; clustering the size of the target box of each grouped sample according to a preset second clustering algorithm to determine the clustering result of each grouped sample; and determining the anchor box hyperparameters of the target data set according to the clustering result of each grouped sample.
[0045] The server 103 may be a server that provides various services, such as a background management server that provides support for the device operated by the user using the terminal device 101. The background management server may analyze and process the received request and other data, and feed back the processing results to the terminal device.
[0046] Optionally, the server can be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network), as well as big data and artificial intelligence platforms.
[0047] Those skilled in the art will know that Figure 1The number of terminal devices, networks and servers in the embodiment is only for illustration, and any number of terminal devices, networks and servers may be provided according to actual needs, and the embodiments of the present disclosure do not limit this.
[0048] Figure 2 A flow chart of a method for setting hyperparameters of an anchor frame in an embodiment of the present disclosure is shown as follows: Figure 1 As shown, the anchor frame hyperparameter setting method provided in the embodiment of the present disclosure includes the following steps:
[0049] S202, obtaining a target data set, wherein the target data set includes samples of multiple categories.
[0050] It should be noted that the target data set may be a data set used for model training. The categories may be classified according to standards or features.
[0051] S204: grouping samples of each category in the target data set according to a preset first clustering algorithm to determine a plurality of grouped samples.
[0052] It should be noted that the above-mentioned preset first clustering algorithm may be a learning algorithm for constructing a hierarchical structure of data, for example, an agglomerative hierarchical clustering algorithm.
[0053] S206: Cluster the size of the target frame of each grouped sample according to a preset second clustering algorithm to determine a clustering result of each grouped sample.
[0054] It should be noted that the above-mentioned preset second clustering algorithm can be an iterative clustering analysis algorithm, for example, a K-means clustering algorithm. The above-mentioned clustering result can be the category information of the data objects in the data set, which can be displayed through a tree diagram (displaying hierarchical clustering), a scatter plot (displaying cluster separation and overlap) and a heat map (displaying similarity between clusters).
[0055] S208, determining the anchor box hyper parameters of the target data set according to the clustering result of each grouped sample.
[0056] It should be noted that the above anchor box hyperparameters may be a target box set of the target data set.
[0057] The present disclosure uses a first clustering algorithm to group data sets and combines a second clustering algorithm to perform cluster analysis on target frames, so that the clustering results are more balanced in considering various types of samples.
[0058] In one embodiment of the present disclosure, Figure 3 As shown, the anchor frame hyperparameter setting method provided in the embodiment of the present disclosure can determine the grouping samples through the following steps, which can adapt to the characteristics of different data sets to obtain a clustering result that is more in line with the actual situation:
[0059] S302 , according to the agglomerative hierarchical clustering algorithm, the samples of each category in the target data set are grouped according to whether the intra-class distance satisfies the first threshold and the inter-class distance satisfies the second threshold, to determine a plurality of grouped samples.
[0060] For example, the sample size of each category is input into the agglomerative hierarchical clustering algorithm based on minimum distance, and the sample size of each category is grouped according to the principle of making the intra-class distance as small as possible and the inter-class distance as large as possible.
[0061] The present disclosure sets a first threshold for the intra-cluster distance, which can ensure that samples in the same cluster have high similarity in features, which helps to form a compact and consistent cluster, reduce intra-cluster differences and optimize intra-cluster similarity; by setting a second threshold for the inter-cluster distance, it can ensure that samples between different clusters have obvious differences in features, which helps to distinguish different clusters, improve the differentiation of clusters, and enhance inter-cluster differences. The combination of the two improves clustering quality and provides detailed clustering result information.
[0062] In one example of the present disclosure, the size of the target frame of each grouped sample is clustered according to a preset second clustering algorithm, and determining the clustering result of each grouped sample includes: clustering the size of the target frame of each grouped sample according to a k-means clustering algorithm, and determining the clustering result of each grouped sample.
[0063] For example, according to the grouping results, K-means clustering is performed on the target box size of each group of samples.
[0064] In an example of the present disclosure, determining the anchor box hyperparameters of the target data set according to the clustering results of each grouped sample includes: proportionally weighting the clustering results of each grouped sample according to the application scenario, and merging to determine the anchor box hyperparameters of the target data set.
[0065] It should be noted that the above application scenarios are mainly to group and cluster different data sets. Different data sets have different distributions. For example, in the DOTA data set, the number of cars is much larger than other categories, so when obtaining the default target box set of the entire data set, more clustering results for the car category will be considered.
[0066] For example, the clustering results of each group of samples are de-redundant, and then the results of different categories are proportionally weighted according to the actual application scenario, and fused into the final default target box set for the entire data set.
[0067] In one embodiment of the present disclosure, Figure 4 As shown, in the anchor box hyperparameter setting method provided in the embodiment of the present disclosure, the clustering result of each grouped sample is weighted proportionally according to the application scenario, and the anchor box hyperparameters of the target data set are determined by merging and including the following steps:
[0068] S402, removing redundancy from the clustering results of each group of samples and determining the number ratio of each group of samples;
[0069] S404, determining the weight ratio of each group of samples according to the quantity ratio of each group of samples;
[0070] S406: Determine the anchor box hyper parameters of the target data set according to the weight ratios of the samples in each group.
[0071] In a specific example, the DOTA remote sensing image target detection dataset is selected as the experimental dataset. The sample size of each sample in the dataset training set is obtained: airplane 8158, small vehicle 126685, large vehicle 22461, roundabout 443, bridge 2084, football field 342, helicopter 637, track and field 332, baseball field 417, storage tank 5364, tennis court 2434, swimming pool 2225, ship 33316, port 6047, basketball court 530. The sample size of each category is input into the agglomerative hierarchical clustering algorithm based on the minimum distance, and the sample size of each category is grouped according to the principle of minimizing the intra-class spacing and maximizing the inter-class spacing. The grouping results are as follows: Group 1: small vehicles; Group 2: large vehicles, ships; Group 3: airplanes, storage tanks, ports; Group 4: bridges, tennis courts, swimming pools; Group 5: roundabouts, football fields, helicopters, track and field, baseball fields, basketball courts (such as Figure 5 The sample grouping results of the DOTA dataset show that 15 categories correspond to 15 dots, and categories with similar sample sizes are divided into one group (dots in a circle), with a total of five groups). According to the grouping results, K-means clustering is performed on the target box size of each group of samples. The clustering results of each group of samples are removed from redundancy, the quantity ratio is calculated, and then the weight ratio is calculated. All anchor boxes are fused into the final anchor box hyperparameter set of the entire dataset according to the weight. Figure 6 The cluster center comparison diagram shown in the figure is Figure 6 The middle heat map area represents the length and width distribution of the sample frame of the DOTA dataset. Figure 6 The red dots in the middle left figure are the result of directly clustering the distribution of the entire data set. Figure 6 The middle right figure is a comparison of the results of the grouping clustering proposed in the present disclosure.
[0072] In one example of the present disclosure, the above anchor box hyperparameter setting method further includes: evaluating whether the anchor box hyperparameters of the target data set meet preset conditions according to the application scenario. For example, if clustering is used to optimize the target detection model, it can be observed whether the average precision (AP) or other related indicators after clustering are improved.
[0073] The following Table 1 shows the average coverage of each category by clustering results:
[0074] Table 1
[0075]
[0076] The present disclosure is verified on the DOTA dataset with a relatively complex dataset size distribution. From the experimental data, it can be seen that the cluster center distribution range obtained by the grouped K-means clustering of the present disclosure is wider and can more accurately reflect the sample size distribution of the dataset. As can be seen from Table 1, the average coverage of the grouped clustering results for each category of samples is higher than 78%, which is better than the global clustering results except for a few categories and is more balanced.
[0077] In an example of the present disclosure, the above-mentioned anchor box hyperparameter setting method also includes: training the target detection model according to the anchor box hyperparameters of the target data set. It should be noted that the target detection model needs to preset the anchor box hyperparameters during the training phase, and the setting of the anchor box hyperparameters will directly affect the convergence speed of the model training and the detection accuracy of the model. The anchor box hyperparameter setting method disclosed in the present disclosure can speed up the convergence speed of the model training and obtain higher and more balanced detection accuracy.
[0078] The present invention proposes an anchor frame clustering method combining hierarchical clustering and k-means clustering when setting anchor frame hyperparameters, which can complete the following functions: first, obtain the sample size of each category of the target detection data set; input the sample size of each category into the agglomerative hierarchical clustering algorithm based on the minimum distance, and group the sample size of each category according to the principle of making the intra-class spacing as small as possible and the inter-class spacing as large as possible; according to the grouping results, perform K-means clustering on the target frame size of each group of samples accordingly; remove the redundancy of the clustering results of each group of samples, and then proportionally weight the results of different categories according to the actual application scenario, and merge them into the final default target frame set of the entire data set.
[0079] The present invention utilizes a hierarchical clustering algorithm to group data sets according to the sample size of each category in the data set; sets anchor frame parameters are set by combining data set grouping with K-means clustering, and weight values are obtained according to the ratio of the number of categories, thereby weighted fusion of results of different categories is performed to obtain anchor frame parameters that are more widely distributed and take all categories into consideration.
[0080] The present invention fully considers the sample quantity and size differences between various samples in the data set. First, the various samples are clustered and grouped according to the sample quantity, and then the target box size of each group of samples is clustered and analyzed. Then, the results of different categories are proportionally weighted according to the actual application scenario, so that the clustering results are more balanced for various samples and more in line with the overall distribution of the sample size of the data set. It can accelerate the convergence speed of model training and obtain higher and more balanced detection accuracy.
[0081] Based on the same inventive concept, the present disclosure also provides an anchor frame hyperparameter setting device, as described in the following embodiments. Since the principle of solving the problem in the device embodiment is similar to that in the above method embodiment, the implementation of the device embodiment can refer to the implementation of the above method embodiment, and the repeated parts will not be repeated.
[0082] Figure 7 A schematic diagram of a device for setting hyperparameters of an anchor frame in an embodiment of the present disclosure is shown. Figure 7 As shown, the device includes: a target data set acquisition module 71, a sample grouping module 72, a sample clustering module 73, and an anchor frame hyperparameter determination module 74.
[0083] Wherein, the target data set acquisition module 71 is used to acquire a target data set, wherein the target data set includes samples of multiple categories;
[0084] A sample grouping module 72, configured to group samples of each category in the target data set according to a preset first clustering algorithm to determine a plurality of grouped samples;
[0085] A sample clustering module 73, used to cluster the size of the target frame of each grouped sample according to a preset second clustering algorithm, and determine the clustering result of each grouped sample;
[0086] The anchor box hyperparameter determination module 74 is used to determine the anchor box hyperparameters of the target data set according to the clustering result of each grouped sample.
[0087] In an example of the present disclosure, the sample grouping module is further used to: group samples of each category in the target data set according to the agglomerative hierarchical clustering algorithm, based on the intra-class distance satisfying the first threshold and the inter-class distance satisfying the second threshold, to determine multiple grouped samples.
[0088] In an example of the present disclosure, the sample clustering module is further used to: cluster the size of the target box of each grouped sample according to the k-means clustering algorithm to determine the clustering result of each grouped sample.
[0089] In an example of the present disclosure, the anchor box hyperparameter determination module is further used to: weight the clustering results of each grouped sample proportionally according to the application scenario, and combine them to determine the anchor box hyperparameters of the target data set.
[0090] In one example of the present disclosure, the above-mentioned anchor frame hyperparameter determination module is also used to: determine the number ratio of each group of samples after removing redundancy from the clustering results of each group of samples; determine the weight ratio of each group of samples based on the number ratio of each group of samples; determine the anchor frame hyperparameters of the target data set based on the weight ratio of each group of samples.
[0091] In one example of the present disclosure, the above-mentioned anchor box hyperparameter setting device also includes an evaluation module, which is used to evaluate whether the anchor box hyperparameters of the target data set meet preset conditions according to the application scenario.
[0092] In one example of the present disclosure, the above-mentioned anchor box hyperparameter setting device also includes a training module, which is used to train the target detection model according to the anchor box hyperparameters of the target data set.
[0093] It should be noted that the target data set acquisition module 71, sample grouping module 72, sample clustering module 73, and anchor frame hyperparameter determination module 74 correspond to S202 to S208 in the method embodiment, and the examples and application scenarios implemented by the above modules and corresponding steps are the same, but are not limited to the contents disclosed in the above method embodiment. It should be noted that the above modules, as part of the device, can be executed in a computer system such as a set of computer executable instructions.
[0094] Those skilled in the art will appreciate that various aspects of the present disclosure may be implemented as systems, methods or program products. Therefore, various aspects of the present disclosure may be specifically implemented in the following forms, namely: complete hardware implementation, complete software implementation (including firmware, microcode, etc.), or a combination of hardware and software, which may be collectively referred to herein as "circuits", "modules" or "systems".
[0095] Refer to the following Figure 8 The electronic device 800 according to this embodiment of the present disclosure is described. Figure 8 The electronic device 800 shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0096] like Figure 8 As shown, the electronic device 800 is in the form of a general computing device. The components of the electronic device 800 may include but are not limited to: at least one processing unit 810, at least one storage unit 820, and a bus 830 connecting different system components (including the storage unit 820 and the processing unit 810).
[0097] The storage unit stores program codes, which can be executed by the processing unit 810, so that the processing unit 810 executes the steps described in the above “exemplary method” section of this specification according to various exemplary embodiments of the present disclosure.
[0098] For example, the processing unit 810 can execute the following steps of the above method embodiment: obtaining a target data set, wherein the target data set includes samples of multiple categories; grouping the samples of each category in the target data set according to a preset first clustering algorithm to determine multiple grouped samples; clustering the size of the target box of each grouped sample according to a preset second clustering algorithm to determine the clustering result of each grouped sample; and determining the anchor box hyperparameters of the target data set based on the clustering result of each grouped sample.
[0099] For example, the processing unit 810 can execute the following steps of the above method embodiment: according to the agglomerative hierarchical clustering algorithm, the samples of each category in the target data set are grouped according to the intra-class distance satisfying the first threshold and the inter-class distance satisfying the second threshold, and a plurality of grouped samples are determined.
[0100] For example, the processing unit 810 may execute the following steps of the above method embodiment: clustering the size of the target box of each grouped sample according to the k-means clustering algorithm, and determining the clustering result of each grouped sample.
[0101] For example, the processing unit 810 may execute the following steps of the above method embodiment: weighting the clustering results of each grouped sample proportionally according to the application scenario, and merging to determine the anchor box hyperparameters of the target data set.
[0102] For example, the processing unit 810 can execute the following steps of the above-mentioned method embodiment: determine the number ratio of each group of samples after removing redundancy from the clustering results of each group of samples; determine the weight ratio of each group of samples based on the number ratio of each group of samples; determine the anchor box hyperparameters of the target data set based on the weight ratio of each group of samples.
[0103] For example, the processing unit 810 may perform the following steps of the above method embodiment: according to the application scenario, evaluating whether the anchor box hyperparameters of the target data set meet preset conditions.
[0104] For example, the processing unit 810 may perform the following steps of the above method embodiment: training the target detection model according to the anchor box hyperparameters of the target data set.
[0105] The storage unit 820 may include a readable medium in the form of a volatile storage unit, such as a random access memory unit (RAM) 8201 and / or a cache memory unit 8202 , and may further include a read-only memory unit (ROM) 8203 .
[0106] The storage unit 820 may also include a program / utility 8204 having a set (at least one) of program modules 8205, such program modules 8205 including but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment.
[0107] Bus 830 may represent one or more of several types of bus structures, including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus architectures.
[0108] The electronic device 800 may also communicate with one or more external devices 840 (e.g., keyboards, pointing devices, Bluetooth devices, etc.), may also communicate with one or more devices that enable a user to interact with the electronic device 800, and / or communicate with any device that enables the electronic device 800 to communicate with one or more other computing devices (e.g., routers, modems, etc.). Such communication may be performed via an input / output (I / O) interface 850. Furthermore, the electronic device 800 may also communicate with one or more networks (e.g., local area networks (LANs), wide area networks (WANs), and / or public networks, such as the Internet) via a network adapter 860. As shown, the network adapter 860 communicates with other modules of the electronic device 800 via a bus 830. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the electronic device 800, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, etc.
[0109] Through the description of the above implementation, it is easy for those skilled in the art to understand that the example implementation described here can be implemented by software, or by software combined with necessary hardware. Therefore, the technical solution according to the implementation of the present disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, including several instructions to enable a computing device (which can be a personal computer, a server, a terminal device, or a network device, etc.) to execute the method according to the implementation of the present disclosure.
[0110] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart may be implemented as a computer program product, which includes: a computer program, which implements the above-mentioned anchor box hyperparameter setting method when executed by a processor.
[0111] In an exemplary embodiment of the present disclosure, a computer-readable storage medium is further provided, which may be a readable signal medium or a readable storage medium. Fig. 9 A schematic diagram of a computer-readable storage medium in an embodiment of the present disclosure is shown. Fig. 9 As shown, a program product capable of implementing the above method of the present disclosure is stored on the computer-readable storage medium 900. In some possible implementations, various aspects of the present disclosure may also be implemented in the form of a program product, which includes a program code. When the program product is run on a terminal device, the program code is used to enable the terminal device to execute the steps according to various exemplary implementations of the present disclosure described in the above “Exemplary Method” section of this specification.
[0112] In one embodiment, the program product in the embodiment of the present disclosure implements the following method steps when executed by a processor: obtaining a target data set, wherein the target data set includes samples of multiple categories; grouping samples of each category in the target data set according to a preset first clustering algorithm to determine multiple grouped samples; clustering the size of the target box of each grouped sample according to a preset second clustering algorithm to determine the clustering result of each grouped sample; and determining the anchor box hyperparameters of the target data set according to the clustering result of each grouped sample.
[0113] In one embodiment, the program product in the embodiment of the present disclosure implements the following method when executed by a processor: according to an agglomerative hierarchical clustering algorithm, samples of each category in the target data set are grouped according to the intra-class distance satisfying a first threshold and the inter-class distance satisfying a second threshold, to determine multiple grouped samples.
[0114] In one embodiment, when the program product in the embodiment of the present disclosure is executed by a processor, the method implements the following steps: clustering the size of the target box of each grouped sample according to the k-means clustering algorithm, and determining the clustering result of each grouped sample.
[0115] In one embodiment, the program product in the embodiment of the present disclosure implements the following steps when executed by a processor: weighting the clustering results of each grouped sample proportionally according to the application scenario, and combining to determine the anchor box hyperparameters of the target data set.
[0116] In one embodiment, the program product in the embodiment of the present disclosure implements the following steps when executed by a processor: determine the number ratio of samples in each group after removing redundancy from the clustering results of each group of samples; determine the weight ratio of samples in each group based on the number ratio of samples in each group; determine the anchor box hyperparameters of the target data set based on the weight ratio of samples in each group.
[0117] In one embodiment, when the program product in the embodiment of the present disclosure is executed by a processor, a method is implemented to implement the following steps: according to the application scenario, evaluating whether the anchor box hyperparameters of the target data set meet preset conditions.
[0118] In one embodiment, when the program product in the embodiment of the present disclosure is executed by a processor, the method implements the following steps: training a target detection model according to the anchor box hyperparameters of the target data set.
[0119] More specific examples of computer-readable storage media in the present disclosure may include, but are not limited to, an electrical connection having one or more conductors, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0120] In the present disclosure, a computer readable storage medium may include a data signal propagated in baseband or as part of a carrier wave, wherein a readable program code is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. A readable signal medium may also be any readable medium other than a readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.
[0121] Alternatively, the program code contained on the computer-readable storage medium may be transmitted using any appropriate medium, including but not limited to wireless, wired, optical cable, RF, etc., or any suitable combination of the foregoing.
[0122] In a specific implementation, the program code for performing the operations of the present disclosure may be written in any combination of one or more programming languages, including object-oriented programming languages such as Java, C++, etc., and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as a separate software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server. In the case of a remote computing device, the remote computing device may be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computing device (e.g., using an Internet service provider to connect through the Internet).
[0123] It should be noted that, although several modules or units of the device for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to the embodiments of the present disclosure, the features and functions of two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided into multiple modules or units to be embodied.
[0124] In addition, although the steps of the method in the present disclosure are described in a specific order in the drawings, this does not require or imply that the steps must be performed in this specific order, or that all the steps shown must be performed to achieve the desired results. Additionally or alternatively, some steps may be omitted, multiple steps may be combined into one step, and / or one step may be decomposed into multiple steps, etc.
[0125] Through the description of the above implementation, it is easy for those skilled in the art to understand that the example implementation described here can be implemented by software, or by software combined with necessary hardware. Therefore, the technical solution according to the implementation of the present disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, including several instructions to enable a computing device (which can be a personal computer, a server, a mobile terminal, or a network device, etc.) to execute the method according to the implementation of the present disclosure.
[0126] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. The present disclosure is intended to cover any variations, uses or adaptations of the present disclosure, which follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The description and examples are intended to be exemplary only, and the true scope and spirit of the present disclosure are indicated by the appended claims.
Claims
1. A method for setting anchor frame hyperparameters, characterized in that: include: Acquire a target data set, wherein the target data set includes samples of multiple categories; Grouping samples of each category in the target data set according to a preset first clustering algorithm to determine a plurality of grouped samples; Clustering the size of the target frame of each grouped sample according to a preset second clustering algorithm to determine a clustering result of each grouped sample; According to the clustering result of each grouped sample, the anchor box hyperparameters of the target data set are determined.
2. The method for setting anchor frame hyperparameters according to claim 1, characterized in that: The step of grouping samples of each category in the target data set according to a preset first clustering algorithm to determine a plurality of grouped samples comprises: According to the agglomerative hierarchical clustering algorithm, samples of each category in the target data set are grouped according to the intra-class distance satisfying the first threshold and the inter-class distance satisfying the second threshold, to determine a plurality of grouped samples.
3. The method for setting anchor frame hyperparameters according to claim 1, characterized in that: Clustering the size of the target frame of each grouped sample according to the preset second clustering algorithm to determine the clustering result of each grouped sample includes: The size of the target box of each grouped sample is clustered according to the k-means clustering algorithm to determine the clustering result of each grouped sample.
4. The method for setting anchor frame hyperparameters according to claim 1, characterized in that: Determining the anchor box hyper parameters of the target data set according to the clustering result of each grouped sample includes: The clustering results of each grouped sample are weighted proportionally according to the application scenario, and combined to determine the anchor box hyperparameters of the target data set.
5. The method for setting anchor frame hyperparameters according to claim 4, characterized in that: The clustering result of each grouped sample is weighted proportionally according to the application scenario, and the anchor box hyper parameters of the target data set are determined by merging the weighted clustering results. Determine the number ratio of each group of samples after removing redundancy from the clustering results of each group of samples; Determine the weight ratio of each group of samples according to the quantity ratio of each group of samples; The anchor box hyperparameters of the target data set are determined according to the weight ratios of the samples in each group.
6. The method for setting anchor frame hyperparameters according to claim 4, characterized in that: The method further comprises: According to the application scenario, it is evaluated whether the anchor box hyperparameters of the target data set meet preset conditions.
7. The method for setting anchor frame hyperparameters according to any one of claims 1 to 6, characterized in that: The method further comprises: The target detection model is trained according to the anchor box hyperparameters of the target dataset.
8. A device for setting hyperparameters of an anchor frame, characterized in that: include: A target data set acquisition module, used to acquire a target data set, wherein the target data set includes samples of multiple categories; A sample grouping module, used to group samples of each category in the target data set according to a preset first clustering algorithm to determine a plurality of grouped samples; A sample clustering module, used to cluster the size of the target frame of each grouped sample according to a preset second clustering algorithm, and determine the clustering result of each grouped sample; The anchor box hyperparameter determination module is used to determine the anchor box hyperparameters of the target data set according to the clustering results of each grouped sample.
9. An electronic device, characterized in that: include: processor; as well as A memory, configured to store executable instructions of the processor; The processor is configured to execute the anchor frame hyperparameter setting method according to any one of claims 1 to 7 by executing the executable instructions.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method for setting anchor frame hyperparameters according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Model training method and device, target detection method and device, equipment and storage medium
CN113569968A
Training sample set generation method and device, equipment and storage medium
CN116523017A
Multi-classification prediction model training method, performance assessment score prediction method and device
CN116595362A
Method and system for detecting multiple types of hidden defects in tunnel lining
CN118115431A
Industrial scene part instance segmentation method based on improved Euclidean clustering
CN118212410A
