# The Lovász-Softmax loss: A tractable surrogate for the optimization of the intersection-over-union measure in neural networks
<img src="https://cdn.rawgit.com/bermanmaxim/bermanmaxim.github.io/5edecd41/single_LSimage.jpg" height="180">
Maxim Berman, Amal Rannen Triki, Matthew B. Blaschko
ESAT-PSI, KU Leuven, Belgium.
Published in CVPR 2018. See [project page](http://bmax.im/LovaszSoftmax), [arxiv paper](https://arxiv.org/abs/1705.08790), [paper on CVF open access](http://openaccess.thecvf.com/content_cvpr_2018/html/Berman_The_LovaSz-Softmax_Loss_CVPR_2018_paper.html).
## PyTorch implementation of the loss layer (*pytorch* folder)
**Files included:**
* **lovasz_losses.py**: Standalone PyTorch implementation of the Lovász hinge and Lovász-Softmax for the Jaccard index
* **demo_binary.ipynb**: Jupyter notebook showcasing binary training of a linear model, with the Lovász Hinge and with the Lovász-Sigmoid.
* **demo_multiclass.ipynb**: Jupyter notebook showcasing multiclass training of a linear model with the Lovász-Softmax
The binary `lovasz_hinge` expects real-valued scores (positive scores correspond to foreground pixels).
The multiclass `lovasz_softmax` expect class probabilities (the maximum scoring category is predicted). First use a `Softmax` layer on the unnormalized scores.
## TensorFlow implementation of the loss layer (*tensorflow* folder)
**Files included:**
* **lovasz_losses_tf.py**: Standalone TensorFlow implementation of the Lovász hinge and Lovász-Softmax for the Jaccard index
* **demo_binary_tf.ipynb**: Jupyter notebook showcasing binary training of a linear model, with the Lovász Hinge and with the Lovász-Sigmoid.
* **demo_multiclass_tf.ipynb**: Jupyter notebook showcasing the application of the multiclass loss with the Lovász-Softmax
*Warning: the losses values and gradients have been tested to be the same as in PyTorch (see notebooks), however we have not used the TF implementation in a training setting.*
## Usage
See the demos for simple proofs of principle.
## FAQ
* How should I use the Lovász-Softmax loss?
The loss can be optimized on its own, but the optimal optimization hyperparameters (learning rates, momentum) might be different from the best ones for cross-entropy. As discussed in the paper, optimizing the dataset-mIoU (Pascal VOC measure) is dependent on the batch size and number of classes. Therefore you might have best results by optimizing with cross-entropy first and finetuning with our loss, or by combining the two losses.
See for example how the work [*Land Cover Classification From Satellite Imagery With U-Net and Lovasz-Softmax Loss* by Alexander Rakhlin et al.](http://openaccess.thecvf.com/content_cvpr_2018_workshops/w4/html/Rakhlin_Land_Cover_Classification_CVPR_2018_paper.html) used our loss in the [CVPR 18 DeepGlobe challenge](http://deepglobe.org/).
* Inference in Tensorflow is very slow...
Compiling from Tensorflow master (or using a future distribution that includes commit [tensorflow/tensorflow@73e3215](https://github.com/tensorflow/tensorflow/commit/73e3215c3a2edadbf9111cca44ab3d5ca146c327)) should solve this problem; see [issue #6](https://github.com/bermanmaxim/LovaszSoftmax/issues/6).
## Citation
Please cite
```
@inproceedings{berman2018lovasz,
title={The Lov{\'a}sz-Softmax loss: A tractable surrogate for the optimization of the intersection-over-union measure in neural networks},
author={Berman, Maxim and Rannen Triki, Amal and Blaschko, Matthew B},
booktitle={Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition},
pages={4413--4421},
year={2018}
}
```
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
unet + pytorch 多分类自定义-python源码.zip (2000个子文件)
.gitattributes 65B
demo_binary.ipynb 476KB
demo_multiclass.ipynb 238KB
demo_binary_tf.ipynb 20KB
profile_ops.ipynb 18KB
demo_multiclass_tf.ipynb 18KB
Profiling.ipynb 3KB
Profiling.ipynb 2KB
LICENSE 1KB
README.md 4KB
README.md 1KB
1582708143461.png 2KB
1582708143405.png 2KB
1582708143505.png 2KB
1582708143540.png 2KB
1582708143552.png 2KB
1582701522882.png 1KB
1582701524362.png 1KB
1582701515344.png 1KB
1582701533419.png 1KB
1582701526007.png 1KB
1582701515640.png 1KB
1582701531940.png 1KB
1582701519045.png 1KB
1582701516096.png 1KB
1582701534372.png 1KB
1582701532434.png 1KB
1582701532139.png 1KB
1582701524650.png 1KB
1582701515995.png 1KB
1582701517430.png 1KB
1582701534711.png 1KB
1582701530611.png 1KB
1582701533489.png 1KB
1582701519479.png 1KB
1582701516528.png 1KB
1582701529682.png 1KB
1582701529131.png 1024B
1582701534213.png 1022B
1582701531637.png 1020B
1582701526779.png 1017B
1582701515308.png 1013B
1582701529119.png 1009B
1582701525157.png 1009B
1582701520688.png 1009B
1582708143405.png 1008B
1582701520221.png 1004B
1582701516870.png 1001B
1582701525884.png 999B
1582701528013.png 999B
1582701517275.png 997B
1582701532013.png 997B
1582701519713.png 995B
1582701528362.png 994B
1582701530696.png 992B
1582701518888.png 989B
1582701519787.png 987B
1582701529339.png 984B
1582701523183.png 984B
1582701529557.png 983B
1582701523499.png 982B
1582701527103.png 978B
1582701526523.png 977B
1582701526262.png 977B
1582701520413.png 976B
1582701526995.png 972B
1582701530214.png 972B
1582701532202.png 971B
1582701516965.png 971B
1582701516576.png 970B
1582701533644.png 969B
1582701520067.png 969B
1582701519579.png 968B
1582701516454.png 967B
1582701526250.png 967B
1582701533264.png 965B
1582701522857.png 964B
1582701534526.png 963B
1582701532493.png 963B
1582701526273.png 962B
1582701527091.png 961B
1582701529486.png 959B
1582701522041.png 958B
1582701518828.png 957B
1582701532481.png 954B
1582701518900.png 954B
1582701518863.png 950B
1582701526642.png 950B
1582701534095.png 948B
1582701531251.png 948B
1582701522340.png 948B
1582701532002.png 945B
1582701529214.png 945B
1582701533833.png 941B
1582701524967.png 941B
1582701521827.png 940B
1582701518460.png 939B
1582701534072.png 936B
1582701522109.png 935B
1582701525779.png 933B
共 2000 条
- 1
- 2
- 3
- 4
- 5
- 6
- 20
资源评论
FL1768317420
- 粉丝: 4416
- 资源: 4741
下载权益
C知道特权
VIP文章
课程特权
开通VIP
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功