分割网络中的激活函数和度量计算

发布于 2025-01-12 00:03:17 字数 251 浏览 6 评论 0原文

我有一个二进制分割任务:我必须预测图像的每个像素是或否。

因此,我使用二元交叉熵损失(在 Pytorch 中定义并结合了 sigmoid 和交叉熵损失)来训练网络。

为了计算指标,由于我需要每个像素的输出为 0 和 1,因此我使用了 sigmoid 函数,然后将所有小于 0.5 的数据视为 0,将所有大于 0.5 的数据视为 1。

但是我认为这种方法是不正确的,我应该使用像softmax这样的东西。您能解释一下我应该遵循什么方法以及为什么吗?

I had a binary segmentation task: I had to predict yes or no for each pixel of an image.

Therefore I used a binary cross entropy loss (which is defined in Pytorch and combines a sigmoid and a cross entropy loss) to train the network.

To compute the metrics, since I needed an output of 0 and 1 for each pixel, I used the sigmoid function and then consider everything smaller than 0.5 as 0 and everything bigger than 0.5 as 1.

However I think this approach is not correct and I should have used something like a softmax. Could you explain what approach I should have followed and why?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文