Skip to content

Commit

Permalink
test loss function
Browse files Browse the repository at this point in the history
  • Loading branch information
Arno1235 committed Mar 22, 2023
1 parent 97c01d4 commit de5be26
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion unet_2d.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,10 @@ def get_loss(self, logits, labels):
# sum_ = tf.reduce_sum(flat_pred + flat_labels, axis=0)
# loss = 1.0 - 2.0 * (intersection + 1) / (sum_ + 1)

cross_entropy=tf.nn.sparse_softmax_cross_entropy_with_logits(flat_logits,flat_labels,name='x_ent')
# cross_entropy=tf.nn.sparse_softmax_cross_entropy_with_logits(flat_logits,flat_labels,name='x_ent')

cross_entropy = tf.nn.softmax_cross_entropy_with_logits(logits=flat_logits, labels=flat_labels)

loss=tf.reduce_mean(cross_entropy, name='x_ent_mean')

### TEST ###
Expand Down

0 comments on commit de5be26

Please sign in to comment.