MIT License

项目介绍

bermanmaxim/LovaszSoftmax 是一个托管在 GitHub 上的开源项目,主要使用 Jupyter Notebook 编写,采用 MIT License 许可证,目前获得 1.4k 个 Star、265 次 Fork。

仓库全名
bermanmaxim/LovaszSoftmax
开源许可证
MIT License
Star 数
1.4k
Fork 数
265
未关闭 Issue
18

README 摘要

The Lovász-Softmax loss: A tractable surrogate for the optimization of the intersection-over-union measure in neural networks Maxim Berman, Amal Rannen Triki, Matthew B. Blaschko ESAT-PSI, KU Leuven, Belgium. Published in CVPR 2018. See project page, arxiv paper, paper on CVF open access. PyTorch implementation of the loss layer (pytorch folder) Files included: lovaszlosses.py: Standalone PyTorch implementation of…

完整内容见 GitHub 原始 README 或本页 。

常见问题

LovaszSoftmax 用什么语言开发?

主要使用 Jupyter Notebook 编写,采用 MIT License 许可证,目前有 1.4k 个 Star。

LovaszSoftmax 可以免费商用吗?

仓库采用 MIT License 许可证,可免费使用与修改,商业使用请遵守许可证条款(例如保留版权声明与许可声明)。

如何获取 LovaszSoftmax 的源码?

可以直接克隆仓库:git clone https://github.com/bermanmaxim/LovaszSoftmax.git,默认分支为 master;安装与运行步骤见仓库 README。

LovaszSoftmax 最近还在维护吗?

仓库最近一次更新为 2024年4月13日,当前有 18 个未关闭 Issue;Star 数为 1.4k,可作为社区活跃度的参考。

关于

GitHub 原始描述

Code for the Lovász-Softmax loss (CVPR 2018)

描述取自 GitHub 官方 API,保持仓库作者书写的原文。

简要分析

热度分
1970
价值分
927
活跃状态
活跃

语言占比

Jupyter Notebook
Python

README

The Lovász-Softmax loss: A tractable surrogate for the optimization of the intersection-over-union measure in neural networks

Maxim Berman, Amal Rannen Triki, Matthew B. Blaschko

ESAT-PSI, KU Leuven, Belgium.

Published in CVPR 2018. See project page, arxiv paper, paper on CVF open access.

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. used our loss in the CVPR 18 DeepGlobe challenge.

  • Inference in Tensorflow is very slow…

Compiling from Tensorflow master (or using a future distribution that includes commit tensorflow/tensorflow@73e3215) should solve this problem; see issue #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}
}

评论

暂无评论