Currently, shear_* and translate_* do wrap before transformation and unwrap after transformation. I am confused why we have to do these. Usually, when talking about shearing and translation, it is just a kind of affine transformation without doing these things.
I suppose that we previously implemented in that way is because our transform cannot select the extend mode/filling value. So we have to append an additional channel (wrap) before transformation, and check the zeros in that channel after transformation in order to replace the filling value to desired one (unwrap). Once #1721 gets merged, we could revamp the design/API.
The implementation of translate_xy is also confusing. Apart from wrap and unwrap, shouldn't translate_xy(x, [dx, dy]) is equivalent to translate(x, [dx, dy]) if replace is zero? So I think we can deprecate translate_xy after #1721 gets merged. Besides, translating [dx, 0] and then translating [0, dy] should be logically equivalent to translating [dx, dy] together unless there is some coordinate rounding issue when warping the image.
https://github.com/tensorflow/addons/blob/master/tensorflow_addons/image/translate_ops.py#L124-L125
Currently,
shear_*andtranslate_*dowrapbefore transformation andunwrapafter transformation. I am confused why we have to do these. Usually, when talking about shearing and translation, it is just a kind of affine transformation without doing these things.I suppose that we previously implemented in that way is because our
transformcannot select the extend mode/filling value. So we have to append an additional channel (wrap) before transformation, and check the zeros in that channel after transformation in order to replace the filling value to desired one (unwrap). Once #1721 gets merged, we could revamp the design/API.The implementation of translate_xy is also confusing. Apart from
wrapandunwrap, shouldn'ttranslate_xy(x, [dx, dy])is equivalent totranslate(x, [dx, dy])ifreplaceis zero? So I think we can deprecatetranslate_xyafter #1721 gets merged. Besides, translating[dx, 0]and then translating[0, dy]should be logically equivalent to translating[dx, dy]together unless there is some coordinate rounding issue when warping the image.https://github.com/tensorflow/addons/blob/master/tensorflow_addons/image/translate_ops.py#L124-L125