Skip to content

Commit

Permalink
fix: requested changes
Browse files Browse the repository at this point in the history
  • Loading branch information
charlesmindee committed Feb 14, 2022
1 parent 8e6ef60 commit 7fb3c2b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion doctr/models/detection/linknet/pytorch.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ def compute_loss(
dice_loss = 1 - 2 * inter / (cardinality + 1e-8)

# Only consider contributions overlaping the mask
return bce_loss[seg_mask].mean() + dice_loss.mean()
return bce_loss[seg_mask].mean() + dice_loss


def _linknet(
Expand Down
2 changes: 1 addition & 1 deletion doctr/models/detection/linknet/tensorflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ def compute_loss(
cardinality = tf.math.reduce_sum(prob_map[seg_mask] + seg_target[seg_mask])
dice_loss = 1 - 2 * inter / (cardinality + 1e-8)

return tf.math.reduce_mean(bce_loss[seg_mask]) + tf.math.reduce_mean(dice_loss)
return tf.math.reduce_mean(bce_loss[seg_mask]) + dice_loss

def call(
self,
Expand Down

0 comments on commit 7fb3c2b

Please sign in to comment.