【发布时间】:2026-01-09 03:00:01
【问题描述】:
我正在使用卷积神经网络。
我的数据很不平衡,我有两个类。
我的第一堂课包含: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
)
或者我应该使用
classes_weights = 10.5287
【问题讨论】:
标签: python machine-learning tensorflow artificial-intelligence convolution