A classification model training method, object classification method and related device
By improving the softmax classifier and loss value training method, the problem of inaccurate identification of rare samples in imbalanced data learning is solved, thereby improving the recognition accuracy and safety of autonomous driving models.
Patent Information
- Application Number
- CN202111369647.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-16
- Publication Date
- 2026-01-02
- Estimated Expiration
- 2041-11-16
AI Technical Summary
Existing imbalanced data learning models cannot effectively improve the accuracy of identifying rare samples in autonomous driving, resulting in insufficient precision in perception tasks.
By constructing an improved softmax classifier, the predicted class information is determined by the number of samples and the feature output exponent. The model is trained by loss values to enhance the gradient contribution of rare samples and suppress the gradient influence of common samples, thereby achieving balanced training of the model.
This improved the accuracy of the classification model in identifying rare samples, thereby enhancing the precision and safety of environmental perception for autonomous driving.
Smart Images

Figure CN114118242B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of machine learning, in particular to a classification model training method, an object classification method and related equipment. BACKGROUND
[0002] At present, deep learning has become a research hotspot in the field of artificial intelligence, and is widely used in the field of automatic driving, especially in visual perception. The introduction of vision on vehicles can enable vehicles to detect targets, classify targets, and segment images, thereby effectively improving the safety, stability and intelligence of vehicles. Automatic driving requires the perception of a large number of objects, which has a natural data imbalance problem, and it is impossible to collect enough sample data for each object, such as special-shaped vehicles and traffic lights. In automatic driving, due to the importance of safety during vehicle driving, rare sample data can still pose a great safety hazard to vehicles, so it is of great significance to study the unbalanced data learning method.
[0003] The core of the unbalanced data learning algorithm is to eliminate the influence of common samples on the model, so that the model can better learn rare data samples. However, traditional unbalanced data learning only balances from the feature learning of the data set, and cannot effectively solve the gradient contribution problem in the training process, and cannot well meet the accuracy requirements of the perception objects in the perception task. Therefore, it is urgent to improve the recognition accuracy of the existing unbalanced data learning model for rare samples. SUMMARY
[0004] The embodiments of the present application provide a classification model training method, an object classification method and related equipment, which can improve the recognition accuracy of the classification model and improve the safety of its application in the field of vehicles.
[0005] In one aspect, the embodiments of the present application provide a classification model training method, comprising:
[0006] obtaining a training sample set; the training sample set comprises a plurality of sample sub-sets, and the plurality of sample sub-sets correspond to a plurality of different types of class labels;
[0007] constructing a preset machine learning model;
[0008] based on the preset machine learning model, performing class prediction on each training sample in the training sample set to obtain prediction class information of each training sample; the prediction class information is determined based on the number of samples in each sample sub-set in the plurality of sample sub-sets and the feature output index of the training sample;
[0009] determining a loss value based on the prediction class information of each training sample and the class label of each training sample;
[0010] The preset machine learning model is trained according to the loss value until a preset training end condition is met, and a classification model is obtained.
[0011] Optionally, the prediction class information of each training sample includes a prediction probability value corresponding to each class; and the loss value is determined based on the prediction class information of each training sample and the class label of each training sample, including:
[0012] The loss function is obtained.
[0013] For each training sample: determining a class corresponding to a maximum prediction probability value in the prediction probability values corresponding to each class as a quasi-target class, and determining the maximum prediction probability value as a quasi-target probability value;
[0014] A non-quasi-target probability value corresponding to the quasi-target probability value is determined; and a sum of the non-quasi-target probability value and the quasi-target probability value is a first preset value.
[0015] According to the loss function, a loss value between the non-quasi-target probability value and a real value corresponding to the class label of each training sample is determined.
[0016] Optionally, a sample quantity of any one of the plurality of sample subsets is greater than or equal to a second preset value; and the second preset value is determined according to a sample quantity of a sample subset in the plurality of sample subsets, the sample quantity of the sample subset being greater than or equal to a first threshold value.
[0017] Optionally, the training sample set is obtained, including:
[0018] An initial training sample set that is unbalanced is obtained; and the initial training sample set includes a plurality of initial sample subsets.
[0019] When a ratio of sample quantities between any two initial sample subsets in the plurality of initial sample subsets does not satisfy a preset value, a sample generation operation is performed on an initial sample subset in the any two initial sample subsets, the sample quantity of the initial sample subset being less than a second threshold value.
[0020] When the ratio of the sample quantities between the any two initial sample subsets satisfies the preset value, the training sample set is obtained.
[0021] Optionally, the sample generation operation includes at least one of rotation, translation, mirroring, noise addition, and color transformation on the training sample in the initial sample subset.
[0022] Optionally, the preset machine learning model is trained according to the loss value until a preset training end condition is met, and a classification model is obtained, including:
[0023] Derivate the loss value to perform gradient descent, update the model parameters of the preset machine learning model until the preset training end condition is met, take the current model parameters as the best model parameters, and obtain the classification model.
[0024] Optionally, the preset machine learning model includes a softmax classifier, the softmax classifier is constructed based on an improved softmax function, and the improved softmax function is:
[0025]
[0026] wherein, S i represents a predicted probability value corresponding to the i th category; z i represents a feature value corresponding to the i th category; represents an exponential of a feature value corresponding to the i th category; k i represents a number of samples in a sample subset corresponding to the i th category.
[0027] In another aspect, the embodiments of the present application provide an object classification method, comprising:
[0028] Obtaining object information to be classified;
[0029] Using the classification model obtained by the above classification model training method to predict the category of the object information to be classified, and obtaining category information of the object information to be classified.
[0030] In another aspect, the embodiments of the present application provide a classification model training device, comprising:
[0031] An obtaining module, configured to obtain a training sample set; the training sample set includes a plurality of sample subsets, and the plurality of sample subsets correspond to a plurality of different kinds of category labels;
[0032] A constructing module, configured to construct a preset machine learning model;
[0033] A predicting module, configured to predict the category of each training sample in the training sample set based on the preset machine learning model, and obtain prediction category information of each training sample; the prediction category information is determined based on the number of samples in each sample subset in the plurality of sample subsets and the feature output exponent of the training sample;
[0034] A determining module, configured to determine a loss value based on the prediction category information of each training sample and the category label of each training sample;
[0035] A training module, configured to train the preset machine learning model according to the loss value until a preset training end condition is met, and obtain a classification model.
[0036] In an aspect, the embodiments of the present application provide an object classification method, including:
[0037] acquiring object information to be classified;
[0038] predicting a class of the object information to be classified by using the classification model obtained by the classification model training method.
[0039] In another aspect, the embodiments of the present application provide a device, including a processor and a memory, the memory storing at least one instruction or at least one program, the at least one instruction or at least one program being loaded and executed by the processor to implement the classification model training method or the object classification method.
[0040] In another aspect, the embodiments of the present application provide a computer storage medium, the computer storage medium storing at least one instruction or at least one program, the at least one instruction or at least one program being loaded and executed by a processor to implement the classification model training method or the object classification method.
[0041] The classification model training method, the object classification method and the related device provided by the embodiments of the present application have the following beneficial effects:
[0042] The training sample set is obtained, the training sample set includes a plurality of sample sub-sets, the plurality of sample sub-sets correspond to a plurality of different types of class labels, a preset machine learning model is constructed, the class of each training sample in the training sample set is predicted based on the preset machine learning model, and the prediction class information of each training sample is obtained. The prediction class information is determined based on the number of samples in each sample sub-set in the plurality of sample sub-sets and the feature output index of the training sample. The loss value is determined based on the prediction class information of each training sample and the class label of each training sample. The preset machine learning model is trained according to the loss value until the preset training end condition is met, and the classification model is obtained. In this way, the recognition accuracy of the classification model can be improved, and the safety of the application in the field of automobiles can be improved. BRIEF DESCRIPTION OF DRAWINGS
[0043] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed in the embodiment description will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.
[0044] Figure 1 is a flowchart of a classification model training method provided by the embodiments of the present application;
[0045] Figure 2 is a flowchart of a process for obtaining a training sample set provided by an embodiment of the present application;
[0046] Figure 3 is a flowchart of a process for determining a loss value based on predicted class information of each training sample and a class label of each training sample provided by an embodiment of the present application;
[0047] Figure 4 is a flowchart of an object classification method provided by an embodiment of the present application;
[0048] Figure 5 is a structural diagram of a classification model training apparatus provided by an embodiment of the present application;
[0049] Figure 6 is a structural diagram of an object classification apparatus provided by an embodiment of the present application;
[0050] Figure 7 is a hardware structural block diagram of a server for a classification model training method or object classification provided by an embodiment of the present application. DETAILED DESCRIPTION
[0051] The technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only some of the embodiments of the present application, but not all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative work fall within the scope of protection of the present application.
[0052] It should be noted that the terms "first", "second", and the like in the specification and claims of the present application and the above-described drawings are used to distinguish similar objects, and do not necessarily indicate a specific order or a chronological sequence. It should be understood that the data thus used can be interchanged under appropriate circumstances, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion, for example, a process, method, system, product, or server including a series of steps or units does not necessarily have to include only those steps or units clearly listed, but can include other steps or units not clearly listed or inherent to the process, method, product, or device.
[0053] In the related art, due to the imbalance of the training data set, the model precision obtained after training based on the imbalanced data set is not high, and the class of the rare sample in the data set cannot be accurately identified, so as to meet the precision requirement of the perception object in the perception task. Based on this, the embodiment of the present application provides a classification model training method, an object classification method and related equipment, which can improve the identification accuracy of the model for rare samples.
[0054] The following introduces a specific embodiment of a classification model training method of the present application, Figure 1 is a flowchart of a classification model training method provided by an embodiment of the present application, and the present specification provides method operation steps such as embodiments or flowcharts, but more or fewer operation steps can be included based on conventional or non-creative labor. The order of steps listed in the embodiment is only one of the many execution orders, and does not represent the only execution order. In actual system or server product execution, the method order shown in the embodiment or the drawing can be executed in sequence or in parallel (for example, in a parallel processor or multi-threaded processing environment). Specifically, as Figure 1 indicated, the method can include:
[0055] In step S101, a training sample set is obtained; the training sample set includes a plurality of sample sub-sets, and the plurality of sample sub-sets correspond to a plurality of different categories of class labels.
[0056] In the embodiment of the present application, the training sample set is obtained, which is used for subsequent training of the classification model. The classification model is a machine learning model. In the development process of the machine learning model, as many training samples as possible are collected for the training set, a prediction model is established using the training set, the best model is obtained through hyperparameter optimization, and finally the trained model is applied to new and unseen data.
[0057] In the embodiment of the present application, the training sample set includes a plurality of sample sub-sets, each sample sub-set in the plurality of sample sub-sets includes a certain number of training samples, each training sample carries a corresponding class label, the class label can be pre-labeled by artificial, and the class label represents the category of the training sample. The plurality of sample sub-sets are obtained by dividing the training sample set according to the class label carried by each training sample, that is, the class label of each training sample in a single sample sub-set is the same.
[0058] The classification model trained based on the training sample set needs to be able to identify the perception data collected by the perception device; and in different application scenarios, the types of perception devices are various, such as cameras, radars, etc.; thus, in order to adapt to different application scenarios, the data types of the training samples in the training sample set are determined according to actual needs, including but not limited to image data types and point cloud data types.
[0059] In one possible embodiment, the training sample set is a training image set; the training image set includes a plurality of training image sub-sets; the plurality of training image sub-sets correspond to a plurality of category labels, the category labels representing the category information of the target object in the training image, and all training images in a single training image sub-set contain the same target object. The classification model trained based on the training image set can be used for identifying the target object of the image data collected by the camera.
[0060] In actual applications, such as in the field of autonomous driving, the perception objects are very diverse, and it is impossible to collect enough sample data for each object, which can easily lead to the emergence of an unbalanced data set, i.e., the number difference between two categories of the data set reaches 100:1, 1000:1 or even 10000:1, for example, the sample of a cleaning car is very rare compared to a small car, the number of data samples collected for the cleaning car is n, and the number of samples for the small car can be 100n. According to the number difference between different categories, we can divide the samples into common samples and rare samples, such as the small car belongs to the common sample and the cleaning car belongs to the rare sample. For the unbalanced data set, using the traditional classification model training formula can cause serious imbalance of the model precision, and the classification accuracy for rare samples is very low.
[0061] In order to reduce the influence of the unbalanced data set on the model precision, in one possible embodiment, the above-mentioned obtaining a training sample set can specifically include the following steps as shown in the figure: Figure 2
[0062] In step S201, an unbalanced initial training sample set is obtained; the initial training sample set includes a plurality of initial sample sub-sets.
[0063] In this step, the initial training sample set includes a plurality of initial sample sub-sets, and the plurality of initial sample sub-sets correspond to a plurality of different category labels. The present application monitors the ratio of the number of samples between any two initial sample sub-sets in the plurality of initial sample sub-sets to ensure the balance between different types of training samples.
[0064] In step S203, when the ratio of the number of samples between any two of the plurality of initial sample subsets does not satisfy the preset value, a sample generation operation is performed on the initial sample subset with the smaller number of samples between the two initial sample subsets.
[0065] In this step, if the ratio of the number of samples between any two of the plurality of initial sample subsets does not satisfy the preset value, it indicates that the difference in the number of samples between the two initial sample subsets is large. The preset value is not satisfied means that the ratio of the larger number of samples to the smaller number of samples in any two initial sample subsets is greater than or equal to a certain preset value, or the ratio of the smaller number of samples to the larger number of samples in any two initial sample subsets is less than or equal to a certain preset value. The preset value is set according to actual needs.
[0066] When the difference in the number of samples between the two initial sample subsets is large, a sample generation operation is performed on the initial sample subset with the smaller number of samples between the two initial sample subsets. The second threshold is determined according to the larger number of samples between the two initial sample subsets, and its value can be equal to the value of the larger number of samples. By performing a sample generation operation on the initial sample subset with the smaller number of samples, the number of samples is increased to improve the problem of uneven sample quantity.
[0067] In one specific embodiment, when the ratio of the smaller number of samples to the larger number of samples between any two of the plurality of initial sample subsets is less than or equal to 0.25, a sample generation operation is performed on the initial sample subset corresponding to the smaller number of samples. The sample generation operation includes at least one of rotation, translation, mirroring, adding noise, and color transformation of the training samples in the initial sample subset.
[0068] In step S205, when the ratio of the number of samples between any two of the plurality of initial sample subsets satisfies the preset value, a training sample set is obtained.
[0069] In one specific embodiment, by performing a sample generation operation on the initial sample subset corresponding to the smaller number of samples, the number of samples is increased so that the ratio of the smaller number of samples to the larger number of samples reaches the preset value, thereby improving the problem of uneven sample quantity and obtaining a balanced training sample set.
[0070] Correspondingly, the training sample set is a balanced data set. Therefore, the number of samples in any one of the plurality of sample subsets is greater than or equal to a second preset value; the second preset value is determined according to the number of samples in the sample subset with the number of samples greater than or equal to the first threshold value among the plurality of sample subsets.
[0071] In a specific embodiment, the first threshold value can be determined according to the number of samples in the sample subset with the largest number of samples among the plurality of sample subsets, and the value of the first threshold value can be equal to the value of the largest number of samples. That is, the sample subset with the largest number of samples among the plurality of sample subsets is the sample subset with a number of samples greater than or equal to the first threshold value. The second preset value can be a preset multiple of the number of samples in the sample subset with the largest number of samples, and the preset multiple can refer to the preset value in the above embodiments, that is, the preset multiple can be 0.25.
[0072] In step S103, a preset machine learning model is constructed.
[0073] In step S105, based on the preset machine learning model, a class prediction is performed on each training sample in the training sample set to obtain prediction class information of each training sample. The prediction class information is determined based on the number of samples in each sample subset among the plurality of sample subsets and the feature output index of the training sample.
[0074] In step S107, a loss value is determined based on the prediction class information of each training sample and the class label of each training sample.
[0075] In step S109, the preset machine learning model is trained according to the loss value until a preset training end condition is met to obtain a classification model.
[0076] In the embodiments of the present application, a preset machine learning model is constructed, and then a class prediction is performed on each training sample in the training sample set using the preset machine learning model to obtain prediction class information of each training sample. The structure of the preset machine learning model generally includes an input layer, a hidden layer and an output layer, and the output of the output layer is the prediction class information of each training sample. The hidden layer is used to extract relevant features of each training sample to obtain corresponding feature information. The characteristic information is classified by a classifier in the output layer to obtain corresponding prediction class information.
[0077] In the related art, the classification model normalizes the prediction result by a softmax classifier. That is, the result after the exponential function conversion is divided by the sum of all converted results, which can be understood as the percentage of the converted result in the total, to obtain the probability corresponding to the prediction result. However, due to the extremely unbalanced distribution of collected samples, the result obtained based on the traditional softmax classifier will be more biased towards common samples, so the gradient contribution of common samples in the training learning is much larger than that of rare samples, which ultimately leads to low classification accuracy of the model for rare samples.
[0078] In order to improve the classification accuracy of the model for rare samples, in a possible embodiment, the preset machine learning model of the present application comprises a softmax classifier, which is constructed based on an improved softmax function as formula (1) below:
[0079]
[0080] wherein S i represents the predicted probability value corresponding to the i-th category; z i represents the feature value corresponding to the i-th category; represents the feature value exponent corresponding to the i-th category; k i represents the number of samples in the sample subset corresponding to the i-th category.
[0081] In a possible embodiment, the predicted category information of each training sample comprises the predicted probability value corresponding to each category; and the determination of the loss value based on the predicted category information of each training sample and the category label of each training sample can comprise the following steps as shown in formula (2): Figure 3
[0082] In step S301, the loss function is obtained.
[0083] In step S303, for each training sample: the category corresponding to the maximum predicted probability value in the predicted probability value corresponding to each category is determined as the quasi-target category, and the maximum predicted probability value is determined as the quasi-target probability value.
[0084] wherein the predicted probability value corresponding to each category is calculated according to the above formula (1).
[0085] In step S305, the non-quasi-target probability value corresponding to the quasi-target probability value is determined; and the sum of the non-quasi-target probability value and the quasi-target probability value is a first preset value.
[0086] wherein the first preset value is 1. That is, the non-quasi-target probability value is 1 minus the quasi-target probability value.
[0087] In step S307, according to the loss function, the loss value between the non-quasi-target probability value and the true value corresponding to the category label of each training sample is determined.
[0088] Specifically, the loss value is defined as the cross-entropy solution to the softmax value, that is, the loss function can be a cross-entropy loss function. The greater the quasi-target probability value, the smaller the loss value corresponding to the sample; the quasi-target probability value calculated by the above formula (1) is actually smaller, so using the non-quasi-target probability value to calculate the loss value can obtain a smaller loss value, so that the data of the rare sample can still contribute a larger gradient, effectively inhibiting the influence gradient of the multiple quantity samples on the model convergence, and the problem that the rare sample is difficult to learn can be solved.
[0089] In one possible embodiment, the training of the preset machine learning model according to the loss value until the preset training end condition is met to obtain the classification model can include the following steps:
[0090] Derivation of the loss value for gradient descent, updating of the model parameters of the preset machine learning model until the preset training end condition is met, taking the current model parameters as the best model parameters, and obtaining the classification model.
[0091] The preset training end condition includes but is not limited to a preset number of iterations and a preset acceptable loss value. When the preset number of iterations is reached or the current loss value reaches the acceptable loss value, it indicates that the model training is completed, and the current model parameters can be used for actual classification tasks.
[0092] In the embodiments of the present application, the classification model trained by the training method of the above embodiments can be used for identifying and classifying unknown objects.
[0093] Correspondingly, as shown in Figure 4 The embodiments of the present application provide an object classification method, which comprises:
[0094] In step S401, the object information to be classified is obtained.
[0095] In step S403, the classification model trained by the classification model training method is used to predict the class of the object information to be classified, and the class information of the object information to be classified is obtained.
[0096] In the embodiments of the present application, a set of experimental data is provided. When predicting an unbalanced traffic light data set by using the classification model provided in the embodiments of the present application, the prediction accuracy is improved obviously. The proportion of the traffic light data set is: red light: yellow light: green light = 20:5:3. Compared with the prediction accuracy (the number of correctly predicted samples / the total number of samples) of the traditional model, the prediction accuracy is improved from 0.48 to 0.6; the average recall rate ((the recall rate of red light + the recall rate of green light + the recall rate of yellow light) / 3) is improved from 0.21 to 0.45. The recall rate represents the number of predicted samples of a certain color light / the number of samples of the color light in fact. As can be seen from the above experimental data, the classification effect of the classification model provided in the embodiments of the present application is improved significantly.
[0097] The embodiment of the present application also provides a classification model training device, Figure 5 is a structural schematic diagram of a classification model training device provided by the embodiment of the present application, as shown in the figure, the device comprises: Figure 5
[0098] The acquisition module 501 is configured to acquire a training sample set; the training sample set comprises a plurality of sample subsets, and the plurality of sample subsets correspond to a plurality of different kinds of category labels;
[0099] The construction module 502 is configured to construct a preset machine learning model;
[0100] The prediction module 503 is configured to perform category prediction on each training sample in the training sample set based on the preset machine learning model, and obtain prediction category information of each training sample; the prediction category information is determined based on the number of samples in each sample subset in the plurality of sample subsets and the feature output index of the training sample;
[0101] The determination module 504 is configured to determine a loss value based on the prediction category information of each training sample and the category label of each training sample;
[0102] The training module 505 is configured to train the preset machine learning model according to the loss value until a preset training end condition is met, and obtain a classification model.
[0103] In one possible embodiment, the training module 505 is further configured to acquire a loss function; for each training sample: determining a category corresponding to a maximum prediction probability value in the prediction probability values of each category as a quasi-target category, and determining the maximum prediction probability value as a quasi-target probability value; determining a non-quasi-target probability value corresponding to the quasi-target probability value; the sum of the non-quasi-target probability value and the quasi-target probability value is a first preset value; determining, according to the loss function, a loss value between the non-quasi-target probability value and a real value corresponding to the category label of each training sample.
[0104] In one possible embodiment, the number of samples in any one sample subset in the plurality of sample subsets is greater than or equal to a second preset value; the second preset value is determined according to the number of samples in the sample subset whose number of samples is greater than or equal to a first threshold value in the plurality of sample subsets.
[0105] In one possible embodiment, the acquisition module 501 is further configured to:
[0106] Acquire an initial training sample set that is unbalanced; the initial training sample set comprises a plurality of initial sample subsets;
[0107] When the ratio of the number of samples between any two of the plurality of initial sample subsets does not satisfy the preset value, performing a sample generation operation on an initial sample subset with a number of samples less than a second threshold value among any two of the plurality of initial sample subsets;
[0108] When the ratio of the number of samples between any two of the plurality of initial sample subsets satisfies the preset value, obtaining the training sample set.
[0109] In one possible implementation, the sample generation operation includes at least one of rotation, translation, mirroring, adding noise, and color transformation on the training samples in the initial sample subset.
[0110] In one possible implementation, the training module 505 is further configured to derive the loss value to perform gradient descent, update model parameters of the preset machine learning model until a preset training end condition is satisfied, take the current model parameters as optimal model parameters, and obtain the classification model.
[0111] In one possible implementation, the preset machine learning model includes a softmax classifier, and the softmax classifier is constructed based on an improved softmax function, where the improved softmax function is as follows:
[0112]
[0113] wherein S i represents a predicted probability value corresponding to the i th category; z i represents a feature value corresponding to the i th category; represents an exponential of the feature value corresponding to the i th category; k i represents a number of samples in the sample subset corresponding to the i th category.
[0114] The embodiments of the present application also provide an object classification device, Figure 6 is a structural schematic diagram of an object classification device provided by the embodiments of the present application, as Figure 6 shown, the device includes:
[0115] The acquisition module 601 is configured to acquire object information to be classified.
[0116] The prediction module 602 is configured to perform category prediction on the object information to be classified by using the classification model obtained by the classification model training method, and obtain category information of the object information to be classified.
[0117] The device and method embodiments in the embodiments of the present application are based on the same application concept.
[0118] The method embodiments provided by the embodiments of the present application can be executed in a computer terminal, a server, or a similar computing device. Taking the case of running on a server as an example,Figure 7 This is a hardware structure block diagram of a classification model training method or object classification server provided in an embodiment of this application. For example... Figure 7 As shown, the server 700 can vary significantly due to different configurations or performance. It may include one or more Central Processing Units (CPUs) 710 (CPUs 710 may include, but are not limited to, microprocessors NCUs or programmable logic devices FPGAs), a memory 730 for storing data, and one or more storage media 720 (e.g., one or more mass storage devices) for storing application programs 723 or data 722. The memory 730 and storage media 720 may be temporary or persistent storage. The program stored in the storage media 720 may include one or more modules, each module may include a series of instruction operations on the server. Furthermore, the CPU 710 may be configured to communicate with the storage media 720 and execute the series of instruction operations stored in the storage media 720 on the server 700. Server 700 may also include one or more power supplies 760, one or more wired or wireless network interfaces 750, one or more input / output interfaces 740, and / or one or more operating systems 721, such as Windows, Mac OS, Unix, Linux, FreeBSD, etc.
[0119] The input / output interface 740 can be used to receive or send data via a network. Specific examples of the network described above may include a wireless network provided by the communication provider of server 700. In one example, the input / output interface 740 includes a network interface controller (NIC), which can connect to other network devices via a base station to communicate with the Internet. In another example, the input / output interface 740 may be a radio frequency (RF) module for wireless communication with the Internet.
[0120] Those skilled in the art will understand that Figure 7 The structure shown is for illustrative purposes only and does not limit the structure of the aforementioned electronic device. For example, server 700 may also include... Figure 7 The more or fewer components shown, or having the same Figure 7 The different configurations shown.
[0121] The embodiment of the present application also provides a storage medium which can be arranged in a server to save at least one instruction, at least one program, a code set or an instruction set related to the classification model training method or the object classification method in the method embodiment, and the at least one instruction, the at least one program, the code set or the instruction set are loaded and executed by the processor to realize the classification model training method or the object classification method.
[0122] Optionally, in the embodiment, the storage medium can be located in at least one network server of a plurality of network servers of a computer network. Optionally, in the embodiment, the storage medium can include but is not limited to a U disk, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk and various media capable of storing program codes.
[0123] As can be seen from the above embodiment of the classification model training method, the object classification method and the related equipment provided by the present application, in the present application, a training sample set is obtained; the training sample set includes a plurality of sample sub-sets, and the plurality of sample sub-sets correspond to a plurality of different kinds of category labels; a preset machine learning model is constructed; based on the preset machine learning model, the category of each training sample in the training sample set is predicted to obtain the predicted category information of each training sample; the predicted category information is determined based on the number of samples in each sample sub-set in the plurality of sample sub-sets and the feature output index of the training sample; the loss value is determined based on the predicted category information of each training sample and the category label of each training sample; the preset machine learning model is trained according to the loss value until a preset training end condition is met, and a classification model is obtained. In this way, the recognition accuracy of the classification model can be improved, and the safety of the application of the classification model in the automobile field can be improved.
[0124] It should be noted that the above-mentioned sequence of the embodiments of the present application is only for description, and does not represent the advantages and disadvantages of the embodiments. The above describes specific embodiments of the present application. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be executed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multi-task processing and parallel processing are possible or can be advantageous.
[0125] The various embodiments described in the specification are intended to be exemplary only and the same are not to be taken in a limiting sense. Unless otherwise noted, structures described in this disclosure are not intended to be solely composed of elements as illustrated in the figures and described herein. Rather, unless otherwise specified, structures depicted herein are shown as simplified representations can be comprised of many elements including many elements not specifically shown or described in the figures and / or specification. Furthermore, unless otherwise specified, structures shown in the figures can be implemented with other structures not expressly shown or described. It is to be further understood that the description of various embodiments of the present application is for illustrative purposes and, as such, is not intended to be limiting of the present application. For example, to the extent that any narrative, configuration, drawing, claim term etc. is disclosed herein that is in some way based on prior publications, that is by way of background. Constructions claimed herein are not limited to the prior art constructions that can be described in the background or other portions of this disclosure. As such, to the extent that there is a discrepancy between what is described in the prior art and what is described herein, the description herein shall prevail. In addition, to the extent that individual constituent elements of the various embodiments have already been described in the background, and then described in the various embodiments e.g., the same numbering, then to the extent that there is any discrepancy between what is described in the background and what is described in the various embodiments, it is herein by way of incorporation and description of what is new in the various embodiments.
[0126] It is to be understood that the steps of implementing the above-described embodiments, all or part of which, can be completed by hardware, or by program instructing relevant hardware, and the program can be stored in a computer readable storage medium. The storage medium mentioned above can be a read-only memory, a magnetic disk or an optical disk, etc.
[0127] The above description is merely illustrative of the application, and not in limitation thereof. It is the object of the appended claims to particularly point out the application. Any modifications made to the application that are within the spirit and scope of the application will be included in the scope of the application.
Claims
1. A classification model training method, characterized in that, The method comprises the following steps: obtaining an initial training image set that is unbalanced; the initial training image set comprises sample images of perception objects collected in the field of autonomous driving; when the ratio of the number of samples between any two initial sample sub-sets in the initial training image set does not satisfy a preset value, performing a sample generation operation on the initial sample sub-set with a number of samples less than a threshold value among the any two initial sample sub-sets to make the ratio of the number of samples between the any two initial sample sub-sets satisfy the preset value, and obtaining a training image set; the training image set comprises a plurality of training image sub-sets, and the plurality of training image sub-sets correspond to a plurality of category labels; the category label represents the category information of a target object in a training image, and all training images in a single training image sub-set contain the same target object; constructing a preset machine learning model; based on the preset machine learning model, performing category prediction on each training image in the training image set to obtain prediction category information of each training image; the prediction category information of each training image comprises a prediction probability value corresponding to each category; the prediction category information is determined based on the number of samples in each training image sub-set in the plurality of training image sub-sets and a feature output index of the training image; obtaining a loss function; for each training image: determining a category corresponding to a maximum prediction probability value in the prediction probability value corresponding to each category as a quasi-target category, and determining the maximum prediction probability value as a quasi-target probability value; determining a non-quasi-target probability value corresponding to the quasi-target probability value; the sum of the non-quasi-target probability value and the quasi-target probability value is a first preset value; determining a loss value between the non-quasi-target probability value and a real value corresponding to the category label of each training image according to the loss function; training the preset machine learning model according to the loss value until a preset training end condition is satisfied to obtain a classification model, and the classification model is used for identifying a target object in image data collected by a camera.
2. The method of claim 1, wherein, The number of samples in any one of the plurality of training image sub-sets is greater than or equal to a second preset value; the second preset value is determined according to the number of samples in a training image sub-set with a number of samples greater than or equal to a first threshold value in the plurality of training image sub-sets; the first threshold value is determined according to the number of samples in a training image sub-set with the largest number of samples in the plurality of training image sub-sets; and the second preset value is a preset multiple of the number of samples in the training image sub-set with the largest number of samples.
3. The method of claim 1, wherein, The sample generation operation comprises at least one of rotation, translation, mirroring, adding noise, and color transformation on the training image in the initial sample sub-set.
4. The method of claim 1, wherein, The training of the preset machine learning model according to the loss value until the preset training end condition is satisfied to obtain a classification model comprises: deriving the loss value to perform gradient descent, updating the model parameters of the preset machine learning model until the preset training end condition is satisfied, taking the current model parameters as the best model parameters, and obtaining the classification model.
5. The method according to any of claims 1 to 4, characterized in that The preset machine learning model comprises a softmax classifier, which is constructed based on an improved softmax function, wherein the improved softmax function is: wherein, denotes a predicted probability value corresponding to the th class; denotes a feature value corresponding to the th class; denotes an exponent of a feature value corresponding to the th class; denotes a number of samples in a subset of training images corresponding to the th class.
6. A method of object classification characterized by, Comprising: Obtaining object information to be classified; Using the classification model obtained by the classification model training method of any one of claims 1-5, class information of the object information to be classified is obtained through class prediction. 7.A device for training a classification model, characterized in that, Comprising: An obtaining module is configured to obtain an initial training image set that is unbalanced; The initial training image set comprises sample images of perception objects collected in the field of autonomous driving; when a ratio of the number of samples between any two initial sample sub-sets in the initial training image set does not satisfy a preset value, a sample generation operation is performed on an initial sample sub-set with a number of samples less than a threshold value in the any two initial sample sub-sets, so that the ratio of the number of samples between the any two initial sample sub-sets satisfies the preset value, and a training image set is obtained; the training image set comprises a plurality of training image sub-sets, and the plurality of training image sub-sets correspond to a plurality of class labels; the class label represents category information of a target object in a training image, and all training images in a single training image sub-set contain the same target object; A construction module is configured to construct a preset machine learning model; A prediction module is configured to perform class prediction on each training image in the training image set based on the preset machine learning model, and obtain prediction class information of the each training image; the prediction class information of the each training image comprises a prediction probability value corresponding to each class; the prediction class information is determined based on a number of samples in each training image sub-set in the plurality of training image sub-sets and a feature output index of the training image; A training module is configured to obtain a loss function; for each training image: a class corresponding to a maximum prediction probability value in the prediction probability values corresponding to each class is determined as a quasi-target class, and the maximum prediction probability value is determined as a quasi-target probability value; A non-quasi-target probability value corresponding to the quasi-target probability value is determined; a sum of the non-quasi-target probability value and the quasi-target probability value is a first preset value; a loss value between the non-quasi-target probability value and a real value corresponding to a class label of the each training image is determined according to the loss function; the preset machine learning model is trained according to the loss value until a preset training end condition is satisfied, and a classification model is obtained, which is used for identifying a target object in image data collected by a camera.
8. An object classification apparatus characterized by comprising: Comprising: An obtaining module is configured to obtain object information to be classified; A prediction module is configured to use the classification model obtained by the classification model training method of any one of claims 1-5 to perform class prediction on the object information to be classified, and obtain class information of the object information to be classified.
9. An apparatus, comprising: The device comprises a processor and a memory, the memory storing at least one instruction or at least one program, the at least one instruction or the at least one program being loaded and executed by the processor to implement the classification model training method according to any one of claims 1-5 or the object classification method according to claim 6.
10. A computer storage medium, characterized in that, The storage medium stores at least one instruction or at least one program, the at least one instruction or the at least one program being loaded and executed by the processor to implement the classification model training method according to any one of claims 1-5 or the object classification method according to claim 6.
Citation Information
Patent Citations
A target detection method and system based on an improved darknet neural network
CN109272060A
Sample classification method for online learning and model updating method
CN111353516A