小编Dar*_*tis的帖子

如何正确计算 tf.nn.weighted_cross_entropy_with_logits pos_weight 变量

我正在使用卷积神经网络。

我的数据很不平衡,我有两个班级。

我的第一堂课包含:551,462 个图像文件

我的第二堂课包含:52,377 个图像文件

我想使用weighted_cross_entropy_with_logits,但我不确定我pos_weight是否正确计算了变量。

现在我正在使用

classes_weights = tf.constant([0.0949784, 1.0])
cross_entropy = tf.reduce_mean(tf.nn.weighted_cross_entropy_with_logits(logits=logits, targets=y_, pos_weight=classes_weights))
train_step = tf.train.AdamOptimizer(LEARNING_RATE, epsilon=1e-03).minimize(
      cross_entropy
    , global_step=global_step
    )
Run Code Online (Sandbox Code Playgroud)

或者我应该使用

classes_weights = 10.5287

python artificial-intelligence machine-learning convolution tensorflow

2
推荐指数
1
解决办法
7608
查看次数