dm_pix icon indicating copy to clipboard operation
dm_pix copied to clipboard

random_flip_left_right does not support HWC

Open Logon27 opened this issue 5 months ago • 1 comments

https://dm-pix.readthedocs.io/en/latest/api.html#random-flip-left-right Despite being documented to say so, there is no way to actually pass in the channel_axis to this function. So you cannot set the image format to be HWC. Please correct me if I am wrong.

Logon27 avatar Sep 10 '25 01:09 Logon27

Hi @Logon27, thanks for reaching out 😄

So the function here https://github.com/google-deepmind/dm_pix/blob/ae478298f3dc6f611fb968fe2e831e8c9925b243/dm_pix/_src/augment.py#L788 calls flip_left_right in its default mode which is this one https://github.com/google-deepmind/dm_pix/blob/ae478298f3dc6f611fb968fe2e831e8c9925b243/dm_pix/_src/augment.py#L415-L419 hence it is assumed that the image is of shape ...HWC.

There's indeed a missing piping, and that's true for all random functions actually.

Feel free to submit a PR with the changes and some test coverage if you want to!

claudiofantacci avatar Sep 10 '25 10:09 claudiofantacci