{
  "id": 12597,
  "title": "differences between real-time augmentation and preprocess augmentation",
  "url": "/competitions/datasciencebowl/discussion/12597",
  "author_name": "",
  "post_date": "2015-02-23T21:04:00.143Z",
  "votes": 4,
  "comment_count": 7,
  "views": 3464,
  "content": "<p>I saw a lot of people doing realtime augmentation, I am just wondering if&nbsp;there is other benefits of doing it besides saving disk space.</p>\n<p>From my understanding, for realtime augmentation, people randomly augment image at runtime, so at each iteration, the learning algorithm will learn from the augmented image.</p>\n<p>However, if at preprocessing stage, I generate enough augmented images, say for each image, I generate 2000 augmented ones, shuffle them and save them all to disk. Performance wise, is it&nbsp;going to be different&nbsp;compare to realtime augmentation.&nbsp;</p>",
  "messages": [
    {
      "id": "64782",
      "postDate": "02/23/2015 21:04:00",
      "content": "<p>I saw a lot of people doing realtime augmentation, I am just wondering if&nbsp;there is other benefits of doing it besides saving disk space.</p>\n<p>From my understanding, for realtime augmentation, people randomly augment image at runtime, so at each iteration, the learning algorithm will learn from the augmented image.</p>\n<p>However, if at preprocessing stage, I generate enough augmented images, say for each image, I generate 2000 augmented ones, shuffle them and save them all to disk. Performance wise, is it&nbsp;going to be different&nbsp;compare to realtime augmentation.&nbsp;</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "64787",
      "postDate": "02/23/2015 22:37:34",
      "content": "<p>You just have a choice -- you can generate data beforehand, and do not waste time on augmentation during training, or if you do not have enough space or performance is not that critical you can do real-time augmentation. I don't believe one is better than the other. &nbsp;&nbsp;</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "64826",
      "postDate": "02/24/2015 22:46:53",
      "content": "<p>It would be interested to find out the results in real experiments. I am just wondering if anyone has done such comparison before. I am not sure if I will have time to compare the two for this competition.</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "64858",
      "postDate": "02/25/2015 11:40:36",
      "content": "<p>@SkyLibrary</p>\n<p>I have done this comparison. I used to do offline data augmentation because it is relatively easier to implement based on open source code, but I finally switch to online data augmentation&nbsp;for the following reasons:</p>\n<p>1. For online data augmentation, the model see one random generated sample only once, but it is not the case for offline data augmentation (unless you only train one epoch on the offline generated data). As the model see more samples in online training, the model trained with online data augmentation generalize better than the model trained with offline data augmentation. According to my comparison, the score obtained by online augmentation is consistently better than the offline data augmentation. Though the gap will be narrowed if the more times offline data augmentation is applied.</p>\n<p>2. It is very annoying (sometimes even intractable) to store very large amount of offline augmented data. This issue will become even worse when you try to study various data augmentation strategies.</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "65659",
      "postDate": "03/07/2015 02:59:24",
      "content": "<p>@xudong cao, I have noticed that you issued a data augmentation topic by yourself months ago. Would you please point out a detailed data augmentation strategy or eve share the code ? I believe may guys are annoyed with this. We know data augmentation and we know its advantages, but just do not how to start...</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "65670",
      "postDate": "03/07/2015 09:12:25",
      "content": "<p>@PengPai then is that any sense in competition if leader share their code? You can wait for 10 days and xudong cao will post everything :)</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "65673",
      "postDate": "03/07/2015 10:52:25",
      "content": "<p>@old-ufo, a ha ! You are right. I just forgot that point. Forgive me that I just come here to learn, not to &quot;win the money&quot; :) Anyway, thank you for &nbsp;several replies ~</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "65674",
      "postDate": "03/07/2015 11:17:16",
      "content": "<p>I think there are a lot of code about this topic out there for general CNN framework.</p>\n<p>For CXXNET: check out their V2's code (developed by team members of Happy Lantern Festival)</p>\n<p>https://github.com/antinucleon/cxxnet/blob/V2-refactor/src/io/image_augmenter-inl.hpp</p>\n<p><br>For Theano: see Sander's Galaxy Zoo code (team member of Deep Sea)</p>\n<p>https://github.com/benanne/kaggle-galaxies/blob/master/realtime_augmentation.py</p>\n<p><br>For nnForge: check out Maxim Milakov's code</p>\n<p>https://github.com/milakov/nnForge/blob/master/nnforge/data_transformer_util.cpp</p>\n<p><br>For Torch7: see nagadomi's code</p>\n<p>https://github.com/nagadomi/kaggle-cifar10-torch7/blob/cuda-convnet2/lib/data_augmentation.lua</p>\n<p><br>For Caffe: I have a bit of code in my github</p>\n<p>https://github.com/ChenglongChen/caffe-windows/blob/master/src/caffe/data_transformer.cpp</p>",
      "rawMarkdown": "",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 64787,
      "author_name": "dulyanov",
      "author_url": "",
      "post_date": "02/23/2015 22:37:34",
      "content": "<p>You just have a choice -- you can generate data beforehand, and do not waste time on augmentation during training, or if you do not have enough space or performance is not that critical you can do real-time augmentation. I don't believe one is better than the other. &nbsp;&nbsp;</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 64826,
      "author_name": "skylibrary",
      "author_url": "",
      "post_date": "02/24/2015 22:46:53",
      "content": "<p>It would be interested to find out the results in real experiments. I am just wondering if anyone has done such comparison before. I am not sure if I will have time to compare the two for this competition.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 64858,
      "author_name": "xudongcao",
      "author_url": "",
      "post_date": "02/25/2015 11:40:36",
      "content": "<p>@SkyLibrary</p>\n<p>I have done this comparison. I used to do offline data augmentation because it is relatively easier to implement based on open source code, but I finally switch to online data augmentation&nbsp;for the following reasons:</p>\n<p>1. For online data augmentation, the model see one random generated sample only once, but it is not the case for offline data augmentation (unless you only train one epoch on the offline generated data). As the model see more samples in online training, the model trained with online data augmentation generalize better than the model trained with offline data augmentation. According to my comparison, the score obtained by online augmentation is consistently better than the offline data augmentation. Though the gap will be narrowed if the more times offline data augmentation is applied.</p>\n<p>2. It is very annoying (sometimes even intractable) to store very large amount of offline augmented data. This issue will become even worse when you try to study various data augmentation strategies.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 65659,
      "author_name": "pengpai",
      "author_url": "",
      "post_date": "03/07/2015 02:59:24",
      "content": "<p>@xudong cao, I have noticed that you issued a data augmentation topic by yourself months ago. Would you please point out a detailed data augmentation strategy or eve share the code ? I believe may guys are annoyed with this. We know data augmentation and we know its advantages, but just do not how to start...</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 65670,
      "author_name": "oldufo",
      "author_url": "",
      "post_date": "03/07/2015 09:12:25",
      "content": "<p>@PengPai then is that any sense in competition if leader share their code? You can wait for 10 days and xudong cao will post everything :)</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 65673,
      "author_name": "pengpai",
      "author_url": "",
      "post_date": "03/07/2015 10:52:25",
      "content": "<p>@old-ufo, a ha ! You are right. I just forgot that point. Forgive me that I just come here to learn, not to &quot;win the money&quot; :) Anyway, thank you for &nbsp;several replies ~</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 65674,
      "author_name": "chenglongchen",
      "author_url": "",
      "post_date": "03/07/2015 11:17:16",
      "content": "<p>I think there are a lot of code about this topic out there for general CNN framework.</p>\n<p>For CXXNET: check out their V2's code (developed by team members of Happy Lantern Festival)</p>\n<p>https://github.com/antinucleon/cxxnet/blob/V2-refactor/src/io/image_augmenter-inl.hpp</p>\n<p><br>For Theano: see Sander's Galaxy Zoo code (team member of Deep Sea)</p>\n<p>https://github.com/benanne/kaggle-galaxies/blob/master/realtime_augmentation.py</p>\n<p><br>For nnForge: check out Maxim Milakov's code</p>\n<p>https://github.com/milakov/nnForge/blob/master/nnforge/data_transformer_util.cpp</p>\n<p><br>For Torch7: see nagadomi's code</p>\n<p>https://github.com/nagadomi/kaggle-cifar10-torch7/blob/cuda-convnet2/lib/data_augmentation.lua</p>\n<p><br>For Caffe: I have a bit of code in my github</p>\n<p>https://github.com/ChenglongChen/caffe-windows/blob/master/src/caffe/data_transformer.cpp</p>",
      "votes": null,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "64782": "",
    "64787": "",
    "64826": "",
    "64858": "",
    "65659": "",
    "65670": "",
    "65673": "",
    "65674": ""
  },
  "source": "meta"
}