7

Why does the Total Variation Loss in Tensorflow suggest to use reduce_sum instead of reduce_mean as a loss function?

This can be used as a loss-function during optimization so as to suppress noise in images. If you have a batch of images, then you should calculate the scalar loss-value as the sum:
loss = tf.reduce_sum(tf.image.total_variation(images))

Cypher
  • 2,374
  • 4
  • 24
  • 36
  • 2
    If you use `tf.reduce_mean` you loss value will be independent of `batch_size` which is desireable effect as I understand, but maybe using `tf.reduce_mean` will produce loss value that is too low, which can be undesireable effect. – mrgloom Sep 08 '19 at 20:29

1 Answers1

8

I contacted the author and it seems there wasn't any important reason behind it at all. He mentioned that maybe reduce_sum worked better for his test case than reduce_mean but encouraged me to test both cases and choose the one which gives me the best results.

Cypher
  • 2,374
  • 4
  • 24
  • 36