{
  "id": 130424,
  "title": "data augmentation",
  "url": "/competitions/flower-classification-with-tpus/discussion/130424",
  "author_name": "",
  "post_date": "2020-02-14T03:07:06.559763200Z",
  "votes": 2,
  "comment_count": 17,
  "views": 0,
  "content": "<p>Can we do data augmentation in this match?</p>",
  "messages": [
    {
      "id": "745638",
      "postDate": "02/14/2020 03:07:06",
      "content": "<p>Can we do data augmentation in this match?</p>",
      "rawMarkdown": "Can we do data augmentation in this match?",
      "votes": null
    },
    {
      "id": "745863",
      "postDate": "02/14/2020 09:48:15",
      "content": "<p>It's already defined in \"Getting started...\" notebook, see <code>data_augment</code> function.</p>",
      "rawMarkdown": "It's already defined in \"Getting started...\" notebook, see `data_augment` function.",
      "votes": null
    },
    {
      "id": "746021",
      "postDate": "02/14/2020 14:04:20",
      "content": "<p>Thanks a lot,I notice that.But there is an another question:if the number of photos increases?\nSorry for my question cause i am a newbie in image competition.</p>",
      "rawMarkdown": "Thanks a lot,I notice that.But there is an another question:if the number of photos increases?\nSorry for my question cause i am a newbie in image competition.",
      "votes": null
    },
    {
      "id": "746175",
      "postDate": "02/14/2020 17:50:59",
      "content": "<p>Yes, of course. I even think that doing class-by class data augmentation to reduce the class imbalance could be a good idea.</p>\n\n<p>As <a href=\"/atamazian\">@atamazian</a> mentioned, there is already a slot for data augmentation in the getting started notebook. It contains a very basic <code>flip_left_right</code> call.</p>\n\n<p>If you want more, there are additional image manipulation routines in <a href=\"https://www.tensorflow.org/api_docs/python/tf/image\">tf.image</a>\nAnd even more in <a href=\"https://github.com/tensorflow/addons\">tensorflow-addons</a>'s <a href=\"https://github.com/tensorflow/addons/blob/master/tensorflow_addons/image/README.md\">image processing module</a>:\n<code>\npip install tensorflow-addons as tfa\ntfa.image.*\n</code>\nA rotation by a random angle can be found in tfa for example.</p>",
      "rawMarkdown": "Yes, of course. I even think that doing class-by class data augmentation to reduce the class imbalance could be a good idea.\n\nAs @atamazian mentioned, there is already a slot for data augmentation in the getting started notebook. It contains a very basic `flip_left_right` call.\n\nIf you want more, there are additional image manipulation routines in [tf.image](https://www.tensorflow.org/api_docs/python/tf/image)\nAnd even more in [tensorflow-addons](https://github.com/tensorflow/addons)'s [image processing module](https://github.com/tensorflow/addons/blob/master/tensorflow_addons/image/README.md):\n```\npip install tensorflow-addons as tfa\ntfa.image.*\n```\nA rotation by a random angle can be found in tfa for example.",
      "votes": null
    },
    {
      "id": "749100",
      "postDate": "02/18/2020 09:46:07",
      "content": "<p>Did anyone tried tensorflow-addons yet? I tried it a bit, but the kernel gave me an error message.\nAlso I noticed that this error message only exist when I using TPU. GPU and CPU are okay.\nAnother thing is that error message is different in kaggle and colab.</p>\n\n<p>Simple version of my code, which tested in both kaggle and colab.\n<code>def rotate_image(x, label):</code>\n       <code>return tfa.image.rotate(x, 0.57), label</code>\n<code>\n</code>\n<code>def _decoded_image(image_data):</code>\n<code>image = tf.image.decode_jpeg(image_data, channels=3)</code>\n<code>image = tf.reshape(image, [512, 512, 3])</code>\n<code>return tf.cast(image, tf.float32) / 255.0</code>\n<code>\n</code> <br>\n<code>def read_labeled_tfrecord(example):</code>\n<code>feature_format = {</code>\n<code>\"image\" : tf.io.FixedLenFeature([], tf.string),</code>\n<code>\"class\" : tf.io.FixedLenFeature([], tf.int64) }</code>\n<code>example = tf.io.parse_single_example(example, feature_format)</code>\n<code>image = _decoded_image(example['image'])</code>\n<code>label = example['class']</code>\n<code>return image, label</code>\n<code>\n</code>\n<code>ds = tf.data.TFRecordDataset(TRAIN_FNS)</code>\n<code>ds = ds.map(read_labeled_tfrecord)</code>\n<code>ds = ds.batch(1)</code>\n<code>ds = ds.map(rotate_image)</code></p>",
      "rawMarkdown": "Did anyone tried tensorflow-addons yet? I tried it a bit, but the kernel gave me an error message.\nAlso I noticed that this error message only exist when I using TPU. GPU and CPU are okay.\nAnother thing is that error message is different in kaggle and colab.\n\nSimple version of my code, which tested in both kaggle and colab.\n`def rotate_image(x, label):`\n       ` return tfa.image.rotate(x, 0.57), label`\n``\n``\n`def _decoded_image(image_data):`\n`        image = tf.image.decode_jpeg(image_data, channels=3)`\n`        image = tf.reshape(image, [512, 512, 3])`\n`        return tf.cast(image, tf.float32) / 255.0`\n``\n``    \n`def read_labeled_tfrecord(example):`\n`        feature_format = {`\n`            \"image\" : tf.io.FixedLenFeature([], tf.string),`\n`            \"class\" : tf.io.FixedLenFeature([], tf.int64) }`\n`        example = tf.io.parse_single_example(example, feature_format)`\n`        image = _decoded_image(example['image'])`\n`        label = example['class'] `\n`        return image, label`\n``\n``\n`ds = tf.data.TFRecordDataset(TRAIN_FNS)`\n`ds = ds.map(read_labeled_tfrecord)`\n`ds = ds.batch(1)`\n`ds = ds.map(rotate_image)`",
      "votes": null
    },
    {
      "id": "749104",
      "postDate": "02/18/2020 09:50:18",
      "content": "<p>Error message I got from colab:</p>\n\n<blockquote>\n  <p>Op type not registered 'Addons&gt;ImageProjectiveTransformV2' in binary running on n-9193e5ce-w-0. Make sure the Op and Kernel are registered in the binary running in this process. Note that if you are loading a saved graph which used ops from tf.contrib, accessing (e.g.) <code>tf.contrib.resampler</code> should be done before importing the graph, as contrib ops are lazily registered when the module is first accessed.</p>\n</blockquote>",
      "rawMarkdown": "Error message I got from colab:\n&gt; Op type not registered 'Addons&gt;ImageProjectiveTransformV2' in binary running on n-9193e5ce-w-0. Make sure the Op and Kernel are registered in the binary running in this process. Note that if you are loading a saved graph which used ops from tf.contrib, accessing (e.g.) `tf.contrib.resampler` should be done before importing the graph, as contrib ops are lazily registered when the module is first accessed.",
      "votes": null
    },
    {
      "id": "749108",
      "postDate": "02/18/2020 09:51:30",
      "content": "<p>Error message I got from kaggle:</p>\n\n<blockquote>\n  <p>NotFoundError: /opt/conda/lib/python3.6/site-packages/tensorflow_addons/custom_ops/image/_image_ops.so: undefined symbol:_ZNK10tensorflow15shape_inference16InferenceContext11DebugStringEv</p>\n</blockquote>",
      "rawMarkdown": "Error message I got from kaggle:\n&gt; NotFoundError: /opt/conda/lib/python3.6/site-packages/tensorflow_addons/custom_ops/image/_image_ops.so: undefined symbol:_ZNK10tensorflow15shape_inference16InferenceContext11DebugStringEv",
      "votes": null
    },
    {
      "id": "749336",
      "postDate": "02/18/2020 15:42:54",
      "content": "<p><a href=\"/xiejialun\">@xiejialun</a> , I've used <code>tensorflow-addons</code> for optimizers, and it worked ok for me, but I'll try data augmentation soon.</p>",
      "rawMarkdown": "xiejialun , I've used `tensorflow-addons` for optimizers, and it worked ok for me, but I'll try data augmentation soon.",
      "votes": null
    },
    {
      "id": "749781",
      "postDate": "02/18/2020 22:33:09",
      "content": "<p>In the tf.data.Dataset API, use:\n<code>tf.data.Dataset.map()</code> for one to one transformations\n<code>tf.data.Dataset.flat_map()</code> for one to many transformations</p>",
      "rawMarkdown": "In the tf.data.Dataset API, use:\n`tf.data.Dataset.map()` for one to one transformations\n`tf.data.Dataset.flat_map()` for one to many transformations",
      "votes": null
    },
    {
      "id": "749784",
      "postDate": "02/18/2020 22:35:27",
      "content": "<p>uh-oh, not good. Let me check.</p>",
      "rawMarkdown": "uh-oh, not good. Let me check.",
      "votes": null
    },
    {
      "id": "749867",
      "postDate": "02/19/2020 00:30:51",
      "content": "<p><a href=\"/dimitreoliveira\">@dimitreoliveira</a> Yes, I also used optimizer from tfa, it is okay.\n<a href=\"/mgornergoogle\">@mgornergoogle</a> Thanks a lot for the help! </p>",
      "rawMarkdown": "dimitreoliveira Yes, I also used optimizer from tfa, it is okay.\n@mgornergoogle Thanks a lot for the help!",
      "votes": null
    },
    {
      "id": "751121",
      "postDate": "02/20/2020 02:26:47",
      "content": "<p>I found a related issue here: <a href=\"https://github.com/tensorflow/addons/issues/987\">https://github.com/tensorflow/addons/issues/987</a>\nIt looks like we will have to add tensorflow-addons to the Kaggle docker image on the Kaggle side to work around this issue. Or wait for the \"RFC 133\" to land.</p>",
      "rawMarkdown": "I found a related issue here: https://github.com/tensorflow/addons/issues/987\nIt looks like we will have to add tensorflow-addons to the Kaggle docker image on the Kaggle side to work around this issue. Or wait for the \"RFC 133\" to land.",
      "votes": null
    },
    {
      "id": "751156",
      "postDate": "02/20/2020 03:16:27",
      "content": "<p><a href=\"/mgornergoogle\">@mgornergoogle</a> Thank you so much for the information and help! Seems like implementing augmentation functions by myself will be an easier way to go.</p>",
      "rawMarkdown": "mgornergoogle Thank you so much for the information and help! Seems like implementing augmentation functions by myself will be an easier way to go.",
      "votes": null
    },
    {
      "id": "753135",
      "postDate": "02/21/2020 18:48:14",
      "content": "<p>What about using an augmentation library like albumentations ? Is it possible ?</p>",
      "rawMarkdown": "What about using an augmentation library like albumentations ? Is it possible ?",
      "votes": null
    },
    {
      "id": "755446",
      "postDate": "02/24/2020 19:26:54",
      "content": "<p>Probably not. The TPU does not run your Python code. It runs your Tensorflow graph. Only libraries written with Tensorflow operations will run. It is possible to transform Python code into a TF graph using <a href=\"https://www.tensorflow.org/api_docs/python/tf/function\">@tf.function</a> but there are limitations and I don't think it will work for a large library.</p>",
      "rawMarkdown": "Probably not. The TPU does not run your Python code. It runs your Tensorflow graph. Only libraries written with Tensorflow operations will run. It is possible to transform Python code into a TF graph using [@tf.function](https://www.tensorflow.org/api_docs/python/tf/function) but there are limitations and I don't think it will work for a large library.",
      "votes": null
    },
    {
      "id": "755463",
      "postDate": "02/24/2020 19:49:50",
      "content": "<p>Yes but you must perform your augmentation on the GPU/TPU and not the CPU.</p>\n\n<p>I posted a starter notebook showing how to do rotation, shear, zoom, and shift augmentation using GPU/TPU and TensorFlow <a href=\"https://www.kaggle.com/cdeotte/rotation-augmentation-gpu-tpu-0-96\">here</a>. And a discussion <a href=\"https://www.kaggle.com/c/flower-classification-with-tpus/discussion/132191\">here</a>.</p>",
      "rawMarkdown": "Yes but you must perform your augmentation on the GPU/TPU and not the CPU.\n\nI posted a starter notebook showing how to do rotation, shear, zoom, and shift augmentation using GPU/TPU and TensorFlow [here][2]. And a discussion [here][1].\n\n[1]: https://www.kaggle.com/c/flower-classification-with-tpus/discussion/132191\n[2]: https://www.kaggle.com/cdeotte/rotation-augmentation-gpu-tpu-0-96",
      "votes": null
    },
    {
      "id": "755678",
      "postDate": "02/25/2020 02:40:51",
      "content": "<p>Thanks a lot!</p>",
      "rawMarkdown": "Thanks a lot!",
      "votes": null
    },
    {
      "id": "959314",
      "postDate": "08/05/2020 13:47:35",
      "content": "<p><a href=\"/mgornergoogle\">@mgornergoogle</a> - Does this issue still exist ?\nWill tfa.image.rotate now work in kaggle TF without any issue - Checking because it has been 6 months and a lot of code is being written to make rotation work. Thanks.</p>",
      "rawMarkdown": "mgornergoogle - Does this issue still exist ?\nWill tfa.image.rotate now work in kaggle TF without any issue - Checking because it has been 6 months and a lot of code is being written to make rotation work. Thanks.",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 745863,
      "author_name": "atamazian",
      "author_url": "",
      "post_date": "02/14/2020 09:48:15",
      "content": "<p>It's already defined in \"Getting started...\" notebook, see <code>data_augment</code> function.</p>",
      "votes": null,
      "replies": [
        {
          "id": 746021,
          "author_name": "dengxx",
          "author_url": "",
          "post_date": "02/14/2020 14:04:20",
          "content": "<p>Thanks a lot,I notice that.But there is an another question:if the number of photos increases?\nSorry for my question cause i am a newbie in image competition.</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 749781,
          "author_name": "mgorner",
          "author_url": "",
          "post_date": "02/18/2020 22:33:09",
          "content": "<p>In the tf.data.Dataset API, use:\n<code>tf.data.Dataset.map()</code> for one to one transformations\n<code>tf.data.Dataset.flat_map()</code> for one to many transformations</p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 746175,
      "author_name": "mgorner",
      "author_url": "",
      "post_date": "02/14/2020 17:50:59",
      "content": "<p>Yes, of course. I even think that doing class-by class data augmentation to reduce the class imbalance could be a good idea.</p>\n\n<p>As <a href=\"/atamazian\">@atamazian</a> mentioned, there is already a slot for data augmentation in the getting started notebook. It contains a very basic <code>flip_left_right</code> call.</p>\n\n<p>If you want more, there are additional image manipulation routines in <a href=\"https://www.tensorflow.org/api_docs/python/tf/image\">tf.image</a>\nAnd even more in <a href=\"https://github.com/tensorflow/addons\">tensorflow-addons</a>'s <a href=\"https://github.com/tensorflow/addons/blob/master/tensorflow_addons/image/README.md\">image processing module</a>:\n<code>\npip install tensorflow-addons as tfa\ntfa.image.*\n</code>\nA rotation by a random angle can be found in tfa for example.</p>",
      "votes": null,
      "replies": [
        {
          "id": 749100,
          "author_name": "xiejialun",
          "author_url": "",
          "post_date": "02/18/2020 09:46:07",
          "content": "<p>Did anyone tried tensorflow-addons yet? I tried it a bit, but the kernel gave me an error message.\nAlso I noticed that this error message only exist when I using TPU. GPU and CPU are okay.\nAnother thing is that error message is different in kaggle and colab.</p>\n\n<p>Simple version of my code, which tested in both kaggle and colab.\n<code>def rotate_image(x, label):</code>\n       <code>return tfa.image.rotate(x, 0.57), label</code>\n<code>\n</code>\n<code>def _decoded_image(image_data):</code>\n<code>image = tf.image.decode_jpeg(image_data, channels=3)</code>\n<code>image = tf.reshape(image, [512, 512, 3])</code>\n<code>return tf.cast(image, tf.float32) / 255.0</code>\n<code>\n</code> <br>\n<code>def read_labeled_tfrecord(example):</code>\n<code>feature_format = {</code>\n<code>\"image\" : tf.io.FixedLenFeature([], tf.string),</code>\n<code>\"class\" : tf.io.FixedLenFeature([], tf.int64) }</code>\n<code>example = tf.io.parse_single_example(example, feature_format)</code>\n<code>image = _decoded_image(example['image'])</code>\n<code>label = example['class']</code>\n<code>return image, label</code>\n<code>\n</code>\n<code>ds = tf.data.TFRecordDataset(TRAIN_FNS)</code>\n<code>ds = ds.map(read_labeled_tfrecord)</code>\n<code>ds = ds.batch(1)</code>\n<code>ds = ds.map(rotate_image)</code></p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 749104,
          "author_name": "xiejialun",
          "author_url": "",
          "post_date": "02/18/2020 09:50:18",
          "content": "<p>Error message I got from colab:</p>\n\n<blockquote>\n  <p>Op type not registered 'Addons&gt;ImageProjectiveTransformV2' in binary running on n-9193e5ce-w-0. Make sure the Op and Kernel are registered in the binary running in this process. Note that if you are loading a saved graph which used ops from tf.contrib, accessing (e.g.) <code>tf.contrib.resampler</code> should be done before importing the graph, as contrib ops are lazily registered when the module is first accessed.</p>\n</blockquote>",
          "votes": null,
          "replies": []
        },
        {
          "id": 749108,
          "author_name": "xiejialun",
          "author_url": "",
          "post_date": "02/18/2020 09:51:30",
          "content": "<p>Error message I got from kaggle:</p>\n\n<blockquote>\n  <p>NotFoundError: /opt/conda/lib/python3.6/site-packages/tensorflow_addons/custom_ops/image/_image_ops.so: undefined symbol:_ZNK10tensorflow15shape_inference16InferenceContext11DebugStringEv</p>\n</blockquote>",
          "votes": null,
          "replies": []
        },
        {
          "id": 749336,
          "author_name": "dimitreoliveira",
          "author_url": "",
          "post_date": "02/18/2020 15:42:54",
          "content": "<p><a href=\"/xiejialun\">@xiejialun</a> , I've used <code>tensorflow-addons</code> for optimizers, and it worked ok for me, but I'll try data augmentation soon.</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 749784,
          "author_name": "mgorner",
          "author_url": "",
          "post_date": "02/18/2020 22:35:27",
          "content": "<p>uh-oh, not good. Let me check.</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 749867,
          "author_name": "xiejialun",
          "author_url": "",
          "post_date": "02/19/2020 00:30:51",
          "content": "<p><a href=\"/dimitreoliveira\">@dimitreoliveira</a> Yes, I also used optimizer from tfa, it is okay.\n<a href=\"/mgornergoogle\">@mgornergoogle</a> Thanks a lot for the help! </p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 751121,
          "author_name": "mgorner",
          "author_url": "",
          "post_date": "02/20/2020 02:26:47",
          "content": "<p>I found a related issue here: <a href=\"https://github.com/tensorflow/addons/issues/987\">https://github.com/tensorflow/addons/issues/987</a>\nIt looks like we will have to add tensorflow-addons to the Kaggle docker image on the Kaggle side to work around this issue. Or wait for the \"RFC 133\" to land.</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 751156,
          "author_name": "xiejialun",
          "author_url": "",
          "post_date": "02/20/2020 03:16:27",
          "content": "<p><a href=\"/mgornergoogle\">@mgornergoogle</a> Thank you so much for the information and help! Seems like implementing augmentation functions by myself will be an easier way to go.</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 959314,
          "author_name": "watzisname",
          "author_url": "",
          "post_date": "08/05/2020 13:47:35",
          "content": "<p><a href=\"/mgornergoogle\">@mgornergoogle</a> - Does this issue still exist ?\nWill tfa.image.rotate now work in kaggle TF without any issue - Checking because it has been 6 months and a lot of code is being written to make rotation work. Thanks.</p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 753135,
      "author_name": "ibrahimsherify",
      "author_url": "",
      "post_date": "02/21/2020 18:48:14",
      "content": "<p>What about using an augmentation library like albumentations ? Is it possible ?</p>",
      "votes": null,
      "replies": [
        {
          "id": 755446,
          "author_name": "mgorner",
          "author_url": "",
          "post_date": "02/24/2020 19:26:54",
          "content": "<p>Probably not. The TPU does not run your Python code. It runs your Tensorflow graph. Only libraries written with Tensorflow operations will run. It is possible to transform Python code into a TF graph using <a href=\"https://www.tensorflow.org/api_docs/python/tf/function\">@tf.function</a> but there are limitations and I don't think it will work for a large library.</p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 755463,
      "author_name": "cdeotte",
      "author_url": "",
      "post_date": "02/24/2020 19:49:50",
      "content": "<p>Yes but you must perform your augmentation on the GPU/TPU and not the CPU.</p>\n\n<p>I posted a starter notebook showing how to do rotation, shear, zoom, and shift augmentation using GPU/TPU and TensorFlow <a href=\"https://www.kaggle.com/cdeotte/rotation-augmentation-gpu-tpu-0-96\">here</a>. And a discussion <a href=\"https://www.kaggle.com/c/flower-classification-with-tpus/discussion/132191\">here</a>.</p>",
      "votes": null,
      "replies": [
        {
          "id": 755678,
          "author_name": "dxxhhh",
          "author_url": "",
          "post_date": "02/25/2020 02:40:51",
          "content": "<p>Thanks a lot!</p>",
          "votes": null,
          "replies": []
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "745638": "Can we do data augmentation in this match?",
    "745863": "It's already defined in \"Getting started...\" notebook, see `data_augment` function.",
    "746021": "Thanks a lot,I notice that.But there is an another question:if the number of photos increases?\nSorry for my question cause i am a newbie in image competition.",
    "746175": "Yes, of course. I even think that doing class-by class data augmentation to reduce the class imbalance could be a good idea.\n\nAs @atamazian mentioned, there is already a slot for data augmentation in the getting started notebook. It contains a very basic `flip_left_right` call.\n\nIf you want more, there are additional image manipulation routines in [tf.image](https://www.tensorflow.org/api_docs/python/tf/image)\nAnd even more in [tensorflow-addons](https://github.com/tensorflow/addons)'s [image processing module](https://github.com/tensorflow/addons/blob/master/tensorflow_addons/image/README.md):\n```\npip install tensorflow-addons as tfa\ntfa.image.*\n```\nA rotation by a random angle can be found in tfa for example.",
    "749100": "Did anyone tried tensorflow-addons yet? I tried it a bit, but the kernel gave me an error message.\nAlso I noticed that this error message only exist when I using TPU. GPU and CPU are okay.\nAnother thing is that error message is different in kaggle and colab.\n\nSimple version of my code, which tested in both kaggle and colab.\n`def rotate_image(x, label):`\n       ` return tfa.image.rotate(x, 0.57), label`\n``\n``\n`def _decoded_image(image_data):`\n`        image = tf.image.decode_jpeg(image_data, channels=3)`\n`        image = tf.reshape(image, [512, 512, 3])`\n`        return tf.cast(image, tf.float32) / 255.0`\n``\n``    \n`def read_labeled_tfrecord(example):`\n`        feature_format = {`\n`            \"image\" : tf.io.FixedLenFeature([], tf.string),`\n`            \"class\" : tf.io.FixedLenFeature([], tf.int64) }`\n`        example = tf.io.parse_single_example(example, feature_format)`\n`        image = _decoded_image(example['image'])`\n`        label = example['class'] `\n`        return image, label`\n``\n``\n`ds = tf.data.TFRecordDataset(TRAIN_FNS)`\n`ds = ds.map(read_labeled_tfrecord)`\n`ds = ds.batch(1)`\n`ds = ds.map(rotate_image)`",
    "749104": "Error message I got from colab:\n&gt; Op type not registered 'Addons&gt;ImageProjectiveTransformV2' in binary running on n-9193e5ce-w-0. Make sure the Op and Kernel are registered in the binary running in this process. Note that if you are loading a saved graph which used ops from tf.contrib, accessing (e.g.) `tf.contrib.resampler` should be done before importing the graph, as contrib ops are lazily registered when the module is first accessed.",
    "749108": "Error message I got from kaggle:\n&gt; NotFoundError: /opt/conda/lib/python3.6/site-packages/tensorflow_addons/custom_ops/image/_image_ops.so: undefined symbol:_ZNK10tensorflow15shape_inference16InferenceContext11DebugStringEv",
    "749336": "xiejialun , I've used `tensorflow-addons` for optimizers, and it worked ok for me, but I'll try data augmentation soon.",
    "749781": "In the tf.data.Dataset API, use:\n`tf.data.Dataset.map()` for one to one transformations\n`tf.data.Dataset.flat_map()` for one to many transformations",
    "749784": "uh-oh, not good. Let me check.",
    "749867": "dimitreoliveira Yes, I also used optimizer from tfa, it is okay.\n@mgornergoogle Thanks a lot for the help!",
    "751121": "I found a related issue here: https://github.com/tensorflow/addons/issues/987\nIt looks like we will have to add tensorflow-addons to the Kaggle docker image on the Kaggle side to work around this issue. Or wait for the \"RFC 133\" to land.",
    "751156": "mgornergoogle Thank you so much for the information and help! Seems like implementing augmentation functions by myself will be an easier way to go.",
    "753135": "What about using an augmentation library like albumentations ? Is it possible ?",
    "755446": "Probably not. The TPU does not run your Python code. It runs your Tensorflow graph. Only libraries written with Tensorflow operations will run. It is possible to transform Python code into a TF graph using [@tf.function](https://www.tensorflow.org/api_docs/python/tf/function) but there are limitations and I don't think it will work for a large library.",
    "755463": "Yes but you must perform your augmentation on the GPU/TPU and not the CPU.\n\nI posted a starter notebook showing how to do rotation, shear, zoom, and shift augmentation using GPU/TPU and TensorFlow [here][2]. And a discussion [here][1].\n\n[1]: https://www.kaggle.com/c/flower-classification-with-tpus/discussion/132191\n[2]: https://www.kaggle.com/cdeotte/rotation-augmentation-gpu-tpu-0-96",
    "755678": "Thanks a lot!",
    "959314": "mgornergoogle - Does this issue still exist ?\nWill tfa.image.rotate now work in kaggle TF without any issue - Checking because it has been 6 months and a lot of code is being written to make rotation work. Thanks."
  },
  "source": "meta"
}