1

I'm using Tensorflow's 1.3 Estimator API to perform some image classification. Since I have a considerable amount of data, I gave the TFRecords a go. Saved the file and can read the examples to a Dataset using a parser function inside the input_fn of the estimator model. So far so good.

The issue is when I want to do some image augmentation (rotating and shearing in this case).

1) I tried using the tf.contrib.keras.preprocessing.image.random_shearand the likes. Turns out Keras doesn't like the format of TF's shape ('Dimension') and I can't cast it to a list because its arguments are the axis indexes not the actual value.

2) Then I tried using the tf.contrib.image.rotate and tf.contrib.image.transform with random values in my chosen range. This time I get an error of NotFoundError: Op type not registered 'ImageProjectiveTransform' in binary running on MYPC. Make sure the Op and Kernel are registered in the binary running in this process. which is an open issue (https://github.com/tensorflow/tensorflow/issues/9672). At the moment I can't move from Windows, so I would very interested in possible alternatives.

3) Searched for a way to read TFRecords and transform it to numpy array and do the augmentation with other tools, but can't find a way from within the input_fn from where I can't access the session.

Thanks!

AVCarreiro
  • 106
  • 6

1 Answers1

1

Have you tried using function from the answer to the question below?tensorflow: how to rotate an image for data augmentation?

MPękalski
  • 6,873
  • 4
  • 26
  • 36
  • Thanks for replying. I can't use the eval inside an input function to use in Estimator because I don't have access to the session, but I took the implementation for rotation in another answer and it works. Also saw a commit in the issue I mentioned correcting the Windows op registry, so it should be solved in distributed binaries as well. Sorry I can't accept this answer yet as it still misses the general transform (or shear specific function). – AVCarreiro Oct 06 '17 at 13:11
  • No worries (about accepting the answer). I was checked myself on TF 1.3.0 and was surprised that the op is available under Linux but is not under Windows. – MPękalski Oct 06 '17 at 20:25