Reputation: 93
I want to do some serious image augmentations on my own dataset because it is really small. Tensorflow provides the image library to do all the augmentation, which is very convenient. But there is no "rotation" functionality. I know there is an issue tracked here, but it is so long and looks complicated. Is there any simple way/function to do image rotation in tensorflow? thank you very much.
Upvotes: 1
Views: 1105
Reputation: 3148
I was looking for the same thing - by now this is implemented in Tensorflow as:
tf.contrib.image.rotate(images,
angles,
interpolation='NEAREST')
See doc (r1.4) here.
Upvotes: 1
Reputation: 1637
If you want to use your own image rotation, you could probably do that with py_func, PIL and your own queue processor. Alternatively, you could write your own queue to feed examples. Another ugly way, is to atomically (write + rename) rotate these images and write them on disk with the same filename, while the training is going on.
Whatever you do, remember that we train in batches, so make sure you serve rotations one at a time, not all variants of the same image contiguously (shuffle(rotations([image])
is not rotations(shuffle([image]))
), otherwise training will misbehave.
Upvotes: 2