{
  "id": 211124,
  "title": "Data Augmentation",
  "url": "/competitions/digit-recognizer/discussion/211124",
  "author_name": "AKSHAY KUMAR",
  "post_date": "2021-01-13T17:44:23.006000",
  "votes": 6,
  "comment_count": 4,
  "views": null,
  "content": "<p>What kind of augmentation cannot be used in MNIST </p>",
  "messages": [
    {
      "id": 1152017,
      "postDate": "2021-01-13T17:44:23.007Z",
      "content": "<p>What kind of augmentation cannot be used in MNIST </p>",
      "rawMarkdown": "What kind of augmentation cannot be used in MNIST ",
      "votes": 6
    },
    {
      "id": 1152906,
      "postDate": "2021-01-14T14:57:15.080Z",
      "content": "<p>In rotation_range parameter can 90 value cause problems ? <br>\nVertical_flip can be used ?</p>",
      "rawMarkdown": "In rotation_range parameter can 90 value cause problems ? \nVertical_flip can be used ?",
      "votes": 2,
      "replies": [
        {
          "id": 1152930,
          "postDate": "2021-01-14T15:05:05.897Z",
          "content": "<p>I think that using bigger values doesn't make sense, think it this way. If you set rotation_range to 90 degrees you are training your model to recognize numbers that are with a different orientation, when in the environment you are going to use it all images are oriented in the same way. </p>\n<p>On the other hand, vertical flipping is similar to setting your rotation degree to 180, it can give you problems with some numbers.</p>\n<p>I would recommend you thinking about the consequences of fixing that parameters with a big value, that way you can understand the type of data you will be using with your models.</p>",
          "rawMarkdown": "I think that using bigger values doesn't make sense, think it this way. If you set rotation_range to 90 degrees you are training your model to recognize numbers that are with a different orientation, when in the environment you are going to use it all images are oriented in the same way. \n\nOn the other hand, vertical flipping is similar to setting your rotation degree to 180, it can give you problems with some numbers.\n\nI would recommend you thinking about the consequences of fixing that parameters with a big value, that way you can understand the type of data you will be using with your models.",
          "votes": 1
        }
      ]
    },
    {
      "id": 1152175,
      "postDate": "2021-01-13T22:08:07.570Z",
      "content": "<p>You can use any kind of the data augmentation properties with the MNIST dataset. However, I would recommend you that some parameters should be fixed within a range or even disabled. For example, using the <code>ImageDataGenerator</code> from Keras:</p>\n<ul>\n<li>I would fix the <code>rotation_range</code> parameter into a value between 0 and 30. If you use a really big value like 180 you may create confusion between 9 and 6.</li>\n<li>I would also disable the <code>horizontal_flip</code> parameter, it may also create confusion with other numbers like 5 and 2. </li>\n</ul>\n<p>Hope it helps!</p>",
      "rawMarkdown": "You can use any kind of the data augmentation properties with the MNIST dataset. However, I would recommend you that some parameters should be fixed within a range or even disabled. For example, using the `ImageDataGenerator` from Keras:\n\n- I would fix the `rotation_range` parameter into a value between 0 and 30. If you use a really big value like 180 you may create confusion between 9 and 6.\n- I would also disable the `horizontal_flip` parameter, it may also create confusion with other numbers like 5 and 2. \n\nHope it helps!",
      "votes": 2
    },
    {
      "id": 1153381,
      "postDate": "2021-01-14T20:52:00.810Z",
      "content": "<p><a href=\"https://www.kaggle.com/legendsplay\" target=\"_blank\">@legendsplay</a> as <a href=\"https://www.kaggle.com/fedesoriano\" target=\"_blank\">@fedesoriano</a> mentioned, some rotations or flips may not make sense as per your data augmentation. I think it would help to take a look at what your classifier is getting wrong to help guide what augmentations you may want to use. For example, I took a look at one of my own classifiers and found the following:</p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F2051313%2F9159ee3487a5c52e620d3f36a0ea1b63%2Fconfusion_matrix.png?generation=1610656498177252&amp;alt=media\" alt=\"\"></p>\n<p>You can see from the above that 9 and 6 are not being at all confused (true label 6 is never predicted as being 9, and true label 9 is never predicted as being 6). However, 9 is being mistaken for 4 and 7 a lot. So, I pulled up all examples of the digit 9 that were being mis-labelled:</p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F2051313%2F6002ce20e1c26475e34988f5f08d0e6b%2Fmislabelled_9.png?generation=1610656966191290&amp;alt=media\" alt=\"\"></p>\n<p>As you can see, some images do indeed look like a 4, and some like a 7, which is why they are being mis-labelled. The question for the remainder is what augmentations are going to help? Slight rotations and skews may help if you have training examples that look very similar to those mis-labels, but are in a different orientation. There are some instances in the above however, that suggest things like varying stroke weight may help. Again, looking at your mis-labelled examples may help you determine what augmentations may yield better results.</p>\n<p>If you want code examples on how to pick up what your classifier has mis-labelled, feel free to check out:</p>\n<ul>\n<li><a href=\"https://www.kaggle.com/craigmthomas/beginner-guide-to-digit-recognition-part-2\" target=\"_blank\">https://www.kaggle.com/craigmthomas/beginner-guide-to-digit-recognition-part-2</a></li>\n</ul>",
      "rawMarkdown": "@legendsplay as @fedesoriano mentioned, some rotations or flips may not make sense as per your data augmentation. I think it would help to take a look at what your classifier is getting wrong to help guide what augmentations you may want to use. For example, I took a look at one of my own classifiers and found the following:\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F2051313%2F9159ee3487a5c52e620d3f36a0ea1b63%2Fconfusion_matrix.png?generation=1610656498177252&alt=media)\n\nYou can see from the above that 9 and 6 are not being at all confused (true label 6 is never predicted as being 9, and true label 9 is never predicted as being 6). However, 9 is being mistaken for 4 and 7 a lot. So, I pulled up all examples of the digit 9 that were being mis-labelled:\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F2051313%2F6002ce20e1c26475e34988f5f08d0e6b%2Fmislabelled_9.png?generation=1610656966191290&alt=media)\n\nAs you can see, some images do indeed look like a 4, and some like a 7, which is why they are being mis-labelled. The question for the remainder is what augmentations are going to help? Slight rotations and skews may help if you have training examples that look very similar to those mis-labels, but are in a different orientation. There are some instances in the above however, that suggest things like varying stroke weight may help. Again, looking at your mis-labelled examples may help you determine what augmentations may yield better results.\n\nIf you want code examples on how to pick up what your classifier has mis-labelled, feel free to check out:\n\n* https://www.kaggle.com/craigmthomas/beginner-guide-to-digit-recognition-part-2",
      "votes": 1
    }
  ],
  "comments": [
    {
      "id": 1152906,
      "author_name": "AKSHAY KUMAR",
      "author_url": "",
      "post_date": "2021-01-14T14:57:15.080000",
      "content": "<p>In rotation_range parameter can 90 value cause problems ? <br>\nVertical_flip can be used ?</p>",
      "votes": 2,
      "replies": [
        {
          "id": 1152930,
          "author_name": "fedesoriano",
          "author_url": "",
          "post_date": "2021-01-14T15:05:05.897000",
          "content": "<p>I think that using bigger values doesn't make sense, think it this way. If you set rotation_range to 90 degrees you are training your model to recognize numbers that are with a different orientation, when in the environment you are going to use it all images are oriented in the same way. </p>\n<p>On the other hand, vertical flipping is similar to setting your rotation degree to 180, it can give you problems with some numbers.</p>\n<p>I would recommend you thinking about the consequences of fixing that parameters with a big value, that way you can understand the type of data you will be using with your models.</p>",
          "votes": 1,
          "replies": []
        }
      ]
    },
    {
      "id": 1152175,
      "author_name": "fedesoriano",
      "author_url": "",
      "post_date": "2021-01-13T22:08:07.570000",
      "content": "<p>You can use any kind of the data augmentation properties with the MNIST dataset. However, I would recommend you that some parameters should be fixed within a range or even disabled. For example, using the <code>ImageDataGenerator</code> from Keras:</p>\n<ul>\n<li>I would fix the <code>rotation_range</code> parameter into a value between 0 and 30. If you use a really big value like 180 you may create confusion between 9 and 6.</li>\n<li>I would also disable the <code>horizontal_flip</code> parameter, it may also create confusion with other numbers like 5 and 2. </li>\n</ul>\n<p>Hope it helps!</p>",
      "votes": 2,
      "replies": []
    },
    {
      "id": 1153381,
      "author_name": "Craig Thomas",
      "author_url": "",
      "post_date": "2021-01-14T20:52:00.810000",
      "content": "<p><a href=\"https://www.kaggle.com/legendsplay\" target=\"_blank\">@legendsplay</a> as <a href=\"https://www.kaggle.com/fedesoriano\" target=\"_blank\">@fedesoriano</a> mentioned, some rotations or flips may not make sense as per your data augmentation. I think it would help to take a look at what your classifier is getting wrong to help guide what augmentations you may want to use. For example, I took a look at one of my own classifiers and found the following:</p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F2051313%2F9159ee3487a5c52e620d3f36a0ea1b63%2Fconfusion_matrix.png?generation=1610656498177252&amp;alt=media\" alt=\"\"></p>\n<p>You can see from the above that 9 and 6 are not being at all confused (true label 6 is never predicted as being 9, and true label 9 is never predicted as being 6). However, 9 is being mistaken for 4 and 7 a lot. So, I pulled up all examples of the digit 9 that were being mis-labelled:</p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F2051313%2F6002ce20e1c26475e34988f5f08d0e6b%2Fmislabelled_9.png?generation=1610656966191290&amp;alt=media\" alt=\"\"></p>\n<p>As you can see, some images do indeed look like a 4, and some like a 7, which is why they are being mis-labelled. The question for the remainder is what augmentations are going to help? Slight rotations and skews may help if you have training examples that look very similar to those mis-labels, but are in a different orientation. There are some instances in the above however, that suggest things like varying stroke weight may help. Again, looking at your mis-labelled examples may help you determine what augmentations may yield better results.</p>\n<p>If you want code examples on how to pick up what your classifier has mis-labelled, feel free to check out:</p>\n<ul>\n<li><a href=\"https://www.kaggle.com/craigmthomas/beginner-guide-to-digit-recognition-part-2\" target=\"_blank\">https://www.kaggle.com/craigmthomas/beginner-guide-to-digit-recognition-part-2</a></li>\n</ul>",
      "votes": 1,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "1152017": "What kind of augmentation cannot be used in MNIST ",
    "1152906": "In rotation_range parameter can 90 value cause problems ? \nVertical_flip can be used ?",
    "1152175": "You can use any kind of the data augmentation properties with the MNIST dataset. However, I would recommend you that some parameters should be fixed within a range or even disabled. For example, using the `ImageDataGenerator` from Keras:\n\n- I would fix the `rotation_range` parameter into a value between 0 and 30. If you use a really big value like 180 you may create confusion between 9 and 6.\n- I would also disable the `horizontal_flip` parameter, it may also create confusion with other numbers like 5 and 2. \n\nHope it helps!",
    "1153381": "@legendsplay as @fedesoriano mentioned, some rotations or flips may not make sense as per your data augmentation. I think it would help to take a look at what your classifier is getting wrong to help guide what augmentations you may want to use. For example, I took a look at one of my own classifiers and found the following:\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F2051313%2F9159ee3487a5c52e620d3f36a0ea1b63%2Fconfusion_matrix.png?generation=1610656498177252&alt=media)\n\nYou can see from the above that 9 and 6 are not being at all confused (true label 6 is never predicted as being 9, and true label 9 is never predicted as being 6). However, 9 is being mistaken for 4 and 7 a lot. So, I pulled up all examples of the digit 9 that were being mis-labelled:\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F2051313%2F6002ce20e1c26475e34988f5f08d0e6b%2Fmislabelled_9.png?generation=1610656966191290&alt=media)\n\nAs you can see, some images do indeed look like a 4, and some like a 7, which is why they are being mis-labelled. The question for the remainder is what augmentations are going to help? Slight rotations and skews may help if you have training examples that look very similar to those mis-labels, but are in a different orientation. There are some instances in the above however, that suggest things like varying stroke weight may help. Again, looking at your mis-labelled examples may help you determine what augmentations may yield better results.\n\nIf you want code examples on how to pick up what your classifier has mis-labelled, feel free to check out:\n\n* https://www.kaggle.com/craigmthomas/beginner-guide-to-digit-recognition-part-2"
  }
}