如何改为sigmoid学习多标签分类

2024-09-30 22:12:26 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在尝试使用'inception resnet v2.py'来进行多标签分类。你知道吗

我用了乙状结肠,但效果不好。你知道吗

你知道在哪儿换车吗?你知道吗

https://github.com/tensorflow/models/tree/master/research/slim

"train_image_classifier.py"已更改为sigmoid,但结果与使用softmax一样好。你知道吗

我必须从“net”文件夹中的"inception resnet v2.py"更改它吗?你知道吗

  if 'AuxLogits' in end_points:
    slim.losses.sigmoid_cross_entropy(
        end_points['AuxLogits'], labels,
        label_smoothing=FLAGS.label_smoothing, weights=0.4,
        scope='aux_loss')
  slim.losses.sigmoid_cross_entropy(
      logits, labels, label_smoothing=FLAGS.label_smoothing, weights=1.0)
  return end_points

如果把一个红色和四轮驱动汽车的形象,这将是很好的,如果它出来这样,但它不是。你知道吗

Car [0.99]
4 wheel drive [0.99]
color red [0.99]

实际上,每个人都猜对了,但结果却像是在使用softmax。你知道吗

Car [0.99]
4 wheel drive [0.03]
color red [0.009]

Tags: pylabelpointsv2endentropyresnetinception
1条回答
网友
1楼 · 发布于 2024-09-30 22:12:26

根据“多标签”的类型,有一些可能的选择。你知道吗

如果“多标签”的可能重叠部分是不同的相互独立的标签集(颜色、形状等)的组合,则分别为这些集创建softmax输出层将是一件好事。你知道吗

如果不幸的是标签无法分割,那么您可能需要检查并更改损失函数:对于softmax,它通常是交叉熵,这对sigmoid不起作用。你知道吗

相关问题 更多 >