{
  "id": 130903,
  "title": "How to do data augmentation for face recognition?",
  "url": "/competitions/deepfake-detection-challenge/discussion/130903",
  "author_name": "",
  "post_date": "2020-02-17T03:15:12.890707100Z",
  "votes": 11,
  "comment_count": 12,
  "views": 0,
  "content": "<p>（1）rotate ？\n（2）scale ？\n（3）padding ？\n（4）random crop ？\n（5）horizontal flip ？\n（6）mixup ? \n（7）cutmix/cutout ？\n（8）？</p>\n\n<p>A simple data augmentation tools for image classification：\n（1）auto-augment：<a href=\"https://github.com/DeepVoltaire/AutoAugment/blob/master/autoaugment.py\">https://github.com/DeepVoltaire/AutoAugment/blob/master/autoaugment.py</a>\n（2）fast-autoaugment: <a href=\"https://github.com/kakaobrain/fast-autoaugment\">https://github.com/kakaobrain/fast-autoaugment</a></p>",
  "messages": [
    {
      "id": "747948",
      "postDate": "02/17/2020 03:15:12",
      "content": "<p>（1）rotate ？\n（2）scale ？\n（3）padding ？\n（4）random crop ？\n（5）horizontal flip ？\n（6）mixup ? \n（7）cutmix/cutout ？\n（8）？</p>\n\n<p>A simple data augmentation tools for image classification：\n（1）auto-augment：<a href=\"https://github.com/DeepVoltaire/AutoAugment/blob/master/autoaugment.py\">https://github.com/DeepVoltaire/AutoAugment/blob/master/autoaugment.py</a>\n（2）fast-autoaugment: <a href=\"https://github.com/kakaobrain/fast-autoaugment\">https://github.com/kakaobrain/fast-autoaugment</a></p>",
      "rawMarkdown": "（1）rotate ？\n（2）scale ？\n（3）padding ？\n（4）random crop ？\n（5）horizontal flip ？\n（6）mixup ? \n（7）cutmix/cutout ？\n（8）？\n\nA simple data augmentation tools for image classification：\n（1）auto-augment：https://github.com/DeepVoltaire/AutoAugment/blob/master/autoaugment.py\n（2）fast-autoaugment: https://github.com/kakaobrain/fast-autoaugment",
      "votes": null
    },
    {
      "id": "748297",
      "postDate": "02/17/2020 11:05:23",
      "content": "<p>Save as JPEG with a random quality factor, then load it back in (can do this in memory, no need to save to actual file).</p>\n\n<p>Resize to 1/4th the size, then resize back to the original size.</p>\n\n<p>Random Gaussian blur and Gaussian noise.</p>",
      "rawMarkdown": "Save as JPEG with a random quality factor, then load it back in (can do this in memory, no need to save to actual file).\n\nResize to 1/4th the size, then resize back to the original size.\n\nRandom Gaussian blur and Gaussian noise.",
      "votes": null
    },
    {
      "id": "748378",
      "postDate": "02/17/2020 13:13:00",
      "content": "<p>Someone already suggested in some other discussion (not quite sure where it is), but you can use some augmentation package to simulate the JPEG compression, for example, <a href=\"https://albumentations.readthedocs.io/en/latest/\">albumentations</a> is a great one. So you can do online augmentation,</p>",
      "rawMarkdown": "Someone already suggested in some other discussion (not quite sure where it is), but you can use some augmentation package to simulate the JPEG compression, for example, [albumentations](https://albumentations.readthedocs.io/en/latest/) is a great one. So you can do online augmentation,",
      "votes": null
    },
    {
      "id": "748853",
      "postDate": "02/18/2020 03:49:38",
      "content": "<p>I found no augmentation while training gives the best results. Probably because the model is already overfitting on faces, and if you add augmentation, it will overfit more serverely.</p>",
      "rawMarkdown": "I found no augmentation while training gives the best results. Probably because the model is already overfitting on faces, and if you add augmentation, it will overfit more serverely.",
      "votes": null
    },
    {
      "id": "748913",
      "postDate": "02/18/2020 05:23:13",
      "content": "<p>Yes, I have used albumentations, works great!</p>",
      "rawMarkdown": "Yes, I have used albumentations, works great!",
      "votes": null
    },
    {
      "id": "748926",
      "postDate": "02/18/2020 05:25:29",
      "content": "<p>For me, augmentation helps, but somehow the val loss is sensitive to the parameters such as what percentage of the batch data I apply the augmentation on.</p>\n\n<p><a href=\"/unkownhihi\">@unkownhihi</a>  Shouldn't augmentation help reduce overfitting, as we are adding modified new samples not available in original data? Am I missing something...</p>",
      "rawMarkdown": "For me, augmentation helps, but somehow the val loss is sensitive to the parameters such as what percentage of the batch data I apply the augmentation on.\n\n@unkownhihi  Shouldn't augmentation help reduce overfitting, as we are adding modified new samples not available in original data? Am I missing something...",
      "votes": null
    },
    {
      "id": "751553",
      "postDate": "02/20/2020 09:18:13",
      "content": "<p><a href=\"/humananalog\">@humananalog</a> and <a href=\"/pedromb\">@pedromb</a> - have you definitely found the JPEG compression to be useful? It certainly increases my CV loss, which might be a good thing as it may represent decreased ability for the network to overfit to the actors, but I'm not sure it's translated into better LB scores.</p>\n\n<p>For reference, I'm using Albumentation's <code>Downscale(scale_min=0.5, scale_max=0.9, p=0.65)</code></p>",
      "rawMarkdown": "humananalog and @pedromb - have you definitely found the JPEG compression to be useful? It certainly increases my CV loss, which might be a good thing as it may represent decreased ability for the network to overfit to the actors, but I'm not sure it's translated into better LB scores.\n\nFor reference, I'm using Albumentation's `Downscale(scale_min=0.5, scale_max=0.9, p=0.65)`",
      "votes": null
    },
    {
      "id": "751561",
      "postDate": "02/20/2020 09:26:44",
      "content": "<p><a href=\"/jamesphoward\">@jamesphoward</a> it was definitely useful for me. I don't use JPEG compression as much as an augmentation but more as a pre-processing step, in the sense that I do the same transformation for train and validation sets. The thought process is that the test set will have videos with worse quality so I want my validation set to also represent that when evaluating convergence of the network. It translated to worse CV and better LB.</p>",
      "rawMarkdown": "jamesphoward it was definitely useful for me. I don't use JPEG compression as much as an augmentation but more as a pre-processing step, in the sense that I do the same transformation for train and validation sets. The thought process is that the test set will have videos with worse quality so I want my validation set to also represent that when evaluating convergence of the network. It translated to worse CV and better LB.",
      "votes": null
    },
    {
      "id": "751700",
      "postDate": "02/20/2020 12:23:06",
      "content": "<p>does adding lots of augmentations help deal with overfitting in this particular case? I thought some augmentations could make real and fake label indistinguishable at first. note that I haven't started training a model yet :) </p>",
      "rawMarkdown": "does adding lots of augmentations help deal with overfitting in this particular case? I thought some augmentations could make real and fake label indistinguishable at first. note that I haven't started training a model yet :)",
      "votes": null
    },
    {
      "id": "751705",
      "postDate": "02/20/2020 12:30:34",
      "content": "<p>I’ve tried to hold back for that reason, but have done some minor augmentations. However my experiment is JPEG compression really hinders the network’s ability to learn and appeared to do less well on LB, so i was interested in others’ experience.</p>",
      "rawMarkdown": "I’ve tried to hold back for that reason, but have done some minor augmentations. However my experiment is JPEG compression really hinders the network’s ability to learn and appeared to do less well on LB, so i was interested in others’ experience.",
      "votes": null
    },
    {
      "id": "751856",
      "postDate": "02/20/2020 15:18:01",
      "content": "<p>As with anything, I think it's a careful balance between too much and too little augmentation. For example, my JPEG augmentation is only applied 20% of the time and then picks a quality between 15 and 50 (of max 100). </p>\n\n<p>Would it be better to use this only 10% of the time, or perhaps 50% of the time, or maybe change the quality range to 30 - 95? I have no idea and I don't have the time to do an ablation study. ;-) </p>\n\n<p>I think finding the right combination of hyperparameters is a big part of getting a model that works well. Obviously <a href=\"/jamesphoward\">@jamesphoward</a> is currently doing way better at this than I am, judging by our respective leaderboard positions. :-D</p>",
      "rawMarkdown": "As with anything, I think it's a careful balance between too much and too little augmentation. For example, my JPEG augmentation is only applied 20% of the time and then picks a quality between 15 and 50 (of max 100). \n\nWould it be better to use this only 10% of the time, or perhaps 50% of the time, or maybe change the quality range to 30 - 95? I have no idea and I don't have the time to do an ablation study. ;-) \n\nI think finding the right combination of hyperparameters is a big part of getting a model that works well. Obviously @jamesphoward is currently doing way better at this than I am, judging by our respective leaderboard positions. :-D",
      "votes": null
    },
    {
      "id": "752471",
      "postDate": "02/21/2020 03:47:18",
      "content": "<p>thanks</p>",
      "rawMarkdown": "thanks",
      "votes": null
    },
    {
      "id": "770629",
      "postDate": "03/13/2020 07:13:50",
      "content": "<p>thanks</p>",
      "rawMarkdown": "thanks",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 748297,
      "author_name": "humananalog",
      "author_url": "",
      "post_date": "02/17/2020 11:05:23",
      "content": "<p>Save as JPEG with a random quality factor, then load it back in (can do this in memory, no need to save to actual file).</p>\n\n<p>Resize to 1/4th the size, then resize back to the original size.</p>\n\n<p>Random Gaussian blur and Gaussian noise.</p>",
      "votes": null,
      "replies": [
        {
          "id": 748378,
          "author_name": "pedromb",
          "author_url": "",
          "post_date": "02/17/2020 13:13:00",
          "content": "<p>Someone already suggested in some other discussion (not quite sure where it is), but you can use some augmentation package to simulate the JPEG compression, for example, <a href=\"https://albumentations.readthedocs.io/en/latest/\">albumentations</a> is a great one. So you can do online augmentation,</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 748913,
          "author_name": "debanga",
          "author_url": "",
          "post_date": "02/18/2020 05:23:13",
          "content": "<p>Yes, I have used albumentations, works great!</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 751553,
          "author_name": "jamesphoward",
          "author_url": "",
          "post_date": "02/20/2020 09:18:13",
          "content": "<p><a href=\"/humananalog\">@humananalog</a> and <a href=\"/pedromb\">@pedromb</a> - have you definitely found the JPEG compression to be useful? It certainly increases my CV loss, which might be a good thing as it may represent decreased ability for the network to overfit to the actors, but I'm not sure it's translated into better LB scores.</p>\n\n<p>For reference, I'm using Albumentation's <code>Downscale(scale_min=0.5, scale_max=0.9, p=0.65)</code></p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 751561,
          "author_name": "pedromb",
          "author_url": "",
          "post_date": "02/20/2020 09:26:44",
          "content": "<p><a href=\"/jamesphoward\">@jamesphoward</a> it was definitely useful for me. I don't use JPEG compression as much as an augmentation but more as a pre-processing step, in the sense that I do the same transformation for train and validation sets. The thought process is that the test set will have videos with worse quality so I want my validation set to also represent that when evaluating convergence of the network. It translated to worse CV and better LB.</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 751700,
          "author_name": "yangsaewon",
          "author_url": "",
          "post_date": "02/20/2020 12:23:06",
          "content": "<p>does adding lots of augmentations help deal with overfitting in this particular case? I thought some augmentations could make real and fake label indistinguishable at first. note that I haven't started training a model yet :) </p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 751705,
          "author_name": "jamesphoward",
          "author_url": "",
          "post_date": "02/20/2020 12:30:34",
          "content": "<p>I’ve tried to hold back for that reason, but have done some minor augmentations. However my experiment is JPEG compression really hinders the network’s ability to learn and appeared to do less well on LB, so i was interested in others’ experience.</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 751856,
          "author_name": "humananalog",
          "author_url": "",
          "post_date": "02/20/2020 15:18:01",
          "content": "<p>As with anything, I think it's a careful balance between too much and too little augmentation. For example, my JPEG augmentation is only applied 20% of the time and then picks a quality between 15 and 50 (of max 100). </p>\n\n<p>Would it be better to use this only 10% of the time, or perhaps 50% of the time, or maybe change the quality range to 30 - 95? I have no idea and I don't have the time to do an ablation study. ;-) </p>\n\n<p>I think finding the right combination of hyperparameters is a big part of getting a model that works well. Obviously <a href=\"/jamesphoward\">@jamesphoward</a> is currently doing way better at this than I am, judging by our respective leaderboard positions. :-D</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 770629,
          "author_name": "machinelp",
          "author_url": "",
          "post_date": "03/13/2020 07:13:50",
          "content": "<p>thanks</p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 748853,
      "author_name": "unkownhihi",
      "author_url": "",
      "post_date": "02/18/2020 03:49:38",
      "content": "<p>I found no augmentation while training gives the best results. Probably because the model is already overfitting on faces, and if you add augmentation, it will overfit more serverely.</p>",
      "votes": null,
      "replies": [
        {
          "id": 748926,
          "author_name": "debanga",
          "author_url": "",
          "post_date": "02/18/2020 05:25:29",
          "content": "<p>For me, augmentation helps, but somehow the val loss is sensitive to the parameters such as what percentage of the batch data I apply the augmentation on.</p>\n\n<p><a href=\"/unkownhihi\">@unkownhihi</a>  Shouldn't augmentation help reduce overfitting, as we are adding modified new samples not available in original data? Am I missing something...</p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 752471,
      "author_name": "beeaware",
      "author_url": "",
      "post_date": "02/21/2020 03:47:18",
      "content": "<p>thanks</p>",
      "votes": null,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "747948": "（1）rotate ？\n（2）scale ？\n（3）padding ？\n（4）random crop ？\n（5）horizontal flip ？\n（6）mixup ? \n（7）cutmix/cutout ？\n（8）？\n\nA simple data augmentation tools for image classification：\n（1）auto-augment：https://github.com/DeepVoltaire/AutoAugment/blob/master/autoaugment.py\n（2）fast-autoaugment: https://github.com/kakaobrain/fast-autoaugment",
    "748297": "Save as JPEG with a random quality factor, then load it back in (can do this in memory, no need to save to actual file).\n\nResize to 1/4th the size, then resize back to the original size.\n\nRandom Gaussian blur and Gaussian noise.",
    "748378": "Someone already suggested in some other discussion (not quite sure where it is), but you can use some augmentation package to simulate the JPEG compression, for example, [albumentations](https://albumentations.readthedocs.io/en/latest/) is a great one. So you can do online augmentation,",
    "748853": "I found no augmentation while training gives the best results. Probably because the model is already overfitting on faces, and if you add augmentation, it will overfit more serverely.",
    "748913": "Yes, I have used albumentations, works great!",
    "748926": "For me, augmentation helps, but somehow the val loss is sensitive to the parameters such as what percentage of the batch data I apply the augmentation on.\n\n@unkownhihi  Shouldn't augmentation help reduce overfitting, as we are adding modified new samples not available in original data? Am I missing something...",
    "751553": "humananalog and @pedromb - have you definitely found the JPEG compression to be useful? It certainly increases my CV loss, which might be a good thing as it may represent decreased ability for the network to overfit to the actors, but I'm not sure it's translated into better LB scores.\n\nFor reference, I'm using Albumentation's `Downscale(scale_min=0.5, scale_max=0.9, p=0.65)`",
    "751561": "jamesphoward it was definitely useful for me. I don't use JPEG compression as much as an augmentation but more as a pre-processing step, in the sense that I do the same transformation for train and validation sets. The thought process is that the test set will have videos with worse quality so I want my validation set to also represent that when evaluating convergence of the network. It translated to worse CV and better LB.",
    "751700": "does adding lots of augmentations help deal with overfitting in this particular case? I thought some augmentations could make real and fake label indistinguishable at first. note that I haven't started training a model yet :)",
    "751705": "I’ve tried to hold back for that reason, but have done some minor augmentations. However my experiment is JPEG compression really hinders the network’s ability to learn and appeared to do less well on LB, so i was interested in others’ experience.",
    "751856": "As with anything, I think it's a careful balance between too much and too little augmentation. For example, my JPEG augmentation is only applied 20% of the time and then picks a quality between 15 and 50 (of max 100). \n\nWould it be better to use this only 10% of the time, or perhaps 50% of the time, or maybe change the quality range to 30 - 95? I have no idea and I don't have the time to do an ablation study. ;-) \n\nI think finding the right combination of hyperparameters is a big part of getting a model that works well. Obviously @jamesphoward is currently doing way better at this than I am, judging by our respective leaderboard positions. :-D",
    "752471": "thanks",
    "770629": "thanks"
  },
  "source": "meta"
}