Classification model training method and apparatus, device, medium, and product

By expanding the training region of the classification model with imbalanced feature data in the feature coordinate system, the problem of low classification accuracy caused by class imbalance in the prior art is solved, and higher classification model accuracy is achieved.

CN115905931BActive Publication Date: 2026-11-06YUNDING TECH (BEIJING) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202111148592.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-09-29
Publication Date
2026-11-06
Estimated Expiration
2041-09-29

AI Technical Summary

Technical Problem

The existing technology suffers from the problem of low classification accuracy in trained classification models due to the imbalance of images across different categories.

Method used

By mapping the feature data of each category to the feature coordinate system, the distribution area with the largest number of data is obtained as the baseline distribution area, and other areas are expanded to form a more balanced distribution area for training the classification model.

Benefits of technology

This improves the classification accuracy of the classification model and ensures that the number of training image samples for each category is more balanced, thereby improving the overall performance of the classification model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115905931B_ABST
    Figure CN115905931B_ABST
Patent Text Reader

Abstract

Embodiments of the present application provide a kind of classification model training method, device, equipment, medium and product, the method comprises: using preset classification model to the feature extraction of each category first training image sample, to obtain the first feature data of each category;The first feature data of each category is mapped into feature coordinate system, to obtain the distribution area corresponding to the first feature data of each category;The first feature data of each distribution area is obtained in the most distribution area of distribution area as reference distribution area, and other distribution areas except reference distribution area are determined as to be adjusted distribution area;According to the reference distribution area, the region expansion processing is carried out to the to-be-adjusted distribution area, to obtain the distribution area after expansion;According to reference distribution area and the distribution area after expansion, the preset classification model is trained.The classification model training method of embodiment of the present application improves classification accuracy of classification model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present invention relate to the field of image recognition technology, and in particular to a classification model training method, apparatus, device, medium and product. Background Technology

[0002] With the continuous development of technology, image recognition technology is being applied to an increasing number of technical fields, such as autonomous driving and artificial intelligence, where it plays a significant role. Image recognition technology works by inputting images into an image recognition model to identify the category to which the image belongs. To obtain an image recognition model with high accuracy, it is necessary to pre-train the model, especially the classification model that plays a classification role, multiple times.

[0003] Currently, the main method for training classification models is through training a large number of images with class labels. However, this method cannot achieve a balance between images of different classes in real-world problems, resulting in low classification accuracy of the trained models. Summary of the Invention

[0004] This invention provides a classification model training method, apparatus, device, medium, and product to solve the problem that the classification accuracy of the trained classification model is low because it is impossible to achieve a balance of images of different categories in practical problems.

[0005] The first aspect of this invention provides a classification model training method, comprising:

[0006] The first training image samples of each category are used to extract features using a pre-defined classification model to obtain the first feature data of each category;

[0007] The first feature data of each category is mapped to the feature coordinate system to obtain the distribution area corresponding to the first feature data of each category;

[0008] The distribution region with the most first feature data in each distribution region is selected as the benchmark distribution region, and the other distribution regions besides the benchmark distribution region are identified as the distribution regions to be adjusted.

[0009] The distribution area to be adjusted is expanded based on the baseline distribution area to obtain the expanded distribution area.

[0010] The preset classification model is trained based on the baseline distribution area and the expanded distribution area.

[0011] Optionally, in the method described above, the first feature data of each category has a category identifier;

[0012] The step of mapping the first feature data of each category to a feature coordinate system to obtain the distribution area corresponding to the first feature data of each category includes:

[0013] According to the category identifier of each first feature data, the first feature data with the same category identifier are mapped to the same region of the feature coordinate system to obtain the distribution region corresponding to the first feature data of each category.

[0014] Optionally, in the method described above, the step of expanding the distribution area to be adjusted based on the baseline distribution area to obtain the expanded distribution area includes:

[0015] Determine the category center features in the baseline distribution region and the distribution region to be adjusted; the category center features are feature data located at the center of the distribution region of the corresponding category;

[0016] A preset classification model is used to determine multiple category boundary features of the baseline distribution region based on the category center features and other first feature data besides the category center features;

[0017] Based on the category center features of the baseline distribution region, the category boundary features of each category, and the category center features of the distribution region to be adjusted, multiple category boundary features of the expanded distribution region to be adjusted are determined; wherein, the category boundary features are features located at the boundary of the distribution region of the corresponding category;

[0018] The expanded distribution area is determined based on the boundary features of multiple categories after the expansion of the distribution area to be adjusted.

[0019] Optionally, in the method described above, determining the multiple category boundary features of the expanded distribution region to be adjusted based on the category center features of the baseline distribution region, the category boundary features of each category, and the category center features of the distribution region to be adjusted includes:

[0020] The positional distance in the feature coordinate system between the category center feature of the reference distribution region and the category boundary features of each category in the reference distribution region is determined as the category region offset;

[0021] Based on the position of the category center feature of the distribution region to be adjusted, the positions of multiple category boundary features after the expansion of the distribution region to be adjusted are determined according to the offset of each category region.

[0022] The multiple category boundary features of the expanded distribution region to be adjusted are determined based on their positions.

[0023] Optionally, in the method described above, training the preset classification model based on the baseline distribution region and the expanded distribution region includes:

[0024] A pre-defined classification model is used to extract features from the second training image samples of each category to obtain second feature data for each category; the second feature data has a category identifier.

[0025] For each second feature data, determine the shortest position distance in the feature coordinate system between the current second feature data and each category boundary feature in each distribution region;

[0026] The distribution area of ​​the corresponding category boundary feature with the shortest position distance is determined as the distribution area of ​​the current second feature data;

[0027] The next second feature data is determined as the current second feature data, and the step of determining the shortest position distance in the feature coordinate system between the current second feature data and each category boundary feature in each distribution area is performed;

[0028] Determine whether the category to which the distribution area of ​​each second feature data belongs is the same as the category identifier of the second feature data;

[0029] If it is determined that the category to which the distribution area of ​​each second feature data belongs is different from the category identifier of the second feature data, then the parameters of the classification model are adjusted for training.

[0030] Optionally, in the method described above, before determining the shortest positional distance in the feature coordinate system between the current second feature data and each of the category boundary features in each distribution region for each second feature data, the method further includes:

[0031] Determine the number of second feature data in each category and the maximum number of second feature data in each category;

[0032] For categories where the number of second feature data is less than the maximum number, the following processing is performed:

[0033] The second feature data of the current category is copied so that the number of second feature data is the same as the maximum number.

[0034] The next category is determined as the current category, and the step of copying the second feature data of the current category is performed so that the number of second feature data is the same as the maximum number is performed, until all categories with a number of second feature data less than the maximum number are processed.

[0035] A second aspect of the present invention provides a classification model training apparatus, comprising:

[0036] The feature extraction module is used to extract features from the first training image samples of each category using a preset classification model to obtain the first feature data of each category.

[0037] The feature mapping module is used to map the first feature data of each category to a feature coordinate system to obtain the distribution area corresponding to the first feature data of each category;

[0038] The region determination module is used to obtain the distribution region with the most first feature data in each distribution region as the benchmark distribution region, and to determine the other distribution regions besides the benchmark distribution region as the distribution regions to be adjusted.

[0039] The region expansion module is used to expand the distribution region to be adjusted based on the baseline distribution region to obtain the expanded distribution region.

[0040] The training module is used to train the preset classification model based on the baseline distribution region and the expanded distribution region.

[0041] Optionally, in the apparatus described above, the first feature data of each category has a category identifier;

[0042] The feature mapping module is specifically used for:

[0043] According to the category identifier of each first feature data, the first feature data with the same category identifier are mapped to the same region of the feature coordinate system to obtain the distribution region corresponding to the first feature data of each category.

[0044] Optionally, in the apparatus described above, the region enlargement module is specifically used for:

[0045] The following steps are taken: First, determine the category center features in the baseline distribution region and the distribution region to be adjusted. The category center features are feature data located at the center of the distribution region corresponding to the category. Second, use a preset classification model to determine multiple category boundary features of the baseline distribution region based on the category center features and other first feature data besides the category center features. Third, determine multiple category boundary features of the expanded distribution region based on the category center features of the baseline distribution region, the category boundary features, and the category center features of the distribution region to be adjusted. The category boundary features are features located at the boundaries of the distribution regions corresponding to the categories. Fourth, determine the expanded distribution region based on the multiple category boundary features of the expanded distribution region to be adjusted.

[0046] Optionally, in the apparatus described above, when the region expansion module determines the multiple category boundary features of the expanded distribution region based on the category center features of the baseline distribution region, the category boundary features of each category, and the category center features of the distribution region to be adjusted, it is specifically used for:

[0047] The positional distance between the category center feature of the reference distribution region and each category boundary feature of the reference distribution region in the feature coordinate system is determined as the category region offset; taking the position of the category center feature of the distribution region to be adjusted as the reference, the positions of multiple category boundary features of the expanded distribution region to be adjusted are determined according to each category region offset; the multiple category boundary features of the expanded distribution region to be adjusted are determined according to the positions of the multiple category boundary features of the expanded distribution region to be adjusted.

[0048] Optionally, in the apparatus described above, the training module is specifically used for:

[0049] A preset classification model is used to extract features from the second training image samples of each category to obtain second feature data for each category; the second feature data has a category identifier; for each second feature data, the shortest position distance in the feature coordinate system between the current second feature data and each category boundary feature in each distribution area is determined; the distribution area to which the category boundary feature corresponding to the shortest position distance belongs is determined as the distribution area of ​​the current second feature data; the next second feature data is determined as the current second feature data, and the step of determining the shortest position distance in the feature coordinate system between the current second feature data and each category boundary feature in each distribution area is executed; it is determined whether the category to which the distribution area of ​​each second feature data belongs is the same as the category identifier of the second feature data; if it is determined that the category to which the distribution area of ​​each second feature data belongs is different from the category identifier of the second feature data, the parameters of the classification model are adjusted for training.

[0050] Optionally, in the apparatus described above, the training module is further configured to:

[0051] Determine the number of second feature data in each category and the maximum number of second feature data in each category; for each category where the number of second feature data is less than the maximum number, perform the following processing: copy the second feature data of the current category so that the number of second feature data is the same as the maximum number; determine the next category as the current category and perform the step of copying the second feature data of the current category so that the number of second feature data is the same as the maximum number, until all categories where the number of second feature data is less than the maximum number have been processed.

[0052] A third aspect of the present invention provides an electronic device, comprising: a processor, and a memory communicatively connected to the processor;

[0053] The memory stores computer-executed instructions;

[0054] The processor executes computer execution instructions stored in the memory to implement the classification model training method as described in any of the first aspects.

[0055] A fourth aspect of the present invention provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, are used to implement the classification model training method described in any of the first aspects.

[0056] A fifth aspect of the present invention provides a computer program product, including a computer program that, when executed by a processor, implements the classification model training method described in any of the first aspects.

[0057] This invention provides a classification model training method, apparatus, device, medium, and product. The method includes: extracting features from first training image samples of each category using a preset classification model to obtain first feature data for each category; mapping the first feature data of each category to a feature coordinate system to obtain a distribution region corresponding to the first feature data of each category; obtaining the distribution region with the most first feature data in each distribution region as a reference distribution region, and determining other distribution regions besides the reference distribution region as distribution regions to be adjusted; performing region expansion processing on the distribution regions to be adjusted based on the reference distribution region to obtain an expanded distribution region; and training the preset classification model based on the reference distribution region and the expanded distribution region. The classification model training method of this invention maps the first feature data of each category to a feature coordinate system to obtain the distribution region corresponding to the first feature data of each category, and then uses the distribution region with the most first feature data in each distribution region as the reference distribution region to perform region expansion processing on the distribution regions to be adjusted. This makes the expanded distribution region more closely resemble the situation when the number of training image samples for each category is equal compared to the original distribution region, providing a better classification architecture foundation for subsequent classification training and thus improving the classification accuracy of the classification model. Attached Figure Description

[0058] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.

[0059] Figure 1 This is a schematic diagram of the long-tail distribution of training samples in an embodiment of the present invention;

[0060] Figure 2 This is a scene diagram illustrating the classification model training method implemented in this embodiment of the invention.

[0061] Figure 3 This is a flowchart illustrating the classification model training method provided in the first embodiment of the present invention.

[0062] Figure 4 This is a flowchart illustrating the classification model training method provided in the second embodiment of the present invention.

[0063] Figure 5 A schematic diagram of image category regions for the classification model training method provided in the second embodiment of the present invention;

[0064] Figure 6 This is a schematic diagram of the structure of the classification model training device provided in the third embodiment of the present invention;

[0065] Figure 7 This is a schematic diagram of the structure of an electronic device provided in the fourth embodiment of the present invention.

[0066] The accompanying drawings have illustrated specific embodiments of the invention, which will be described in more detail below. These drawings and descriptions are not intended to limit the scope of the invention in any way, but rather to illustrate the concept of the invention to those skilled in the art through reference to particular embodiments. Detailed Implementation

[0067] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numerals in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present invention. Rather, they are merely examples of apparatuses and methods consistent with some aspects of the invention as detailed in the appended claims.

[0068] The technical solution of the present invention will be described in detail below with reference to specific embodiments. These specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments. The embodiments of the present invention will now be described with reference to the accompanying drawings.

[0069] To clearly understand the technical solution of this application, we will first provide a detailed introduction to the solutions of existing technologies. Image recognition technology has been continuously developing and progressing over time. In image recognition training tasks, given an image, the image recognition model will identify the types of objects in the image. For example, if an image contains objects such as cats and televisions, it will identify the categories of cats and televisions. To complete image recognition, existing machine learning methods train a large number of labeled images to obtain a usable model. Among these, the classification model, which plays a role in classification, is a key focus of the training.

[0070] To ensure that the trained classification model has comparable classification performance across all categories, the number of labeled images or images for each category should be consistent. However, in real-world problems, achieving category balance is often impossible; a common scenario is that the available images follow a long-tailed distribution across categories. Figure 1 As shown, some categories are head categories and generate a large number of images, while others are tail categories and generate only a small number of images. If a classification model is trained using general machine learning methods in the case of a long-tailed distribution, it will result in low classification accuracy.

[0071] Therefore, in response to the problem that existing classification models cannot achieve a balance between images of different categories in practical problems, resulting in low classification accuracy, the inventors discovered in their research that, in order to solve this problem, the distribution range of the feature data of each category can be adjusted so that the distribution range of the category with fewer feature data is expanded to be the same as the distribution range of the category with the most feature data, thereby improving the classification accuracy of the classification model.

[0072] Specifically, a pre-defined classification model is used to extract features from the first training image samples of each category to obtain the first feature data for each category. The first feature data for each category is then mapped onto a feature coordinate system to obtain the distribution region corresponding to the first feature data for each category. The distribution region with the most first feature data is selected as the baseline distribution region, and the other distribution regions are identified as the distribution regions to be adjusted. The distribution regions to be adjusted are then expanded based on the baseline distribution region to obtain the expanded distribution region. Finally, the pre-defined classification model is trained based on the baseline distribution region and the expanded distribution region.

[0073] Based on the above-mentioned inventive discovery, the inventor has proposed the technical solution of this application.

[0074] The following describes the application scenarios of the classification model training method provided in the embodiments of the present invention. For example... Figure 2As shown, 1 represents the first electronic device, and 2 represents the second electronic device. The network architecture of the application scenario corresponding to the classification model training method provided in this embodiment includes: a first electronic device 1 and a second electronic device 2. The second electronic device 2 can be a terminal device, a computer, or other electronic device with image storage capabilities. The second electronic device 2 stores first training image samples of each category and sends these samples to the first electronic device 1. During classification model training, the first electronic device 1 uses a preset classification model to extract features from the first training image samples of each category to obtain first feature data for each category. Then, the first feature data of each category is mapped to a feature coordinate system to obtain the distribution area corresponding to the first feature data of each category. Simultaneously, the first electronic device 1 selects the distribution area with the most first feature data in each distribution area as the baseline distribution area and determines the other distribution areas besides the baseline distribution area as distribution areas to be adjusted. The distribution areas to be adjusted are expanded based on the baseline distribution area to obtain the expanded distribution area. Finally, the preset classification model is trained based on the baseline distribution area and the expanded distribution area. Since the expanded distribution area is larger than the original distribution area and more closely resembles the situation when the number of training image samples for each category is equal, it provides a better classification basis for subsequent training and improves the classification accuracy of the classification model.

[0075] In autonomous driving scenarios, the second electronic device can be a camera, and the first electronic device can be an in-vehicle terminal. The camera transmits the captured images to the in-vehicle terminal, which, through a training-to-converge classification model, can classify and identify the captured images, outputting classification results, such as whether there is a vehicle or person in the image. Based on the classification results, corresponding control measures are then taken for the vehicle. This improves the safety of autonomous driving by determining the category of each object in the scene ahead of the vehicle.

[0076] Meanwhile, in AI scenarios, such as navigation robots commonly used in shopping malls, the robot can use its built-in camera as a secondary electronic device to capture images of the scene. If the robot captures a facial image, its built-in controller uses the convergent classification model trained according to this solution to classify and identify the image, thus outputting whether it belongs to the face category or the scene category. After determining that it is a face, the navigation robot can issue a pre-set voice and provide navigation services, or perform other preset operations. There are many applicable scenarios, which will not be listed here.

[0077] The embodiments of the present invention will now be described with reference to the accompanying drawings.

[0078] Figure 3This is a flowchart illustrating the classification model training method provided in the first embodiment of the present invention, as shown below. Figure 3 As shown, in this embodiment, the execution entity of this invention is a classification model training device, which can be integrated into an electronic device. The classification model training method provided in this embodiment includes the following steps:

[0079] Step S101: Use a preset classification model to extract features from the first training image samples of each category to obtain the first feature data of each category.

[0080] In this embodiment, the preset classification model can be a classification neural network model, a classifier, etc. The category refers to the image category, such as cats and dogs among animals, or monitors and vehicles among objects. The first feature data refers to the image features extracted from the first training image samples; each first feature data has a corresponding category identifier.

[0081] Step S102: Map the first feature data of each category to the feature coordinate system to obtain the distribution area corresponding to the first feature data of each category.

[0082] In this embodiment, the feature coordinate system can be pre-constructed. The feature coordinate system is a coordinate system built using feature data as parameter coordinates, and its origin can be set as needed. When mapping the first feature data of each category to the feature coordinate system, each category will correspond to a distribution region. The specific form of the distribution region can be found in [reference needed]. Figure 5 , Figure 5 The diagram uses three categories—head category A, middle category B, and tail category C—to illustrate the concept. Each of the three categories (A, B, and C) has its own corresponding distribution area.

[0083] Step S103: Obtain the distribution region with the most first feature data in each distribution region as the benchmark distribution region, and determine the other distribution regions besides the benchmark distribution region as the distribution regions to be adjusted.

[0084] In this embodiment, the distribution region with the most first feature data in each distribution region can be determined by random sampling. This random sampling method can efficiently determine the distribution region with the most first feature data in each distribution region, thereby improving the overall training efficiency.

[0085] Meanwhile, since the number of first training image samples differs for each category, the number of corresponding first feature data generated will also differ. The distribution region with the largest number of first feature data corresponds to the category with the largest number of first training image samples. In order to make the distribution regions of other categories close to or even the same as the distribution region with the largest number of first feature data, the distribution region with the largest number of first feature data can be used as the baseline distribution region to expand other distribution regions.

[0086] Step S104: Based on the baseline distribution area, perform region expansion processing on the distribution area to be adjusted to obtain the expanded distribution area.

[0087] In this embodiment, using the baseline distribution area as a reference, the expanded range of the distribution area to be adjusted can be kept identical to the baseline distribution area. Specifically, this can be achieved through spatial range transfer, such as transferring the spatial structure of the baseline distribution area to the distribution area to be adjusted, giving it the same spatial structure. Other methods are also possible, and this embodiment does not limit them.

[0088] Step S105: Train the preset classification model based on the baseline distribution area and the expanded distribution area.

[0089] In existing technologies, due to the imbalance in the number of training image samples, the distribution area of ​​each category is also different in size. When the classification model is training, it classifies according to the distance between the feature data of the training image samples and the category center features of each distribution area. Therefore, it is easier to classify the category to which the training image sample belongs to the category with the largest number of training image samples.

[0090] After expanding the distribution region to be adjusted, the spatial areas of the baseline distribution region and the expanded distribution region are similar or even the same. Under this premise, during classification training, the classification model will not tend to classify training image samples into the category with the most training image samples, but will instead classify them into the category to which the training image samples belong. This provides a better classification framework for subsequent classification training, improving the classification accuracy of the model.

[0091] This invention provides a classification model training method, which includes: extracting features from first training image samples of each category using a preset classification model to obtain first feature data for each category; mapping the first feature data of each category to a feature coordinate system to obtain the distribution region corresponding to the first feature data of each category; selecting the distribution region with the most first feature data as the baseline distribution region, and determining the other distribution regions besides the baseline distribution region as the distribution regions to be adjusted; performing region enlargement processing on the distribution regions to be adjusted based on the baseline distribution region to obtain the enlarged distribution region; and training the preset classification model based on the baseline distribution region and the enlarged distribution region.

[0092] The classification model training method of this invention maps the first feature data of each category to a feature coordinate system to obtain the distribution region corresponding to the first feature data of each category. Then, the distribution region with the largest number of first feature data in each distribution region is used as the baseline distribution region, and the distribution region to be adjusted is expanded. This results in a larger distribution region that more closely resembles the situation when the number of training image samples for each category is equal, providing a better classification foundation for subsequent training and improving the classification accuracy of the classification model.

[0093] Figure 4 This is a flowchart illustrating the classification model training method provided in the second embodiment of the present invention, as shown below. Figure 4 As shown, the classification model training method provided in this embodiment is based on the classification model training method provided in the previous embodiment of the present invention, with further refinement of each step. Therefore, the classification model training method provided in this embodiment includes the following steps.

[0094] Step S201: Use a preset classification model to extract features from the first training image samples of each category to obtain the first feature data of each category.

[0095] In this embodiment, the implementation of step 201 is similar to that of step 101 in the previous embodiment of the present invention, and will not be described in detail here.

[0096] It should be noted that the first feature data of each category has a category identifier.

[0097] Step S202: According to the category identifier of each first feature data, the first feature data with the same category identifier are mapped to the same region of the feature coordinate system to obtain the distribution region corresponding to the first feature data of each category.

[0098] In this embodiment, before determining the distribution area of ​​each category, a corresponding category identifier is set in the first feature data of each category, so as to facilitate the subsequent mapping of the first feature data of the same category to the same distribution area of ​​the feature coordinate system.

[0099] Step S203: Obtain the distribution region with the most first feature data in each distribution region as the benchmark distribution region, and determine the other distribution regions besides the benchmark distribution region as the distribution regions to be adjusted.

[0100] In this embodiment, the implementation of step 203 is similar to that of step 103 in the previous embodiment of the present invention, and will not be described in detail here.

[0101] Step S204: Determine the category central features in the baseline distribution area and the distribution area to be adjusted. The category central features are the feature data located at the center of the distribution area corresponding to the category.

[0102] In this embodiment, the category center feature is the feature data that best reflects the characteristics of the category, and it is located at the center of the distribution area of ​​the category. For example... Figure 5 As shown, Figure 5 In both the left and right regions, the origin of the three regions A, B, and C are all category-centric features of the distribution area.

[0103] Meanwhile, the class center features in the baseline distribution region and the distribution region to be adjusted can be directly determined by the classification model. The classification model can determine the corresponding class center features using all feature data from the baseline distribution region and the distribution region to be adjusted.

[0104] Step S205: Using a preset classification model, determine multiple category boundary features of the baseline distribution area based on the category center features and other first feature data besides the category center features.

[0105] In this embodiment, the preset classification model can determine multiple class boundary features of the baseline distribution region based on the class center features and other first feature data besides the class center features. These class boundary features are as follows: Figure 5 The right region shows multiple small dots, and the three distribution regions A, B, and C respectively illustrate the boundary features of the four categories.

[0106] It should be noted that there are multiple category boundary features, and the number is not limited. The actual number can be set according to actual needs. The four category boundary features in the three distribution areas A, B, and C are only used for illustration.

[0107] Step S206: Determine multiple category boundary features of the expanded distribution area to be adjusted based on the category center features of the baseline distribution area, the category boundary features of each category, and the category center features of the distribution area to be adjusted. The category boundary features are the features located at the boundary of the distribution area corresponding to the category.

[0108] In this embodiment, the category boundary feature can reflect the distribution area boundary to a certain extent, and the distribution boundary of the feature data of each category can be determined to a certain extent through the category boundary feature.

[0109] To determine the boundary features of multiple categories after the distribution area to be adjusted has been expanded, spatial structure transfer can be used to transfer the spatial structure of the baseline distribution area to the distribution area to be adjusted. Specifically:

[0110] The positional distance in the feature coordinate system between the category center feature of the baseline distribution region and the category boundary features of each category in the baseline distribution region is defined as the category region offset. This category region offset is as follows: Figure 5 As indicated by the middle arrow.

[0111] Using the position of the category center feature of the distribution region to be adjusted as a reference, the positions of multiple category boundary features after the expansion of the distribution region to be adjusted are determined according to the offset of each category region. By calculating the sum or difference between the position of the category center feature of the distribution region to be adjusted and the offset of each category region, the positions of multiple category boundary features after the expansion of the distribution region to be adjusted can be determined, such as... Figure 5 As shown in the right region.

[0112] at the same time, Figure 5 In the diagram, categories A, B, and C represent the head, middle, and tail categories, respectively. The dashed lines representing categories A, B, and C represent the true spatial structure, which is the distribution area that should be divided when the number of training samples in each category is the same. The solid lines representing categories A, B, and C represent the distribution areas divided by the existing method and the proposed method. As can be seen from the diagram, the distribution areas determined by the existing training method on the left side differ from the true distribution areas, resulting in lower accuracy. Conversely, the distribution areas determined by the existing method on the right side are identical to the true distribution areas, demonstrating higher accuracy.

[0113] After determining the positions of multiple category boundary features after the expansion of the distribution area to be adjusted, the multiple category boundary features after the expansion of the distribution area to be adjusted can be determined based on the positions of the multiple category boundary features after the expansion of the distribution area to be adjusted.

[0114] Step S207: Determine the expanded distribution area based on the boundary features of multiple categories after the expansion of the distribution area to be adjusted.

[0115] In this embodiment, the expanded distribution area can be determined by connecting multiple category boundary features after the distribution area to be adjusted is expanded, based on these features.

[0116] Step S208: Train the preset classification model based on the baseline distribution area and the expanded distribution area.

[0117] In this embodiment, since the areas of the baseline distribution region and the expanded distribution region are equal, spatial structure transfer is achieved. This allows categories with less training data (tail categories) to have a spatial structure of distribution regions comparable to categories with more training data (head categories), reducing the problem of deteriorating classification performance due to insufficient training data. Simultaneously, it also meets the sample balance requirement for classification. During classification training, the classification model does not tend to classify training image samples into the category with the most training image samples, but rather assigns them to the category to which the training image sample belongs.

[0118] Simultaneously, during training, new training image samples can be used, i.e., a second training image sample. Specifically:

[0119] A pre-defined classification model is used to extract features from the second training image samples of each category to obtain second feature data for each category. The second feature data includes category identifiers.

[0120] For each second feature data, determine the shortest positional distance in the feature coordinate system between the current second feature data and the boundary features of each category in each distribution region.

[0121] The distribution area of ​​the feature whose shortest distance to the corresponding category boundary is determined as the distribution area of ​​the current second feature data.

[0122] For example, if there are three distribution regions A, B, and C, and the second feature data is closest to the category boundary feature of distribution region A, then the second feature data is classified into the category to which distribution region A belongs.

[0123] The next second feature data is determined as the current second feature data, and the step of determining the shortest position distance in the feature coordinate system between the current second feature data and the boundary features of each category in each distribution area is performed.

[0124] For all second feature data, determine the distribution area and category to which they belong, and at the same time, determine whether the category to which the distribution area of ​​each second feature data belongs is the same as the category identifier of the second feature data.

[0125] If the distribution area of ​​each second feature data belongs to a different category than the category identifier of the second feature data, it means that an error has occurred in the classification and the parameters of the classification model need to be adjusted to continue training.

[0126] If the category to which the distribution area of ​​each second feature data belongs is the same as the category identifier of the second feature data, then the classification effect is good.

[0127] Meanwhile, in order to ensure better training results, if the number of second training image samples is uneven, the second feature data corresponding to the second training image samples can be rebalanced according to the category so that the number of second feature data in each category distribution area is the same.

[0128] Specifically:

[0129] Determine the number of second feature data in each category and the maximum number of second feature data in each category.

[0130] For categories where the number of second feature data is less than the maximum number, the following processing is performed:

[0131] The second feature data of the current category is copied so that the number of second feature data is the same as the maximum number.

[0132] The next category is determined as the current category, and the second feature data of the current category is copied to make the number of second feature data the same as the maximum number, until all categories with the number of second feature data less than the maximum number have been processed.

[0133] Assuming the number of second feature data points for category d is 100, for category e it is 50, and for category f it is 10, we can perform a duplication process on categories e and f. The second feature data for category e is copied once, while the second feature data for category f is copied nine times. This ensures that the number of second feature data points for each category is the same, guaranteeing consistent frequency of occurrence in the training data for each category. Training the category feature centers of each category in the classification model using this method—the class-balanced sampling method—allows for sufficient training of the category feature centers of each category, avoiding the imbalance problem of training data under a long-tailed distribution, and improving the classification training effect.

[0134] Figure 6 This is a schematic diagram of the structure of the classification model training device provided in the third embodiment of the present invention, as shown below. Figure 6 As shown, in this embodiment, the classification model training device 300 includes:

[0135] The feature extraction module 301 is used to extract features from the first training image samples of each category using a preset classification model to obtain the first feature data of each category.

[0136] The feature mapping module 302 is used to map the first feature data of each category to the feature coordinate system to obtain the distribution area corresponding to the first feature data of each category.

[0137] The region determination module 303 is used to obtain the distribution region with the most first feature data in each distribution region as the benchmark distribution region, and to determine the other distribution regions besides the benchmark distribution region as the distribution regions to be adjusted.

[0138] The region expansion module 304 is used to expand the distribution area to be adjusted based on the baseline distribution area to obtain the expanded distribution area.

[0139] Training module 305 is used to train a preset classification model based on the baseline distribution region and the expanded distribution region.

[0140] The classification model training device provided in this embodiment can execute... Figure 2 The technical solution of the method embodiment shown has the same implementation principle and technical effect as... Figure 2 The methods and embodiments shown are similar and will not be described in detail here.

[0141] Meanwhile, the classification model training device provided by the present invention further refines the classification model training device 300 based on the classification model training device provided in the previous embodiment.

[0142] Optionally, in this embodiment, the first feature data of each category has a category identifier.

[0143] The feature mapping module 302 is specifically used for:

[0144] According to the category identifier of each first feature data, the first feature data with the same category identifier are mapped to the same region of the feature coordinate system to obtain the distribution region corresponding to the first feature data of each category.

[0145] Optionally, in this embodiment, the region expansion module 304 is specifically used for:

[0146] The process involves determining the category center features in the baseline distribution region and the distribution region to be adjusted. Category center features are the feature data located at the center of the distribution region for the corresponding category. Using a pre-defined classification model, multiple category boundary features of the baseline distribution region are determined based on the category center features and other primary feature data besides the category center features. Based on the category center features of the baseline distribution region, the category boundary features, and the category center features of the distribution region to be adjusted, multiple category boundary features of the expanded distribution region to be adjusted are determined. Here, category boundary features are the features located at the boundaries of the distribution regions for the corresponding categories. Finally, the expanded distribution region is determined based on these multiple category boundary features.

[0147] Optionally, in this embodiment, when the region expansion module 304 determines the multiple category boundary features of the expanded distribution region based on the category center features of the baseline distribution region, the category boundary features of each category, and the category center features of the distribution region to be adjusted, it is specifically used for:

[0148] The positional distance between the category center feature and each category boundary feature of the baseline distribution region in the feature coordinate system is determined as the category region offset. Using the position of the category center feature of the distribution region to be adjusted as a reference, the positions of multiple category boundary features after the expansion of the distribution region to be adjusted are determined according to the category region offsets. The multiple category boundary features after the expansion of the distribution region to be adjusted are then determined based on their positions.

[0149] Optionally, in this embodiment, the training module 305 is specifically used for:

[0150] A pre-defined classification model is used to extract features from the second training image samples of each category to obtain second feature data for each category. The second feature data has a category identifier. For each second feature data, the shortest distance in the feature coordinate system between the current second feature data and the category boundary features in each distribution region is determined. The distribution region corresponding to the category boundary feature with the shortest distance is determined as the distribution region of the current second feature data. The next second feature data is determined as the current second feature data, and the step of determining the shortest distance in the feature coordinate system between the current second feature data and the category boundary features in each distribution region is performed. It is determined whether the category of the distribution region of each second feature data is the same as the category identifier of that second feature data. If it is determined that the category of the distribution region of each second feature data is different from the category identifier of that second feature data, the parameters of the classification model are adjusted for training.

[0151] Optionally, in this embodiment, the training module 305 is further configured to:

[0152] Determine the number of second feature data points in each category and the maximum number of second feature data points in each category. For categories where the number of second feature data points is less than the maximum number, proceed as follows: Copy the second feature data of the current category to make the number of second feature data points the same as the maximum number. Then, designate the next category as the current category and repeat the process of copying the second feature data of the current category to make the number of second feature data points the same as the maximum number, until all categories where the number of second feature data points is less than the maximum number have been processed.

[0153] The classification model training device provided in this embodiment can execute... Figures 3-5 The technical solution of the method embodiment shown has the same implementation principle and technical effect as... Figures 3-5 The methods and embodiments shown are similar and will not be described in detail here.

[0154] According to embodiments of the present invention, the present invention also provides an electronic device, a computer-readable storage medium, and a computer program product.

[0155] like Figure 7 As shown, Figure 7 This is a schematic diagram of the structure of an electronic device provided in the fourth embodiment of the present invention. The electronic device is intended for use with various forms of digital computers suitable for training classification models, such as laptop computers, personal digital assistants, and other suitable computers. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the invention described and / or claimed herein.

[0156] like Figure 7 As shown, the electronic device includes a processor 401 and a memory 402. The various components are interconnected via different buses and can be mounted on a common motherboard or installed in other ways as needed. The processor can process instructions executed within the electronic device.

[0157] The memory 402 is the non-transitory computer-readable storage medium provided by the present invention. The memory stores instructions executable by at least one processor to cause the at least one processor to execute the classification model training method provided by the present invention. The non-transitory computer-readable storage medium of the present invention stores computer instructions for causing a computer to execute the classification model training method provided by the present invention.

[0158] Memory 402, as a non-transitory computer-readable storage medium, can be used to store non-transitory software programs, non-transitory computer-executable programs, and modules, such as the program instructions / modules corresponding to the classification model training method in this embodiment of the invention (e.g., appendix). Figure 6The feature extraction module 301, feature mapping module 302, region determination module 303, region expansion module 304, and training module 305 are shown. The processor 401 executes various server functions and data processing by running non-transient software programs, instructions, and modules stored in the memory 402, thereby implementing the classification model training method in the above method embodiments.

[0159] In addition, this embodiment also provides a computer product, which, when the instructions in the computer product are executed by the processor of an electronic device, enables the electronic device to execute the classification model training methods of the above embodiments one and two.

[0160] Other embodiments of the invention will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. The invention is intended to cover any variations, uses, or adaptations of the embodiments thereof that follow the general principles of the embodiments and include common knowledge or customary techniques in the art not disclosed in the embodiments thereof. The specification and embodiments are to be considered exemplary only.

[0161] It should be understood that the embodiments of the present invention are not limited to the precise structures described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from their scope. The scope of the embodiments of the present invention is limited only by the appended claims.

Claims

1. A classification model training method, characterized in that, include: The first training image samples of each category are used to extract features using a pre-defined classification model to obtain the first feature data of each category; The first feature data of each category is mapped to the feature coordinate system to obtain the distribution area corresponding to the first feature data of each category; The distribution region with the most first feature data in each distribution region is selected as the benchmark distribution region, and the other distribution regions besides the benchmark distribution region are identified as the distribution regions to be adjusted. The distribution region to be adjusted is expanded according to the baseline distribution region to obtain an expanded distribution region. The areas of the baseline distribution region and the expanded distribution region are equal, so that the categories with less training data and the categories with more training data have a similar spatial structure of distribution regions, in order to meet the sample balance required for classification. The process of expanding the distribution area to be adjusted based on the baseline distribution area to obtain the expanded distribution area includes: Determine the category center features in the baseline distribution region and the distribution region to be adjusted; the category center features are feature data located at the center of the distribution region of the corresponding category; A preset classification model is used to determine multiple category boundary features of the baseline distribution region based on the category center features and other first feature data besides the category center features; Determining multiple category boundary features of the expanded distribution area to be adjusted based on the category center features of the baseline distribution area, the category boundary features of each category, and the category center features of the distribution area to be adjusted includes: determining the positional distance between the category center features of the baseline distribution area and the category boundary features of each category in the feature coordinate system as a category region offset; using the position of the category center features of the distribution area to be adjusted as a reference, determining the position of the multiple category boundary features of the expanded distribution area to be adjusted according to each category region offset; and determining the multiple category boundary features of the expanded distribution area to be adjusted based on the position of the multiple category boundary features of the expanded distribution area to be adjusted; wherein, the category boundary features are features located at the distribution area boundary of the corresponding category; The expanded distribution area is determined based on the multiple category boundary features after the expansion of the distribution area to be adjusted. The preset classification model is trained based on the baseline distribution area and the expanded distribution area.

2. The method according to claim 1, characterized in that, The first feature data of each category has a category identifier; The step of mapping the first feature data of each category to a feature coordinate system to obtain the distribution area corresponding to the first feature data of each category includes: According to the category identifier of each first feature data, the first feature data with the same category identifier are mapped to the same region of the feature coordinate system to obtain the distribution region corresponding to the first feature data of each category.

3. The method according to claim 1, characterized in that, The step of training the preset classification model based on the baseline distribution region and the expanded distribution region includes: A pre-defined classification model is used to extract features from the second training image samples of each category to obtain second feature data for each category; the second feature data has a category identifier. For each second feature data, determine the shortest position distance in the feature coordinate system between the current second feature data and each category boundary feature in each distribution region; The distribution area of ​​the corresponding category boundary feature with the shortest position distance is determined as the distribution area of ​​the current second feature data; The next second feature data is determined as the current second feature data, and the step of determining the shortest position distance in the feature coordinate system between the current second feature data and each category boundary feature in each distribution area is performed; Determine whether the category to which the distribution area of ​​each second feature data belongs is the same as the category identifier of the second feature data; If it is determined that the category to which the distribution area of ​​each second feature data belongs is different from the category identifier of the second feature data, then the parameters of the classification model are adjusted for training.

4. The method according to claim 3, characterized in that, Before determining the shortest positional distance in the feature coordinate system between the current second feature data and each category boundary feature in each distribution region for each second feature data, the method further includes: Determine the number of second feature data in each category and the maximum number of second feature data in each category; For categories where the number of second feature data is less than the maximum number, the following processing is performed: The second feature data of the current category is copied so that the number of second feature data is the same as the maximum number. The next category is determined as the current category, and the step of copying the second feature data of the current category is performed so that the number of second feature data is the same as the maximum number is performed, until all categories with a number of second feature data less than the maximum number are processed.

5. A classification model training device, characterized in that, include: The feature extraction module is used to extract features from the first training image samples of each category using a preset classification model to obtain the first feature data of each category. The feature mapping module is used to map the first feature data of each category to a feature coordinate system to obtain the distribution area corresponding to the first feature data of each category; The region determination module is used to obtain the distribution region with the most first feature data in each distribution region as the benchmark distribution region, and to determine the other distribution regions besides the benchmark distribution region as the distribution regions to be adjusted. The benchmark distribution region and the expanded distribution region have the same area, so that the category with less training data and the category with more training data have a similar spatial structure of distribution regions, so as to meet the sample balance required for classification. A region expansion module is used to expand the distribution region to be adjusted based on the baseline distribution region to obtain an expanded distribution region. The expansion process includes: determining category center features in the baseline distribution region and the distribution region to be adjusted; the category center features are feature data located at the center of the distribution region corresponding to the category; determining multiple category boundary features of the baseline distribution region based on the category center features and other first feature data besides the category center features using a preset classification model; and determining multiple category boundary features of the baseline distribution region based on the category center features, the category boundary features, and the category center features of the distribution region to be adjusted. The method for determining multiple category boundary features after expanding the distribution region to be adjusted includes: determining the positional distance in the feature coordinate system between the category center feature of the reference distribution region and each category boundary feature of the reference distribution region as a category region offset; using the position of the category center feature of the distribution region to be adjusted as a reference, determining the position of multiple category boundary features after expanding the distribution region to be adjusted according to each category region offset; determining the multiple category boundary features after expanding the distribution region to be adjusted according to the position of the multiple category boundary features after expanding the distribution region to be adjusted; wherein, the category boundary features are features located at the distribution region boundary of the corresponding category; and determining the expanded distribution region according to the multiple category boundary features after expanding the distribution region to be adjusted. The training module is used to train the preset classification model based on the baseline distribution region and the expanded distribution region.

6. An electronic device, characterized in that, include: A processor, and a memory communicatively connected to the processor; The memory stores computer-executed instructions; The processor executes computer execution instructions stored in the memory to implement the classification model training method as described in any one of claims 1 to 4.

7. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, are used to implement the classification model training method as described in any one of claims 1 to 4.

8. A computer program product, comprising a computer program, characterized in that, When executed by a processor, the computer program implements the classification model training method according to any one of claims 1 to 4.