当前位置:网站首页>Tensorflow introductory tutorial (34) -- two types of image segmentation loss functions commonly used
Tensorflow introductory tutorial (34) -- two types of image segmentation loss functions commonly used
2022-07-22 05:26:00 【51CTO】
Two commonly used loss functions of image segmentation are binary cross entropy ,dice coefficient ,tversky,FocalLoss etc. . Today I will be in TensorFlow The above loss function is reproduced under , And compare the results .
1、Cross Entropy
The cross entropy loss function compares the class prediction value with the target value on a pixel by pixel basis , Then average all pixels . The formula is as follows , among p Is the true category value ,p’ Yes, the forecast belongs to the category 1 The probability of .
This function has the same weight for each category , Therefore, it is very vulnerable to category imbalance .
The reproduction code is as follows :
2、Dice loss
Dice loss Is in V-net Used in the model , Generally, the anatomical structure area of interest occupies a relatively small area , Therefore, increase the weight of the foreground area , It can reduce the impact of category imbalance . The formula is as follows , among TP,FP,FN They are true positive 、 False positive 、 The number of false negatives .
In some papers Dice loss The calculation formula can also be like this , As shown below , among p Is the true category value (0 or 1),p’ Is the probability value of the prediction category (0~1).
The reproduction code is as follows :
3、Tversky loss
Tversky loss yes Dice loss The general expression of ,Tversky loss In false positive 、 The false negative area increases the weight factor . The formula is as follows , among p Is the true category value (0 or 1),p’ Is the probability value of the prediction category (0~1). You can find , When beta The value is 0.5 when ,Tversky loss Namely Dice loss 了 .
The reproduction code is as follows :
4、Focal loss
Focal loss It's right Cross Entropy Function improvements , This function reduces the simple sample loss weight , Thus, the network is more focused on the loss of difficult samples . The formula is as follows , among p Is the true category value ,p’ Yes, the forecast belongs to the category 1 The probability of .
The reproduction code is as follows :
5、Cross Entropy+Dice loss
Some articles combine different loss functions to train networks , Tencent medical AI Papers published in the laboratory 《AnatomyNet: Deep Learning for Fast and Fully Automated Whole-volume Segmentation of Head and Neck Anatomy》 In the proposed Dice loss + Focal loss To deal with the segmentation of small organs . It reappears here Cross Entropy+Dice loss Function implementation of , The reproduction code is as follows :
Train the above five loss functions , And in 10 Predict and calculate on the test data dice value , give the result as follows .
For everyone to learn better , I share the entire project code to github On :
https://github.com/junqiangchen/Image-Segmentation-Loss-Functions
If you think this project is good , I hope you can give me Star and Fork, Can let more people learn . If you run into any problems , Leave a message at any time , I'll try to answer .
边栏推荐
- [chestnut sugar GIS] ArcMap - how to quickly generate the four directions information
- 如何使用多类型数据预训练多模态模型?
- Tensorflow入门教程(三十四)——常用两类图像分割损失函数
- 2022.7.9暑假个人训练1-B.How old are you Mr. String
- Anti counterfeiting AI ownerless lamp, who is playing it really?
- If there is out in PG function, returns setof record as is ignored$$
- Mipi based high performance imaging system
- 优思学院|从《孙子兵法》中学习六西格玛管理
- 如何绘制PCB外形加工图
- Introduction of (string + memory) function
猜你喜欢
What if MySQL deletion fails
【链表及其经典问题】
Introduction of (string + memory) function
The installation package cannot be downloaded due to the mismatch when PIP downloads the package: error: subprocess exited with error; error: metadata-generation-failed;
[development tutorial 7] crazy shell arm function mobile phone ble transparent transmission experiment tutorial
Go language environment construction and samples
面试突击66:请求转发和请求重定向有什么区别?
Access denied for user ‘root‘@‘localhost‘ (using password: YES)的解决方法
Leetcode · une question par jour · 814. Coupe d'arbre binaire · récursion
ES6 从入门到精通 # 04:函数之默认值、剩余参数
随机推荐
Niuke.com released a new digital logic question bank! Will it lead to more volume in fpga/ic industry this year?!!
Knowledge drops - English Vocabulary
NFS shared storage service
ButterKnife库(一个高效的工具库,小白只记录了一个用法-不深入研究,嘻嘻)
Go language environment construction and samples
unity URP前向渲染流程以及获取屏幕空间UV和深度
Unity URP forward rendering process and obtaining screen space UVs and depth
MySQL storage engine
第12章 网络安全审计技术原理与应用
LeetCode·每日一題·814.二叉樹剪枝·遞歸
实习打怪之路:Promise简介原理和常见方法
The way to practice and fight strange things: promise introduction principle and common methods
pip下载包时出现不适配导致无法下载安装包:error: subprocess-exited-with-error;error: metadata-generation-failed;
Symbol的使用,es6获取key值的新方法
mysql存储引擎
ES6 从入门到精通 # 01:ES6 介绍
JVM first acquaintance
如何清理C盘
【板栗糖GIS】bat—如何对子文件中的数据进行批量重命名
Scratch score query Electronic Society graphical programming scratch grade examination level 4 true questions and answers analysis June 2022