Loss function comprehensive calculation method, device and equipment

By combining multiple loss functions, the problems of coherence and false positives in elongated structure segmentation are solved, and the efficiency and accuracy of elongated line segmentation are achieved, and the safety and reliability of the autonomous driving system are improved.

CN119762788AActive Publication Date: 2025-04-04ZHEJIANG XINMAI SILICON CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202510258224.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-06
Publication Date
2025-04-04
Estimated Expiration
2045-03-06

AI Technical Summary

Technical Problem

The prior art is difficult to maintain its coherence when dealing with elongated structures, resulting in fractures or discontinuities in the segmentation results, which in turn affects the accurate definition of the safe area, and produces a large number of false positives and the output values ​​of the segmentation model are too large or too small.

Method used

By combining multiple loss functions, including coherence loss, false positive penalty term, and regularized term loss function constraints, we comprehensively consider segmentation accuracy, coherence and false positive control, and improve the overall performance of slender line segmentation in road scenarios.

Benefits of technology

The coherence and accuracy of slender line segmentation is achieved, false positives are reduced, the accurate identification of safe areas is ensured, and the safety and reliability of the autonomous driving system is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119762788A_ABST
    Figure CN119762788A_ABST
Patent Text Reader

Abstract

The present invention discloses a method, device and equipment for comprehensive calculation of loss function, which relates to the field of loss function calculation, and includes the steps of: obtaining network input prediction results, true labels and each layer feature of the model; respectively obtaining the output results of four loss functions through focus loss function, connectivity loss function, false positive penalty term loss function and regularization term loss function; respectively weighting the output results of the four loss functions to obtain the total loss result. Main technical scheme and effect: Through the synergistic effect of multiple loss functions, the segmentation accuracy, coherence, false positive control and quantization error are comprehensively considered, so that the model has significant improvements in multiple dimensions, stronger adaptability, and obvious improvement in the coherent segmentation of thin and long lines.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of loss function calculation, and in particular to a method, device and equipment for comprehensive calculation of loss function. Background Art

[0002] In autonomous driving and intelligent transportation systems, environmental perception is one of the key technologies to achieve safe driving. Among them, road scene segmentation is an important part of environmental perception. Different areas in the road image are distinguished by dividing lines between the road surfaces to identify key structures such as road surface, curbs, green belts, fences, etc. These long and thin line structures play an important role in defining safe areas. For example, pedestrians and vehicles outside the fence, outside the green belt, or on the curb are considered to be in a safe area and do not need to trigger an alarm.

[0003] The existing loss function calculation methods have the following main defects:

[0004] 1. Traditional loss functions such as cross entropy loss and Dice loss have difficulty maintaining coherence when dealing with slender structures, resulting in breaks or discontinuities in the segmentation results, which in turn affects the accurate definition of the safe area.

[0005] 2. In complex road environments, the background is complex and diverse, which can easily cause the model to generate a large number of false positives (i.e., misjudging unsafe areas as safe areas), which may lead to the omission of dangerous vehicles or driving.

[0006] 3. Existing methods usually lack effective constraints on the output range of the model. The training method of the segmentation model can easily make the output value too large or too small, which in turn affects the quantization and use of the model on the side.

[0007] 4. Most methods only focus on the accuracy of segmentation and fail to comprehensively consider coherence, false positive control and stability of model quantization, resulting in limited overall performance in specific application scenarios. Summary of the invention

[0008] Purpose of the invention: The purpose of the present invention is to solve the technical problems in the prior art that it is difficult to maintain the continuity of slender structures when processing them, resulting in breaks or discontinuities in the segmentation results, which in turn affects the accurate definition of the safety area, generates a large number of false positives, and the training method of the segmentation model easily makes the output value too large or too small. A method, device and equipment for comprehensive calculation of loss function are provided, which realizes the overall performance of segmentation of slender lines in road scenes by combining multiple loss functions (including continuity loss, false positive penalty terms, regularization term loss function constraints), etc., comprehensively considering segmentation accuracy, continuity and false positive control, ensuring accurate identification of safety areas, and thus improving the safety and reliability of autonomous driving systems.

[0009] One or more embodiments of this specification also relate to a loss function comprehensive calculation device, an electronic device, a computer-readable storage medium and a computer program product to solve the technical defects existing in the prior art.

[0010] Technical solution:

[0011] In a first aspect, the present application proposes a method for comprehensive calculation of a loss function, comprising the steps of:

[0012] Get the network input prediction results, true labels, and features of each layer of the model;

[0013] The output results of four loss functions are obtained through the focus loss function, connectivity loss function, false positive penalty loss function, and regularization loss function respectively;

[0014] The output results of the four loss functions are weighted respectively to obtain the total loss result.

[0015] Preferably, the output results of four loss functions are obtained by respectively using the focus loss function, the connectivity loss function, the false positive penalty term loss function, and the regularization term loss function, including:

[0016] The network input prediction result is activated by the Sigmoid function to obtain the predicted probability value;

[0017] Flatten the predicted probability values ​​and true labels;

[0018] Calculate the number of true positives, false positives, and false negatives;

[0019] The output of the focal loss function is calculated.

[0020] Preferably, calculating the number of true positives, false positives, and false negatives comprises the following formula;

[0021]

[0022]

[0023] ;

[0024] in, is the value after flattening the predicted probability value. It is the value after flattening the real label, TP is the number of true positives, FP is the number of false positives, and FN is the number of false negatives.

[0025] Preferably, the output result of the focal loss function is calculated, including:

[0026] Calculate the loss index, the formula is as follows;

[0027] ;

[0028] The output result of the intersection loss function is calculated by the loss index. The formula is as follows;

[0029] ;

[0030] in, and is the weight parameter that adjusts the impact of FP and FN on the Tversky index, is a very small constant used to avoid the denominator being 0. Controls the modulation intensity of the loss.

[0031] Preferably, the output results of four loss functions are obtained by respectively using the focus loss function, the connectivity loss function, the false positive penalty term loss function, and the regularization term loss function, including:

[0032] Perform an average pooling operation on the network input prediction results to obtain the local average value. The formula is as follows:

[0033] ;

[0034] Calculate the difference between the prediction result and its local mean, the formula is as follows:

[0035] ;

[0036] Among them, p is the predicted probability value obtained by activating the network input prediction result through the Sigmoid function.

[0037] Preferably, the output results of the four loss functions are obtained by respectively using the focus loss function, the connectivity loss function, the false positive penalty term loss function, and the regularization term loss function, including the following formulas:

[0038] ;

[0039] Where: N0 is the number of background pixels, p i is the probability that the i-th pixel in the prediction result belongs to the foreground, and i∈background means that i is a background pixel.

[0040] Preferably, the output results of the four loss functions are obtained by respectively using the focus loss function, the connectivity loss function, the false positive penalty term loss function, and the regularization term loss function, including the following formulas:

[0041] ;

[0042] Among them, O jkis the feature of each layer output of the model, j represents the output layer, k represents the pixel index, N j is the total number of pixels output by the jth layer, and m represents the size of the model output.

[0043] Preferably, the output results of the four loss functions are weighted to obtain a total loss result, including:

[0044] ;

[0045] Among them, λ connectivity , fp , reg Represent the weights of the three auxiliary losses respectively.

[0046] Unit 2, an embodiment of the present invention provides a loss function comprehensive calculation device, including:

[0047] The acquisition unit is used to obtain the network input prediction results, true labels, and each layer feature of the model;

[0048] A computing unit, used to obtain output results of four loss functions through a focal loss function, a connectivity loss function, a false positive penalty loss function, and a regularization loss function;

[0049] The merging unit is used to weight the output results of the four loss functions respectively to obtain the total loss result.

[0050] In a third aspect, an embodiment of the present invention provides an electronic device, including a processor and a memory, wherein the memory is used to store one or more computer programs; when the one or more computer programs stored in the memory are executed by the processor, the electronic device can implement any possible design method of the first aspect.

[0051] In a fourth aspect, the present invention provides a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, the method as described in any one of the above embodiments is implemented.

[0052] In a fifth aspect, an embodiment of the present invention further provides a computer program product, which, when executed on an electronic device, enables the electronic device to execute any possible design method of any of the above aspects.

[0053] Beneficial effects: Provides a comprehensive loss function that combines four separate loss functions: focus loss function, connectivity loss function, false positive penalty loss function, and regularization loss function to achieve the following effects:

[0054] 1. Improve segmentation consistency: Introduce connectivity loss and ensure the consistency of thin lines through local consistency constraints to avoid breaks or discontinuities in the segmentation results, thereby accurately defining the boundaries of the safe area;

[0055] 2. Reduce false positives: The false positive penalty term effectively suppresses false detection of background areas, reduces the false positive rate, improves the accuracy of segmentation results, reduces the possibility of underreporting of dangerous targets, and improves the reliability of the system;

[0056] 3. Enhance model stability: The regularization term limits the model output value within a predetermined range to prevent the value from being too large or too small, thereby enhancing the stability and consistency of the model during the side quantization process;

[0057] 4. Comprehensive optimization goal: Through the synergy of multiple loss functions, the segmentation accuracy, false positive control and quantization error are comprehensively considered, so that the model has been significantly improved in multiple dimensions, with stronger adaptability, and has a significant improvement in the coherent segmentation of thin and long lines. BRIEF DESCRIPTION OF THE DRAWINGS

[0058] Figure 1 Provide a schematic diagram of the method framework for the present invention;

[0059] Figure 2 is a schematic diagram of the structure of a device provided by an embodiment of the present application;

[0060] Figure 3 This is a structural block diagram of an electronic device provided in one embodiment of the present application. DETAILED DESCRIPTION

[0061] In order to make the technical solution of the present invention clearer, the present invention is further described in detail below with reference to the specific embodiments of the accompanying drawings.

[0062] Example 1

[0063] In order to make the purpose, technical solutions and advantages of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention. Unless otherwise defined, the technical terms or scientific terms used herein should be understood by people with general skills in the field to which the present invention belongs. "Including" and similar words used in this article mean that the elements or objects appearing before the word include the elements or objects listed after the word and their equivalents, without excluding other elements or objects.

[0064] In view of the problems existing in the existing technology, such as Figure 1 As shown, a comprehensive calculation method of loss function includes the steps of:

[0065] Step S101, obtaining the network input prediction result, the true label and each layer feature of the model;

[0066] Step S102, obtaining output results of four loss functions through the focus loss function, the connectivity loss function, the false positive penalty loss function, and the regularization loss function respectively;

[0067] Step S103: weight the output results of the four loss functions respectively to obtain a total loss result.

[0068] Specifically, through the synergy of multiple loss functions, segmentation accuracy, coherence, false positive control and quantization error are comprehensively considered, so that the model is significantly improved in multiple dimensions and has stronger adaptability;

[0069] When calculating the loss function, it is only necessary to obtain the network input prediction results, the true labels, and the parameters of each layer of the model features, calculate the prediction results on the loss function, and directly optimize the output of the model through the post-processing mechanism, reducing excessive reliance on the intermediate representation of the feature map, and can more directly and effectively improve the local consistency of the final result;

[0070] The network input prediction result refers to the predicted output result obtained after forward propagation through the model. This is the road scene segmentation result predicted by the model based on the input data (for example, the segmented area includes safe areas and unsafe areas, etc.);

[0071] The true label refers to the correct segmentation label given in the manual annotation or reference data, which is used to compare with the model prediction results to calculate the error;

[0072] Features of each layer: refers to the feature maps or activation values ​​output at each layer of the network (especially the convolutional layer). These feature maps contain different levels of feature information extracted from the input image and are used to capture the image's space, edges, textures, and other content. By performing feature analysis on the output of each layer, the model can be further optimized.

[0073] In some preferred embodiments, the output results of four loss functions are obtained by respectively using the focus loss function, the connectivity loss function, the false positive penalty term loss function, and the regularization term loss function, including:

[0074] The network input prediction result is activated by the Sigmoid function to obtain the predicted probability value;

[0075] Flatten the predicted probability values ​​and true labels;

[0076] Calculate the number of true positives, false positives, and false negatives;

[0077] The output of the focal loss function is calculated.

[0078] Specifically, the Sigmoid activation function is used to convert the predicted value (logits) of each pixel into a probability value between 0 and 1. After the prediction results are converted into probabilities, the subsequent loss calculation will be based on these probabilities rather than the original classification output. In deep learning models, the output of image segmentation tasks is usually a multi-dimensional probability map (for example, a tensor of shape H×W×C, where H and W are the height and width of the image, and C is the number of categories). In order to calculate the loss function, these high-dimensional prediction results and true labels must be flattened into one-dimensional vectors for element-by-element comparison. The flattening operation converts the predictions and labels of the two-dimensional (or multi-dimensional) output into one-dimensional vectors, so that the subsequent loss calculation can be directly compared point by point. By calculating the true positives, false positives, and false negatives, the accuracy of the model prediction can be measured, especially in the case of class imbalance. The focal loss function optimizes the model based on these indicators, especially by adjusting the weights of false positives and false negatives;

[0079] Among them, true positives (TP) refer to pixels that are predicted to be positive and are actually positive, that is, pixels that are predicted to be "safe area" and labeled "safe area";

[0080] False Positive (FP): refers to pixels predicted as positive but actually negative, that is, pixels predicted as "safe area" but labeled as "non-safe area";

[0081] False negative (FN): refers to pixels predicted as negative but actually positive, that is, pixels predicted as "non-safe area" but labeled as "safe area";

[0082] The focal loss function is an improvement on the traditional cross entropy loss and is specifically used to deal with the problem of class imbalance. It increases the model's attention to difficult-to-classify samples by adjusting the loss weights of difficult-to-classify samples.

[0083] In some preferred embodiments, calculating the number of true positives, false positives, and false negatives comprises the following formula;

[0084]

[0085]

[0086] ;

[0087] in, is the value after flattening the predicted probability value. It is the value after flattening the real label, TP is the number of true positives, FP is the number of false positives, and FN is the number of false negatives.

[0088] In some preferred embodiments, the output result of the focal loss function is calculated, including:

[0089] Calculate the loss index, the formula is as follows;

[0090] ;

[0091] The output result of the intersection loss function is calculated by the loss index. The formula is as follows;

[0092] ;

[0093] in, and is the weight parameter that adjusts the impact of FP and FN on the Tversky index, is a very small constant used to avoid the situation where the denominator is 0. Controls the modulation intensity of the loss.

[0094] Specifically, the Tversky index is used to deal with the problem of class imbalance, especially when the number of positive and negative classes is very different. By adjusting α and β, the impact of false positives and false negatives on the final loss can be flexibly controlled;

[0095] Focal Tversky Loss, based on the Tversky exponent, further adjusts the γ parameter to pay more attention to difficult samples, avoiding the model from paying too much attention to easy-to-classify samples, thereby improving the model's ability to recognize difficult samples.

[0096] In some preferred embodiments, the output results of four loss functions are obtained by respectively using the focus loss function, the connectivity loss function, the false positive penalty term loss function, and the regularization term loss function, including:

[0097] Perform an average pooling operation on the network input prediction results to obtain the local average value. The formula is as follows:

[0098] ;

[0099] Calculate the difference between the prediction result and its local mean, the formula is as follows:

[0100] ;

[0101] Among them, p is the predicted probability value obtained by activating the network input prediction result through the Sigmoid function.

[0102] Specifically, the above method is a connectivity loss function method. The current methods all perform local average pooling on the feature map in the model to obtain local features at the channel level. However, the pooling operation is mainly aimed at the spatial hierarchy of the feature map, rather than directly optimizing the local consistency of the prediction results. By performing local average pooling on the prediction results on the loss function, the local consistency of the prediction results is strengthened. This method does not rely on the pooling layer inside the network, but directly optimizes the output of the model through a post-processing mechanism, reducing excessive reliance on the intermediate representation of the feature map, and can more directly and effectively improve the local consistency of the final result.

[0103] AvgPool2D performs two-dimensional average pooling on the prediction results to generate the average value of the local area. This helps calculate the mean of each local area, thereby ensuring the consistency of image segmentation and avoiding breaks in the prediction results;

[0104] By calculating the difference between the predicted value of each pixel and its local average, the connectivity loss function encourages the model to maintain the coherence of the segmentation results. This loss function helps to maintain the continuity of thin and long structures (such as road dividers) and avoid breaks or discontinuities in image segmentation.

[0105] In some preferred embodiments, the output results of the four loss functions are obtained by respectively using the focus loss function, the connectivity loss function, the false positive penalty term loss function, and the regularization term loss function, including the following formulas:

[0106] ;

[0107] Where: N0 is the number of background pixels, p i is the probability that the i-th pixel in the prediction result belongs to the foreground, and i∈background means that i is a background pixel.

[0108] Specifically, the false positive penalty term effectively suppresses false detection of background areas, reduces the false positive rate, improves the accuracy of segmentation results, reduces the possibility of underreporting of dangerous targets, and improves the reliability of the system;

[0109] The purpose of this loss function is to reduce false positives, that is, to reduce the probability that the background area is mistakenly predicted as the foreground area. For each pixel in the background area, the model calculates the probability p that it belongs to the background. i , and then sum the overall loss according to the number of background pixels N0;

[0110] Calculation process: By calculating the predicted probability of background pixels and averaging them, penalizing those cases where the background is misclassified as the foreground, this penalty helps improve the accuracy of the model in complex environments and avoids mistakenly detecting background areas as target areas.

[0111] In some preferred embodiments, the output results of the four loss functions are obtained by respectively using the focus loss function, the connectivity loss function, the false positive penalty term loss function, and the regularization term loss function, including the following formulas:

[0112] ;

[0113] Among them, O jk is the feature of each layer output of the model, j represents the output layer, k represents the pixel index, N j is the total number of pixels output by the jth layer, and m represents the size of the model output.

[0114] Specifically, the above scheme calculates the loss function for the regularization term loss function. The purpose of this loss function is to limit the output of each layer through regularization so that its value remains within a reasonable range, avoiding the situation where the model output value is too large or too small. This is crucial when the model is deployed in side-end quantization, because extreme output values ​​may lead to loss of accuracy.

[0115] Calculation process: For the output of each layer, take the absolute value and subtract the maximum value m. If it exceeds the range (that is, the part greater than m), calculate the loss. This loss helps ensure that the output of the model does not cause unstable prediction results due to over-activation of certain neurons;

[0116] The regularization term of the present invention regularizes the output of each layer of the network structure, rather than calculating the regularization loss for the output results of the network and the binary labels. The reason for adopting this regularization is that in the segmentation task, since it needs to distinguish the difference between the foreground and the background in the image, the output value of the network often has a large difference in different pixels, which will cause the model to lose accuracy after the side-end quantization deployment. This scheme applies regularization on the output of each layer, ensuring that the entire network can maintain a high accuracy during the quantization process. The regularization term limits the model output value within a predetermined range to prevent the value from being too large or too small, thereby enhancing the stability and consistency of the model during the side-end quantization process.

[0117] In some preferred embodiments, the output results of the four loss functions are weighted to obtain a total loss result, including:

[0118] ;

[0119] Among them, λ connectivity , fp , reg Represent the weights of the three auxiliary losses respectively.

[0120] Specifically, weight 1 (λ connectivity ) is used to control the local consistency strength of the prediction results;

[0121] Increasing the weight by 1 will strengthen the local consistency of the model output and reduce the breaks in the middle of thin lines (such as the safety zone segmentation line) in the prediction results. Reducing the weight by 1 will make the local consistency weaker, allowing more detailed information to be retained in the segmentation results, thereby reducing the risk of overfitting.

[0122] Weight 2 (λ fp ) is used to control the strength of false positive (false detection) suppression;

[0123] Increasing weight 2 can effectively suppress the occurrence of false positives, especially in areas that are difficult to distinguish (such as the dry-wet junction on rainy days or lane lines under complex backgrounds); reducing weight 2 will reduce the intensity of false positive suppression, which can improve the detection rate and reduce the risk of missed detection.

[0124] Weight 3 (λ reg ) is used to control the strength of the regularization term.

[0125] Increasing weight 3: can more strictly limit the output range of the model, ensuring that the output value does not exceed the specified interval. This helps to avoid large errors in the quantization process and ensure the accuracy of the model output. Reducing weight 3: will weaken the effect of regularization, allowing the model to output a larger range, which may improve the flexibility and adaptability of the model. Therefore, it is necessary to reasonably adjust the various weights to find the best balance between accuracy, robustness, and efficiency according to the requirements of the task, ensuring that the model can perform optimally in specific application scenarios.

[0126] In some preferred embodiments, Figure 2 , an embodiment of the present invention provides a loss function comprehensive calculation device, comprising:

[0127] An acquisition unit 301 is used to acquire the network input prediction result, the true label and each layer feature of the model;

[0128] A calculation unit 302 is used to obtain output results of four loss functions through a focus loss function, a connectivity loss function, a false positive penalty term loss function, and a regularization term loss function respectively;

[0129] The merging unit 303 is used to weight the output results of the four loss functions respectively to obtain a total loss result.

[0130] All relevant contents of each step involved in the above method embodiment can be referred to the functional description of the corresponding functional module, and will not be repeated here.

[0131] In some other embodiments of the present invention, an electronic device 400 is disclosed. Figure 3As shown, the electronic device may include: one or more processors 401; a memory 402; a display 403; one or more applications (not shown); and one or more computer programs 404. The above components may be connected via one or more communication buses 405. The one or more computer programs 404 are stored in the above memory 402 and configured to be executed by the one or more processors 401. The one or more computer programs 404 include instructions, which may be used to execute the following: Figure 1 to Figure 2 And each step in the corresponding embodiment.

[0132] Through the description of the above implementation methods, technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above functional modules is used as an example. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. The specific working process of the system, device and unit described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.

[0133] Each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0134] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the embodiment of the present invention is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, server, or network device, etc.) or a processor to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: flash memory, mobile hard disk, read-only memory, random access memory, disk or optical disk and other media that can store program codes.

[0135] The above is only a specific implementation of the embodiment of the present invention, but the protection scope of the embodiment of the present invention is not limited thereto. Any changes or substitutions within the technical scope disclosed in the embodiment of the present invention should be included in the protection scope of the embodiment of the present invention. Therefore, the protection scope of the embodiment of the present invention should be based on the protection scope of the claims.

Claims

1. A comprehensive calculation method for loss function, characterized in that: Includes steps: Get the network input prediction results, true labels, and features of each layer of the model; The output results of four loss functions are obtained through the focus loss function, connectivity loss function, false positive penalty loss function, and regularization loss function respectively; The output results of the four loss functions are weighted respectively to obtain the total loss result.

2. The method according to claim 1, characterized in that: The output results of four loss functions are obtained through the focus loss function, connectivity loss function, false positive penalty loss function, and regularization loss function, including: The network input prediction result is activated by the Sigmoid function to obtain the predicted probability value; Flatten the predicted probability values ​​and true labels; Calculate the number of true positives, false positives, and false negatives; The output of the focal loss function is calculated.

3. The method according to claim 2, characterized in that Calculating the number of true positives, false positives, and false negatives involves the following formula; , , ; in, is the value after flattening the predicted probability value. It is the value after flattening the real label, TP is the number of true positives, FP is the number of false positives, and FN is the number of false negatives.

4. The method according to claim 3, characterized in that The output results of the focal loss function are calculated, including: Calculate the loss index, the formula is as follows; ; The output result of the intersection loss function is calculated by the loss index. The formula is as follows; ; in, and is the weight parameter that adjusts the impact of FP and FN on the Tversky index, is a constant used to avoid the denominator being 0. Controls the modulation intensity of the loss.

5. The method according to claim 4, characterized in that The output results of four loss functions are obtained through the focus loss function, connectivity loss function, false positive penalty loss function, and regularization loss function, including: Perform an average pooling operation on the network input prediction results to obtain the local average value. The formula is as follows: ; Calculate the difference between the prediction result and its local mean, the formula is as follows: ; Among them, p is the predicted probability value obtained by activating the network input prediction result through the Sigmoid function.

6. The method according to claim 5, characterized in that The output results of the four loss functions are obtained through the focus loss function, connectivity loss function, false positive penalty loss function, and regularization loss function, including the following formulas: ; Where: N0 is the number of background pixels, p i is the probability that the i-th pixel in the prediction result belongs to the foreground, and i∈background means that i is a background pixel.

7. The method according to claim 6, characterized in that The output results of the four loss functions are obtained through the focus loss function, connectivity loss function, false positive penalty loss function, and regularization loss function, including the following formulas: ; Among them, O jk is the feature of each layer output of the model, j represents the output layer, k represents the pixel index, N j is the total number of pixels output by the jth layer, and m represents the size of the model output.

8. The method according to claim 7, characterized in that The output results of the four loss functions are weighted to obtain the total loss result, including: ; Among them, λ connectivity , fp , reg Represent the weights of the three auxiliary losses respectively.

9. A loss function comprehensive calculation device, characterized in that: include: The acquisition unit is used to obtain the network input prediction results, true labels, and each layer feature of the model; A computing unit, used to obtain output results of four loss functions through a focal loss function, a connectivity loss function, a false positive penalty loss function, and a regularization loss function; The merging unit is used to weight the output results of the four loss functions respectively to obtain the total loss result.

10. An electronic device, characterized in that: The method comprises a memory and a processor, wherein the memory stores a computer program executable on the processor, and when the computer program is executed by the processor, the processor implements the method according to any one of claims 1 to 8.

Citation Information

Patent Citations

  • U-Net image segmentation method based on FTL loss function and attention

    CN113538458A

  • Multi-sensor fusion vehicle-road collaborative sensing method for automatic driving

    CN114821507A

  • Image processing method and apparatus, and storage medium

    US20210158533A1