{
  "id": 171318,
  "title": "[tf.keras users] TTA wrapper of qubvel",
  "url": "/competitions/siim-isic-melanoma-classification/discussion/171318",
  "author_name": "",
  "post_date": "2020-07-31T09:58:22.030521400Z",
  "votes": 3,
  "comment_count": 2,
  "views": 0,
  "content": "<p>We've just added the last section, TTA in this <a href=\"https://www.kaggle.com/ipythonx/tf-keras-melanoma-classification-starter-tabnet\">notebook</a>. <a href=\"/pavel92\">@pavel92</a> 's <a href=\"https://github.com/qubvel/tta_wrapper\">TTA wrapper</a> for keras has been used. The <code>tensorflow 2.x</code> upgraded scripts can be found from the following. Just sharing if any <code>tf.keras</code> user finds it useful.</p>\n\n<ul>\n<li><a href=\"https://www.kaggle.com/ipythonx/keras-tta-wrapper\">TF.Keras TTA Wrapper</a></li>\n</ul>\n\n<p><code>\nsys.path.insert(0, \"/kaggle/input/keras-tta-wrapper\")\ntta_model = tta_classification(model, h_flip=True, v_flip=True, rotation=(90,270), h_shift=(-5, 5), merge='mean')\n</code></p>\n\n<p><strong>Cons</strong>:\n- need to set <code>batch size = 1</code> while inferencing \n- few more augmentation leads an hour to complete just on one fold</p>\n\n<hr>\n\n<p>Thanks, <a href=\"/pavel92\">@pavel92</a> for this nice wrapper. =)</p>",
  "messages": [
    {
      "id": "952904",
      "postDate": "07/31/2020 09:58:22",
      "content": "<p>We've just added the last section, TTA in this <a href=\"https://www.kaggle.com/ipythonx/tf-keras-melanoma-classification-starter-tabnet\">notebook</a>. <a href=\"/pavel92\">@pavel92</a> 's <a href=\"https://github.com/qubvel/tta_wrapper\">TTA wrapper</a> for keras has been used. The <code>tensorflow 2.x</code> upgraded scripts can be found from the following. Just sharing if any <code>tf.keras</code> user finds it useful.</p>\n\n<ul>\n<li><a href=\"https://www.kaggle.com/ipythonx/keras-tta-wrapper\">TF.Keras TTA Wrapper</a></li>\n</ul>\n\n<p><code>\nsys.path.insert(0, \"/kaggle/input/keras-tta-wrapper\")\ntta_model = tta_classification(model, h_flip=True, v_flip=True, rotation=(90,270), h_shift=(-5, 5), merge='mean')\n</code></p>\n\n<p><strong>Cons</strong>:\n- need to set <code>batch size = 1</code> while inferencing \n- few more augmentation leads an hour to complete just on one fold</p>\n\n<hr>\n\n<p>Thanks, <a href=\"/pavel92\">@pavel92</a> for this nice wrapper. =)</p>",
      "rawMarkdown": "We've just added the last section, TTA in this [notebook](https://www.kaggle.com/ipythonx/tf-keras-melanoma-classification-starter-tabnet). @pavel92 's [TTA wrapper](https://github.com/qubvel/tta_wrapper) for keras has been used. The `tensorflow 2.x` upgraded scripts can be found from the following. Just sharing if any `tf.keras` user finds it useful.\n\n- [TF.Keras TTA Wrapper](https://www.kaggle.com/ipythonx/keras-tta-wrapper)\n\n```\nsys.path.insert(0, \"/kaggle/input/keras-tta-wrapper\")\ntta_model = tta_classification(model, h_flip=True, v_flip=True, rotation=(90,270), h_shift=(-5, 5), merge='mean')\n```\n\n**Cons**:\n- need to set `batch size = 1` while inferencing \n- few more augmentation leads an hour to complete just on one fold\n\n---\n\nThanks, @pavel92 for this nice wrapper. =)",
      "votes": null
    },
    {
      "id": "954679",
      "postDate": "08/02/2020 01:58:47",
      "content": "<p>This is a great library, I've used it before. Thanks for the link. However in this comp, you can get faster TTA by using your <code>tf.data.Dataset</code> augmentation repeatedly and inferring with a large batch size instead of batch size = 1.</p>",
      "rawMarkdown": "This is a great library, I've used it before. Thanks for the link. However in this comp, you can get faster TTA by using your `tf.data.Dataset` augmentation repeatedly and inferring with a large batch size instead of batch size = 1.",
      "votes": null
    },
    {
      "id": "954926",
      "postDate": "08/02/2020 07:47:38",
      "content": "<p><a href=\"/cdeotte\">@cdeotte</a>, agree with you. I've just used it to try it out. I didn't try this wrapper before. I also believe the <code>tf.data.Dataset</code> augmentation is much more suitable. </p>",
      "rawMarkdown": "cdeotte, agree with you. I've just used it to try it out. I didn't try this wrapper before. I also believe the `tf.data.Dataset` augmentation is much more suitable.",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 954679,
      "author_name": "cdeotte",
      "author_url": "",
      "post_date": "08/02/2020 01:58:47",
      "content": "<p>This is a great library, I've used it before. Thanks for the link. However in this comp, you can get faster TTA by using your <code>tf.data.Dataset</code> augmentation repeatedly and inferring with a large batch size instead of batch size = 1.</p>",
      "votes": null,
      "replies": [
        {
          "id": 954926,
          "author_name": "ipythonx",
          "author_url": "",
          "post_date": "08/02/2020 07:47:38",
          "content": "<p><a href=\"/cdeotte\">@cdeotte</a>, agree with you. I've just used it to try it out. I didn't try this wrapper before. I also believe the <code>tf.data.Dataset</code> augmentation is much more suitable. </p>",
          "votes": null,
          "replies": []
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "952904": "We've just added the last section, TTA in this [notebook](https://www.kaggle.com/ipythonx/tf-keras-melanoma-classification-starter-tabnet). @pavel92 's [TTA wrapper](https://github.com/qubvel/tta_wrapper) for keras has been used. The `tensorflow 2.x` upgraded scripts can be found from the following. Just sharing if any `tf.keras` user finds it useful.\n\n- [TF.Keras TTA Wrapper](https://www.kaggle.com/ipythonx/keras-tta-wrapper)\n\n```\nsys.path.insert(0, \"/kaggle/input/keras-tta-wrapper\")\ntta_model = tta_classification(model, h_flip=True, v_flip=True, rotation=(90,270), h_shift=(-5, 5), merge='mean')\n```\n\n**Cons**:\n- need to set `batch size = 1` while inferencing \n- few more augmentation leads an hour to complete just on one fold\n\n---\n\nThanks, @pavel92 for this nice wrapper. =)",
    "954679": "This is a great library, I've used it before. Thanks for the link. However in this comp, you can get faster TTA by using your `tf.data.Dataset` augmentation repeatedly and inferring with a large batch size instead of batch size = 1.",
    "954926": "cdeotte, agree with you. I've just used it to try it out. I didn't try this wrapper before. I also believe the `tf.data.Dataset` augmentation is much more suitable."
  },
  "source": "meta"
}