A loss function optimization method and device, computer equipment and storage medium
Patent Information
- Application Number
- CN202310538324.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-05-11
- Publication Date
- 2026-10-30
- Estimated Expiration
- 2043-05-11
AI Technical Summary
但是在车款图像分类问题之中,不同车款的图像之间的差异较小,例如同一品牌下的燃油车外观与新能源车外观区别仅存在于车头视角之中,使得卷积网络分类模型输出的标签和概率分布图无法使损失函数获得最优解,从而无法获得准确的分类结果
[0032]本申请实施例提供的一种损失函数优化方法,通过将卷积网络分类模型输出的多个标签概率列表按图像的真实标签进行拼接,得到同一车款的图像对应的标签概率矩阵,对标签概率矩阵进行标签平滑操作避免了卷积网络分类模型过拟合、泛化能力差的情况,采用主成分分析法对待筛选矩阵进行降维,实现了对待筛选矩阵中信息量较大的数据的筛选,加强了待叠加矩阵中数据的价值和联系,将经过以上操作的数据作为损失函数的输入,实现了对损失函数的优化,提升了损失函数的召回率和收敛速度,使得优化后的损失函数输出的分类结果更加准确。
Smart Images

Figure CN116524275B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of image classification technology, and in particular to a loss function optimization method, apparatus, computer device, and storage medium. Background Technology
[0002] In vehicle image classification tasks, a convolutional neural network (CNN) model is typically used first to classify the images, obtaining multiple classification labels and their corresponding probabilities for each image sample. Then, a loss function is used to predict the classification result based on the labels and probability distribution. The Distribution Focal Loss (DFL) function is a formula for calculating the difference between the model's predicted value and the actual value. The optimal loss function indicates the smallest difference between the predicted and actual values, resulting in the most accurate classification. To ensure 100% accuracy in every classification, the highest probability value for the true label should be 1, and the sum of the probabilities for all other labels should be 0. This minimizes the area formed by the DFL loss function on the left and right sides of the true label's probability curve, resulting in the most accurate classification. However, in the problem of vehicle image classification, the differences between images of different vehicle models are small. For example, the difference between the appearance of a gasoline car and a new energy vehicle of the same brand exists only in the front view. This makes it impossible for the label and probability distribution map output by the convolutional network classification model to obtain the optimal solution of the loss function, thus failing to obtain accurate classification results.
[0003] Therefore, existing technologies suffer from the problem that the small differences between the vehicle image samples to be classified prevent the loss function from obtaining the optimal solution, resulting in inaccurate classification results. Summary of the Invention
[0004] This application provides a loss function optimization method, apparatus, computer device, and storage medium, which can optimize the loss function, improve the recall and convergence speed of the loss function, and make the classification results output by the optimized loss function more accurate.
[0005] In a first aspect, embodiments of this application provide a loss function optimization method, the method comprising:
[0006] Step S1: Input the training image set into the convolutional network classification model to obtain a list of label probabilities for each image in the training image set. Each image in the training image set includes the true label.
[0007] Step S2: Concatenate the list of label probabilities corresponding to multiple images with the same real label to obtain n label probability matrices. Perform label smoothing operation on the n label probability matrices to obtain n matrices to be filtered.
[0008] Step S3: Principal component analysis is used to reduce the dimensionality of the matrix to be screened, so as to obtain the matrix to be superimposed.
[0009] Step S4: Add the probability values of the same column in the matrix to be superimposed to obtain the list to be constrained; normalize the list to be constrained to obtain the normalized list; calculate the probability variance of the normalized list and obtain the predicted probability value corresponding to the true label in the normalized list.
[0010] Step S5: Perform steps S3 and S4 sequentially on the n matrices to be screened to obtain n probability variance values and n predicted probability values; obtain the optimized loss function based on the n probability variance values, n predicted probability values and the true labels corresponding to each predicted probability value.
[0011] Furthermore, the above-mentioned label smoothing operation on the n label probability matrices to obtain n matrices to be filtered includes: adding a preset smoothing value to the probability values in the n label probability matrices to obtain n matrices to be filtered.
[0012] Furthermore, the preset smoothing value is 0.1.
[0013] Furthermore, the above-mentioned list of constraints is normalized to obtain a normalized list, including:
[0014] The normalized exponential function is used to normalize the list of constraints so that all probability values in the list are greater than or equal to 0 and less than or equal to 1, thus obtaining the normalized list.
[0015] Furthermore, the optimized loss function, derived from the above based on n probability variance values, n predicted probability values, and the true labels corresponding to each predicted probability value, includes:
[0016] The average variance is obtained from the n probability variance values;
[0017] The Dirac loss function is obtained based on n predicted probability values and the true labels corresponding to each predicted probability value.
[0018] The focus loss function is derived based on the average variance and n predicted probability values;
[0019] The optimized loss function is obtained based on the Dirac loss function and the focus loss function.
[0020] Secondly, embodiments of this application provide a loss function optimization apparatus, the apparatus comprising:
[0021] The initial classification module is used to input the training image set into the convolutional network classification model to obtain a list of label probabilities for each image in the training image set, which includes the true labels for each image.
[0022] The stitching module is used to stitch together the list of label probabilities corresponding to multiple images with the same real labels to obtain n label probability matrices. Then, a label smoothing operation is performed on the n label probability matrices to obtain n matrices to be filtered.
[0023] The dimension reduction module is used to reduce the dimension of the matrix to be screened by principal component analysis to obtain the matrix to be superimposed.
[0024] The variance calculation module is used to add the probability values of the same column in the matrix to be superimposed to obtain the list of constraints; to normalize the list of constraints to obtain the normalized list; to calculate the probability variance value of the normalized list and obtain the predicted probability value corresponding to the true label in the normalized list.
[0025] The optimization module is used to sequentially execute the dimensionality reduction module and the variance calculation module on the n matrices to be screened, respectively, to obtain n probability variance values and n predicted probability values; based on the n probability variance values, n predicted probability values and the true labels corresponding to each predicted probability value, the optimized loss function is obtained.
[0026] Furthermore, the splicing module includes a smoothing unit; the smoothing unit is used to add a preset smoothing value to the probability values in the n label probability matrices to obtain n matrices to be filtered.
[0027] Furthermore, the variance calculation module includes a normalization unit;
[0028] The normalization unit is used to normalize the list of constraints using a normalization exponential function, so that all probability values in the list of constraints are greater than or equal to 0 and less than or equal to 1, thus obtaining a normalized list.
[0029] Thirdly, embodiments of this application provide a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it performs the steps of the loss function optimization method as described in any of the above embodiments.
[0030] Fourthly, embodiments of this application provide a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the steps of the loss function optimization method as described in any of the above embodiments.
[0031] In summary, compared with the prior art, the beneficial effects of the technical solution provided in this application include at least the following:
[0032] This application provides a loss function optimization method that concatenates multiple label probability lists output by a convolutional network classification model according to the true labels of the images to obtain a label probability matrix corresponding to images of the same car model. Label smoothing is performed on the label probability matrix to avoid overfitting and poor generalization ability of the convolutional network classification model. Principal component analysis is used to reduce the dimensionality of the matrix to be selected, enabling the selection of data with high information content in the matrix and strengthening the value and connections of the data in the matrix to be superimposed. The data processed in the above way is used as input to the loss function, thereby optimizing the loss function, improving its recall and convergence speed, and making the classification results output by the optimized loss function more accurate. Attached Figure Description
[0033] Figure 1 A flowchart of a loss function optimization method provided as an exemplary embodiment of this application.
[0034] Figure 2 A flowchart illustrating the steps for obtaining the optimization loss function, provided as an exemplary embodiment of this application.
[0035] Figure 3 This is a structural diagram of a loss function optimization apparatus provided as an exemplary embodiment of this application. Detailed Implementation
[0036] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0037] Please see Figure 1 This application provides a loss function optimization method, which is applied to an image classification device. Taking the image classification device as the execution subject as an example, the method specifically includes the following steps:
[0038] Step S1: Input the training image set into the convolutional network classification model to obtain a list of label probabilities for each image in the training image set. Each image in the training image set includes the true label.
[0039] Specifically, the training image set input into the convolutional network classification model includes multiple images and a true label for each image, where the true label refers to the actual vehicle type information in the image.
[0040] Step S2: Concatenate the list of label probabilities corresponding to multiple images with the same real label to obtain n label probability matrices. Perform label smoothing operation on the n label probability matrices to obtain n matrices to be filtered.
[0041] In the specific implementation process, assuming there are 32 images in the training image set, of which 4 images contain car model A, 16 images contain car model B, and 12 images contain car model C, then n is 3, and a total of 3 label probability matrices are generated.
[0042] If a convolutional network classification model can predict 1000 car models, then the label probability list for each image is a 1×1000 matrix. The size of the label probability matrix corresponding to the true label A is 4×1000, the size of the label probability matrix corresponding to the true label B is 16×1000, and the size of the label probability matrix corresponding to the true label C is 12×1000.
[0043] Step S3: Principal component analysis is used to reduce the dimensionality of the matrix to be screened, so as to obtain the matrix to be superimposed.
[0044] Principal Component Analysis (PCA) aims to reduce the feature dimensionality while minimizing information loss. Specifically, for a sample matrix, it offers two main approaches: first, changing the features by finding a new set of features to represent it; and second, reducing the number of features, ensuring the number of new features is significantly smaller than the original number.
[0045] In this application, the number of columns in the matrix to be superimposed is much smaller than the number of columns in the matrix to be screened. For example, the matrix to be screened corresponding to the label probability matrix of the real label A has a size of 4×1000, but the size of the matrix to be superimposed obtained by principal component analysis may be 4×20 or 4×8, etc. It can be seen that the value and correlation of the data in the matrix to be superimposed are higher than those in the matrix to be screened.
[0046] Step S4: Add the probability values of the same column in the matrix to be superimposed to obtain the list to be constrained; normalize the list to be constrained to obtain the normalized list; calculate the probability variance of the normalized list and obtain the predicted probability value corresponding to the true label in the normalized list.
[0047] Specifically, assuming the matrix to be superimposed for the true label A is 4×8, after adding the probability values in the same column, the list of constraints for the true label A becomes 1×8, which is the sum of the four probability values in each column. The predicted probability value is the probability value corresponding to label A among the eight labels in the normalized list.
[0048] Step S5: Perform steps S3 and S4 sequentially on the n matrices to be screened to obtain n probability variance values and n predicted probability values; obtain the optimized loss function based on the n probability variance values, n predicted probability values and the true labels corresponding to each predicted probability value.
[0049] The optimized loss function obtained above, based on n probability variance values, n predicted probability values, and the true labels corresponding to each predicted probability value, is superior to the loss function that uses the data processed in this application as input, compared to the loss function that directly uses the output of the convolutional network classification model as input for prediction. Therefore, it can be used as the optimized loss function.
[0050] The loss function optimization method provided in the above embodiment concatenates multiple label probability lists output by the convolutional network classification model according to the true labels of the images to obtain a label probability matrix corresponding to the images of the same car model. Label smoothing is performed on the label probability matrix to avoid overfitting and poor generalization ability of the convolutional network classification model. Principal component analysis is used to reduce the dimensionality of the matrix to be selected, enabling the selection of data with high information content in the matrix and strengthening the value and connections of the data in the matrix to be superimposed. The data processed in the above way is used as input to the loss function to optimize the loss function, improving its recall and convergence speed, resulting in more accurate classification results output by the optimized loss function.
[0051] In some embodiments, the above-mentioned label smoothing operation on n label probability matrices to obtain n matrices to be filtered includes: adding a preset smoothing value to the probability values in the n label probability matrices to obtain n matrices to be filtered.
[0052] In some embodiments, the preset smoothing value can be 0.1.
[0053] In the above embodiments, label smoothing is performed on the probability values output by the convolutional network classification model to avoid the convolutional network classification model being overconfident in the output results, which would lead to overfitting and poor generalization ability. This ensures the accuracy of the probabilities in the matrix to be screened and further makes the classification results output by the optimized loss function more accurate.
[0054] In some embodiments, the normalization operation on the constraint list to obtain a normalized list may include:
[0055] The normalized exponential function is used to normalize the list of constraints so that all probability values in the list are greater than or equal to 0 and less than or equal to 1, thus obtaining the normalized list.
[0056] The above embodiment solves the problem that after adding the probability values of the same column of the matrix to be superimposed, the probability value corresponding to each label in the constraint list is too large, much greater than 1, so that the predicted probability value corresponding to each real label is a value greater than 0 and less than 1, thereby ensuring the normal operation of the optimization loss function.
[0057] Please see Figure 2 In some embodiments, the optimized loss function obtained above based on n probability variance values, n predicted probability values, and the true labels corresponding to each predicted probability value may specifically include:
[0058] Step S51: Obtain the average variance based on the n probability variance values.
[0059] Step S52: Obtain the Dirac loss function based on the n predicted probability values and the true labels corresponding to each predicted probability value.
[0060] For the true labels A, B, and C, the n predicted probability values can be represented as P1, P2, and P3, and the set of predicted probabilities for the true labels is p. gt =[P1,P2,P3].
[0061] Step S53: Obtain the focus loss function based on the variance mean and n predicted probability values.
[0062] Specifically, if there are a total of n true labels, let the probability variances be S1, S2…S… n Then the variance mean γ is:
[0063]
[0064] The Dirac loss function (Distribution Focal Loss) mentioned above is:
[0065]
[0066] The focal loss function is:
[0067] FocalLoss=(1―p t ) γ
[0068] Among them, s gt For the preset target label, s l For the label in the left region of the preset target label, s r The labels in the right region of the preset target label are all pre-defined by the user in the program. If the actual label A is used as the preset target label, then s l For real labels B, s r It can be a real label, such as C.
[0069] p l For the predicted probability value of the label in the left region of the preset target label, if s l If the true label is B, then p l =P2;p r For the predicted probability value of the label in the right region of the preset target label, if s r If the real label is C, then p r =P3.
[0070] The Focal Loss function is introduced primarily to address the problem of uneven distribution of optimized data samples. Here, the optimized data samples refer to the data output by the convolutional network classification model, after undergoing the processing steps described in the above embodiments of this application, and used as input to the optimized loss function. It is precisely because this application optimizes the data output by the convolutional network classification model that the loss function using the optimized data samples as input is optimized.
[0071] In Focal Loss, p t This reflects the difficulty level of classification, p t The larger the value, the higher the confidence level of the classification, indicating that the sample is easier to classify; p t The smaller the value, the lower the confidence level of the classification, indicating that the samples are more difficult to classify. Therefore, Focal Loss essentially increases the weight of difficult-to-classify samples in the loss function. γ is a hyperparameter, usually set to 1.5. It's evident that Focal Loss, while addressing the problem of uneven sample distribution, still suffers from the need for manual adjustment of the γ hyperparameter. Therefore, this application utilizes the average of the sum of variances from the normalized list obtained through principal component analysis to resolve the accuracy issue caused by adjusting the γ parameter. A larger average variance indicates a lower difficulty level in classifying the samples, and vice versa. Compared to the fixed parameter form of Focal Loss, setting γ equal to the average variance better optimizes the loss function under uneven data sample distribution.
[0072] Step S54: Obtain the optimized loss function based on the Dirac loss function and the focus loss function.
[0073] Based on Distribution Focal Loss and Focal Loss, the optimized loss function Loss(p,s) can be obtained as follows:
[0074]
[0075] The above embodiments address the problem of uneven data sample distribution in Loss(p,s) by introducing the Focal Loss function, thereby further improving the accuracy of the classification results of the optimized loss function.
[0076] Please see Figure 3 Another embodiment of this application provides a loss function optimization apparatus, the apparatus comprising:
[0077] The initial classification module 101 is used to input the training image set into the convolutional network classification model to obtain a list of label probabilities for each image in the training image set, where each image in the training image set includes the true label.
[0078] The splicing module 102 is used to splice the list of label probabilities corresponding to multiple images with the same real label to obtain n label probability matrices, and perform label smoothing operation on the n label probability matrices to obtain n matrices to be filtered.
[0079] The dimension reduction module 103 is used to reduce the dimension of the matrix to be screened by principal component analysis to obtain the matrix to be superimposed.
[0080] The variance calculation module 104 is used to add the probability values of the same column in the matrix to be superimposed to obtain the list to be constrained; to perform a normalization operation on the list to be constrained to obtain a normalized list; to calculate the probability variance value of the normalized list and obtain the predicted probability value corresponding to the true label in the normalized list.
[0081] The optimization module 105 is used to sequentially execute the dimensionality reduction module 103 and the variance calculation module 104 on the n matrices to be screened to obtain n probability variance values and n predicted probability values; and to obtain the optimized loss function based on the n probability variance values, the n predicted probability values and the true labels corresponding to each predicted probability value.
[0082] The loss function optimization method provided in the above embodiment concatenates multiple label probability lists output by the convolutional network classification model according to the true labels of the images to obtain a label probability matrix corresponding to the images of the same car model. Label smoothing is performed on the label probability matrix to avoid overfitting and poor generalization ability of the convolutional network classification model. Principal component analysis is used to reduce the dimensionality of the matrix to be selected, enabling the selection of data with high information content in the matrix and strengthening the value and connections of the data in the matrix to be superimposed. The data processed in the above way is used as input to the loss function to optimize the loss function, improving its recall and convergence speed, resulting in more accurate classification results output by the optimized loss function.
[0083] In some embodiments, the splicing module 102 may further include a smoothing unit.
[0084] The smoothing unit is used to add a preset smoothing value to the probability values in the n label probability matrices to obtain n matrices to be filtered.
[0085] The above embodiment performs label smoothing operation on the probability values output by the convolutional network classification model through the smoothing unit in the splicing module 102. This avoids the convolutional network classification model from being overconfident in the output results, which would lead to overfitting and poor generalization ability. This ensures the accuracy of the probabilities in the matrix to be screened and further makes the classification results output by the optimized loss function more accurate.
[0086] In some embodiments, the variance calculation module 104 may further include a normalization unit.
[0087] The normalization unit is used to normalize the list of constraints using a normalization exponent function, so that all probability values in the list of constraints are greater than or equal to 0 and less than or equal to 1, thus obtaining a normalized list.
[0088] The above embodiment solves the problem that after adding the probability values of the same column of the matrix to be superimposed, the probability value corresponding to each label in the constraint list is too large, much greater than 1, so that the predicted probability value corresponding to each real label is a value greater than 0 and less than 1, thereby ensuring the normal operation of the optimization loss function.
[0089] The specific limitations of the loss function optimization device provided in this embodiment can be found in the embodiment of the loss function optimization method described above, and will not be repeated here. Each module in the above-described loss function optimization device can be implemented entirely or partially through software, hardware, or a combination thereof. Each module can be embedded in or independent of the processor in a computer device in hardware form, or stored in the memory of a computer device in software form, so that the processor can call and execute the operations corresponding to each module.
[0090] This application provides a computer device that may include a processor, memory, network interface, and database connected via a system bus. The processor provides computing and control capabilities. The memory includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores an operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium. The network interface communicates with external terminals via a network connection. When the computer program is executed by the processor, it causes the processor to perform the steps of a loss function optimization method as described in any of the above embodiments.
[0091] The working process, working details, and technical effects of the computer device provided in this embodiment can be found in the embodiment of a loss function optimization method described above, and will not be repeated here.
[0092] This application provides a computer-readable storage medium storing a computer program thereon. When executed by a processor, the computer program implements the steps of a loss function optimization method as described in any of the above embodiments. The computer-readable storage medium refers to a data storage medium, which may include, but is not limited to, floppy disks, optical disks, hard disks, flash memory, USB flash drives, and / or memory sticks. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The working process, details, and technical effects of the computer-readable storage medium provided in this embodiment can be found in the embodiments of a loss function optimization method described above, and will not be repeated here.
[0093] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, storage, databases, or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), RAMbus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and RAMbus dynamic RAM (RDRAM).
[0094] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0095] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the invention patent. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this patent application should be determined by the appended claims.
Claims
1. A loss function optimization method, characterized in that, The method includes: Step S1: Input the training image set into the convolutional network classification model to obtain a list of label probabilities for each image in the training image set, wherein each image in the training image set includes a true label; Step S2: Concatenate the label probability lists corresponding to multiple images with the same real label to obtain n label probability matrices; perform label smoothing operation on the n label probability matrices to obtain n matrices to be filtered. Step S3: Principal component analysis is used to reduce the dimensionality of the matrix to be screened to obtain the matrix to be superimposed. Step S4: Add the probability values of the same column in the matrix to be superimposed to obtain a list to be constrained; normalize the list to be constrained to obtain a normalized list; calculate the probability variance of the normalized list and obtain the predicted probability value corresponding to the true label in the normalized list. Step S5: Steps S3 and S4 are executed sequentially for each of the n matrices to be screened, resulting in n probability variance values and n predicted probability values. An optimized loss function is obtained based on the n probability variance values, the n predicted probability values, and the true labels corresponding to each predicted probability value. Specifically, the variance average is obtained based on the n probability variance values; the Dirac loss function is obtained based on the n predicted probability values and the true labels corresponding to each predicted probability value; a focus loss function is obtained based on the variance average and the n predicted probability values; and the optimized loss function is obtained based on the Dirac loss function and the focus loss function. Specifically, obtaining the focus loss function based on the average variance and n predicted probability values includes: using the average variance as a dynamic adjustment factor for the focus loss function; the hyperparameter γ of the focus loss function is positively correlated with the average variance; when the average variance increases, γ increases to enhance the mining of difficult samples; when the average variance decreases, γ decreases to avoid over-focusing on easily distinguishable samples.
2. The method according to claim 1, characterized in that, The step of performing label smoothing on the n label probability matrices to obtain n matrices to be filtered includes: Add a preset smoothing value to each of the probability values in the n label probability matrices to obtain n matrices to be filtered.
3. The method according to claim 2, characterized in that, The preset smoothing value is 0.
1.
4. The method according to claim 1, characterized in that, The normalization operation on the list to be constrained to obtain a normalized list includes: The list of objects to be constrained is normalized using a normalized exponential function so that each probability value in the list of objects to be constrained is greater than or equal to 0 and less than or equal to 1, thus obtaining the normalized list.
5. A loss function optimization device, characterized in that, The device includes: The initial classification module is used to input the training image set into the convolutional network classification model to obtain a list of label probabilities for each image in the training image set, wherein each image in the training image set includes a true label; The splicing module is used to splice the list of label probabilities corresponding to multiple images with the same real label to obtain n label probability matrices, and perform a label smoothing operation on the n label probability matrices to obtain n matrices to be filtered. The dimension reduction module is used to reduce the dimension of the matrix to be screened by principal component analysis to obtain the matrix to be superimposed. The variance calculation module is used to add the probability values of the same column in the matrix to be superimposed to obtain a list to be constrained; to perform a normalization operation on the list to be constrained to obtain a normalized list; to calculate the probability variance value of the normalized list and obtain the predicted probability value corresponding to the true label in the normalized list. An optimization module is used to sequentially execute the dimensionality reduction module and the variance calculation module on the n matrices to be screened, respectively, to obtain n probability variance values and n predicted probability values; an optimized loss function is obtained based on the n probability variance values, the n predicted probability values, and the true labels corresponding to each predicted probability value; specifically, an average variance is obtained based on the n probability variance values; a Dirac loss function is obtained based on the n predicted probability values and the true labels corresponding to each predicted probability value; a focal loss function is obtained based on the average variance and the n predicted probability values; and the optimized loss function is obtained based on the Dirac loss function and the focal loss function. Specifically, obtaining the focus loss function based on the average variance and n predicted probability values includes: using the average variance as a dynamic adjustment factor for the focus loss function; the hyperparameter γ of the focus loss function is positively correlated with the average variance; when the average variance increases, γ increases to enhance the mining of difficult samples; when the average variance decreases, γ decreases to avoid over-focusing on easily distinguishable samples.
6. The apparatus according to claim 5, characterized in that, The splicing module includes a smoothing unit; The smoothing unit is used to add a preset smoothing value to the probability values in the n label probability matrices to obtain n matrices to be filtered.
7. The apparatus according to claim 5, characterized in that, The variance calculation module includes a normalization unit; The normalization unit is used to normalize the list of objects to be constrained using a normalization exponential function, so that each probability value in the list of objects to be constrained is greater than or equal to 0 and less than or equal to 1, thereby obtaining the normalized list.
8. A computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the method as described in any one of claims 1 to 4.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method as described in any one of claims 1 to 4.
Citation Information
Patent Citations
Dynamic label smooth weighted loss method and device based on historical records
CN111784595A
