You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
inverts the pixel when its value is greater or equal to the threshold, so one would think that higher augmentation magnitude needs lower threshold. However, the threshold increases linearly with magnitude:
Counterintuitively, it still works as expected with magnitude=_MAX_LEVEL because of integer overflow. Given
t=tf.constant([[[0,0,0]]], dtype=tf.uint8)
t < i evaluates to tf.Tensor([[[False False False]]], shape=(1, 1, 3), dtype=bool) iff not (i % 256). In other words, magnitude=_MAX_LEVEL means int((level/_MAX_LEVEL) * 256) = 256, which is equivalent to 0 in tf.uint8. Given the following tf_gradient that goes from (0, 0, 0) to (255, 255, 255) in alternating directions
Both solarize(tf_gradient, 256) and solarize(tf_gradient, 0) indeed fully invert the image:
But if magnitude is 9, int((9/10) * 256) = 230, and solarize(tf_gradient, 230) "abruptly" only inverts a small portion of the image:
The text was updated successfully, but these errors were encountered:
I am not 100% sure about the intention but I do want to raise the alarm. The
solarize()
transform herebig_vision/big_vision/pp/autoaugment.py
Lines 180 to 184 in 01edb81
inverts the pixel when its value is greater or equal to the threshold, so one would think that higher augmentation magnitude needs lower threshold. However, the threshold increases linearly with magnitude:
big_vision/big_vision/pp/autoaugment.py
Line 513 in 01edb81
Counterintuitively, it still works as expected with
magnitude=_MAX_LEVEL
because of integer overflow. Givent < i
evaluates totf.Tensor([[[False False False]]], shape=(1, 1, 3), dtype=bool)
iffnot (i % 256)
. In other words,magnitude=_MAX_LEVEL
meansint((level/_MAX_LEVEL) * 256) = 256
, which is equivalent to 0 intf.uint8
. Given the followingtf_gradient
that goes from(0, 0, 0)
to(255, 255, 255)
in alternating directionsBoth
solarize(tf_gradient, 256)
andsolarize(tf_gradient, 0)
indeed fully invert the image:But if magnitude is
9
,int((9/10) * 256) = 230
, andsolarize(tf_gradient, 230)
"abruptly" only inverts a small portion of the image:The text was updated successfully, but these errors were encountered: