{
  "id": 72450,
  "title": "2nd place solution overview",
  "url": "/competitions/inclusive-images-challenge/writeups/vecxoz-2nd-place-solution-overview",
  "author_name": "",
  "post_date": "2018-11-23T11:23:26.724954800Z",
  "votes": 16,
  "comment_count": 2,
  "views": 0,
  "content": "<p>I don’t know about other people, but when I saw $1,000 in my inbox I had Christmas Morning moment. Free GCP credits are extremely important for our community. Many thanks to Google &amp; Kaggle!</p>\n\n<h2>Solution</h2>\n\n<p>Ensemble of 3 Deep CNNs: ResNet50, InceptionV3, and InceptionResNetV2.</p>\n\n<h2>Concept</h2>\n\n<p>We expected test images to come from different regions. So there were no doubts that augmentation and ensembling would be the most important directions to make robust models. But later when detailed EDA showed substantial difference in train/test label distributions it became clear that tuning models using tuning set would also play very important role. </p>\n\n<h2>Diversity</h2>\n\n<p>To get more diversity for ensemble I used following approaches: </p>\n\n<ol>\n<li>Different CNN architectures</li>\n<li>Different image sizes</li>\n<li>Train with/without augmentation</li>\n<li>Different augmentation schedules</li>\n</ol>\n\n<h2>Models</h2>\n\n<p>Of course all models were trained from scratch according to the rules. I think it was nice because there was no those usual pretrained model search rush :) Scores below are from Stage 1 LB.</p>\n\n<ol>\n<li>ResNet50, 57 epochs, 224x224, adam 0.001, batch 64, increasing augmentation schedule, 4 hours per epoch on 1x P100, 0.311 without tuning, 0.510 with tuning</li>\n<li>InceptionV3, 25 epochs, 400x400, adam 0.001, batch 32, increasing augmentation schedule, 9 hours per epoch on 1x P100, 0.327 without tuning, 0.545 with tuning</li>\n<li>InceptionResNetV2, 8 epochs, 598x598, adam 0.001, batch 12, no augmentation, 38 hours per epoch on 1x P100, 0.318 without tuning, 0.550 with tuning</li>\n</ol>\n\n<h2>Final submission</h2>\n\n<p>I trained 3 models described above, tuned them, predicted original test images, predicted mirrored test images, and computed weighted average.</p>\n\n<h2>Notes</h2>\n\n<ol>\n<li>By increasing augmentation schedule I mean the following: train without augmentation until plateau (or until you feel like enough), then apply soft augmentation (wide range of values) during several epochs: e.g. <code>rotate(np.random.randint(-30, 30))</code>, then apply hard augmentation (short range or even two possible values) during another several epochs: e.g. <code>rotate(np.random.choice([-30, 30]))</code>.</li>\n<li>About training times. I used batch generator derived from <a href=\"https://keras.io/utils/#sequence\">Sequence</a> and multiprocessing with 8 processes per GPU. My typical hardware setup on GCP looks like: 1x P100, 8x CPU, 15 GB RAM, SSD or 2x P100, 16x CPU, 30 GB RAM, SSD, etc.</li>\n</ol>\n\n<h2>Side Notes</h2>\n\n<ol>\n<li>Time after time I had been running 8x V100. It definitely feels like a ride on racing motorbike. I mean not only extreme speed of computation. I also mean adrenaline related to the speed of money flow.</li>\n<li>Looking at some images I was curious about one thing. How often do you experience something like nostalgia about the country you’ve never been?</li>\n<li>And by the way have you seen <a href=\"https://www.kaggle.com/c/inclusive-images-challenge/discussion/69789\">convolved foxes</a>?</li>\n</ol>",
  "messages": [
    {
      "id": "426507",
      "postDate": "11/23/2018 11:23:26",
      "content": "<p>I don’t know about other people, but when I saw $1,000 in my inbox I had Christmas Morning moment. Free GCP credits are extremely important for our community. Many thanks to Google &amp; Kaggle!</p>\n\n<h2>Solution</h2>\n\n<p>Ensemble of 3 Deep CNNs: ResNet50, InceptionV3, and InceptionResNetV2.</p>\n\n<h2>Concept</h2>\n\n<p>We expected test images to come from different regions. So there were no doubts that augmentation and ensembling would be the most important directions to make robust models. But later when detailed EDA showed substantial difference in train/test label distributions it became clear that tuning models using tuning set would also play very important role. </p>\n\n<h2>Diversity</h2>\n\n<p>To get more diversity for ensemble I used following approaches: </p>\n\n<ol>\n<li>Different CNN architectures</li>\n<li>Different image sizes</li>\n<li>Train with/without augmentation</li>\n<li>Different augmentation schedules</li>\n</ol>\n\n<h2>Models</h2>\n\n<p>Of course all models were trained from scratch according to the rules. I think it was nice because there was no those usual pretrained model search rush :) Scores below are from Stage 1 LB.</p>\n\n<ol>\n<li>ResNet50, 57 epochs, 224x224, adam 0.001, batch 64, increasing augmentation schedule, 4 hours per epoch on 1x P100, 0.311 without tuning, 0.510 with tuning</li>\n<li>InceptionV3, 25 epochs, 400x400, adam 0.001, batch 32, increasing augmentation schedule, 9 hours per epoch on 1x P100, 0.327 without tuning, 0.545 with tuning</li>\n<li>InceptionResNetV2, 8 epochs, 598x598, adam 0.001, batch 12, no augmentation, 38 hours per epoch on 1x P100, 0.318 without tuning, 0.550 with tuning</li>\n</ol>\n\n<h2>Final submission</h2>\n\n<p>I trained 3 models described above, tuned them, predicted original test images, predicted mirrored test images, and computed weighted average.</p>\n\n<h2>Notes</h2>\n\n<ol>\n<li>By increasing augmentation schedule I mean the following: train without augmentation until plateau (or until you feel like enough), then apply soft augmentation (wide range of values) during several epochs: e.g. <code>rotate(np.random.randint(-30, 30))</code>, then apply hard augmentation (short range or even two possible values) during another several epochs: e.g. <code>rotate(np.random.choice([-30, 30]))</code>.</li>\n<li>About training times. I used batch generator derived from <a href=\"https://keras.io/utils/#sequence\">Sequence</a> and multiprocessing with 8 processes per GPU. My typical hardware setup on GCP looks like: 1x P100, 8x CPU, 15 GB RAM, SSD or 2x P100, 16x CPU, 30 GB RAM, SSD, etc.</li>\n</ol>\n\n<h2>Side Notes</h2>\n\n<ol>\n<li>Time after time I had been running 8x V100. It definitely feels like a ride on racing motorbike. I mean not only extreme speed of computation. I also mean adrenaline related to the speed of money flow.</li>\n<li>Looking at some images I was curious about one thing. How often do you experience something like nostalgia about the country you’ve never been?</li>\n<li>And by the way have you seen <a href=\"https://www.kaggle.com/c/inclusive-images-challenge/discussion/69789\">convolved foxes</a>?</li>\n</ol>",
      "rawMarkdown": "I don’t know about other people, but when I saw $1,000 in my inbox I had Christmas Morning moment. Free GCP credits are extremely important for our community. Many thanks to Google &amp; Kaggle!\n\n## Solution\nEnsemble of 3 Deep CNNs: ResNet50, InceptionV3, and InceptionResNetV2.\n\n## Concept\nWe expected test images to come from different regions. So there were no doubts that augmentation and ensembling would be the most important directions to make robust models. But later when detailed EDA showed substantial difference in train/test label distributions it became clear that tuning models using tuning set would also play very important role. \n\n## Diversity\nTo get more diversity for ensemble I used following approaches: \n\n1. Different CNN architectures\n2. Different image sizes\n3. Train with/without augmentation\n4. Different augmentation schedules\n\n## Models\nOf course all models were trained from scratch according to the rules. I think it was nice because there was no those usual pretrained model search rush :) Scores below are from Stage 1 LB.\n\n1. ResNet50, 57 epochs, 224x224, adam 0.001, batch 64, increasing augmentation schedule, 4 hours per epoch on 1x P100, 0.311 without tuning, 0.510 with tuning\n2. InceptionV3, 25 epochs, 400x400, adam 0.001, batch 32, increasing augmentation schedule, 9 hours per epoch on 1x P100, 0.327 without tuning, 0.545 with tuning\n3. InceptionResNetV2, 8 epochs, 598x598, adam 0.001, batch 12, no augmentation, 38 hours per epoch on 1x P100, 0.318 without tuning, 0.550 with tuning\n\n## Final submission\nI trained 3 models described above, tuned them, predicted original test images, predicted mirrored test images, and computed weighted average.\n\n## Notes\n1. By increasing augmentation schedule I mean the following: train without augmentation until plateau (or until you feel like enough), then apply soft augmentation (wide range of values) during several epochs: e.g. `rotate(np.random.randint(-30, 30))`, then apply hard augmentation (short range or even two possible values) during another several epochs: e.g. `rotate(np.random.choice([-30, 30]))`.\n2. About training times. I used batch generator derived from [Sequence](https://keras.io/utils/#sequence) and multiprocessing with 8 processes per GPU. My typical hardware setup on GCP looks like: 1x P100, 8x CPU, 15 GB RAM, SSD or 2x P100, 16x CPU, 30 GB RAM, SSD, etc.\n\n## Side Notes\n1. Time after time I had been running 8x V100. It definitely feels like a ride on racing motorbike. I mean not only extreme speed of computation. I also mean adrenaline related to the speed of money flow.\n2. Looking at some images I was curious about one thing. How often do you experience something like nostalgia about the country you’ve never been?\n3. And by the way have you seen [convolved foxes](https://www.kaggle.com/c/inclusive-images-challenge/discussion/69789)?",
      "votes": null
    },
    {
      "id": "426533",
      "postDate": "11/23/2018 12:01:15",
      "content": "<p>Congrats and thanks for sharing.</p>",
      "rawMarkdown": "Congrats and thanks for sharing.",
      "votes": null
    },
    {
      "id": "433005",
      "postDate": "12/04/2018 14:58:37",
      "content": "<p>Congratulations and thank you for sharing this overview </p>",
      "rawMarkdown": "Congratulations and thank you for sharing this overview",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 426533,
      "author_name": "sheriytm",
      "author_url": "",
      "post_date": "11/23/2018 12:01:15",
      "content": "<p>Congrats and thanks for sharing.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 433005,
      "author_name": "ashishvarier",
      "author_url": "",
      "post_date": "12/04/2018 14:58:37",
      "content": "<p>Congratulations and thank you for sharing this overview </p>",
      "votes": null,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "426507": "I don’t know about other people, but when I saw $1,000 in my inbox I had Christmas Morning moment. Free GCP credits are extremely important for our community. Many thanks to Google &amp; Kaggle!\n\n## Solution\nEnsemble of 3 Deep CNNs: ResNet50, InceptionV3, and InceptionResNetV2.\n\n## Concept\nWe expected test images to come from different regions. So there were no doubts that augmentation and ensembling would be the most important directions to make robust models. But later when detailed EDA showed substantial difference in train/test label distributions it became clear that tuning models using tuning set would also play very important role. \n\n## Diversity\nTo get more diversity for ensemble I used following approaches: \n\n1. Different CNN architectures\n2. Different image sizes\n3. Train with/without augmentation\n4. Different augmentation schedules\n\n## Models\nOf course all models were trained from scratch according to the rules. I think it was nice because there was no those usual pretrained model search rush :) Scores below are from Stage 1 LB.\n\n1. ResNet50, 57 epochs, 224x224, adam 0.001, batch 64, increasing augmentation schedule, 4 hours per epoch on 1x P100, 0.311 without tuning, 0.510 with tuning\n2. InceptionV3, 25 epochs, 400x400, adam 0.001, batch 32, increasing augmentation schedule, 9 hours per epoch on 1x P100, 0.327 without tuning, 0.545 with tuning\n3. InceptionResNetV2, 8 epochs, 598x598, adam 0.001, batch 12, no augmentation, 38 hours per epoch on 1x P100, 0.318 without tuning, 0.550 with tuning\n\n## Final submission\nI trained 3 models described above, tuned them, predicted original test images, predicted mirrored test images, and computed weighted average.\n\n## Notes\n1. By increasing augmentation schedule I mean the following: train without augmentation until plateau (or until you feel like enough), then apply soft augmentation (wide range of values) during several epochs: e.g. `rotate(np.random.randint(-30, 30))`, then apply hard augmentation (short range or even two possible values) during another several epochs: e.g. `rotate(np.random.choice([-30, 30]))`.\n2. About training times. I used batch generator derived from [Sequence](https://keras.io/utils/#sequence) and multiprocessing with 8 processes per GPU. My typical hardware setup on GCP looks like: 1x P100, 8x CPU, 15 GB RAM, SSD or 2x P100, 16x CPU, 30 GB RAM, SSD, etc.\n\n## Side Notes\n1. Time after time I had been running 8x V100. It definitely feels like a ride on racing motorbike. I mean not only extreme speed of computation. I also mean adrenaline related to the speed of money flow.\n2. Looking at some images I was curious about one thing. How often do you experience something like nostalgia about the country you’ve never been?\n3. And by the way have you seen [convolved foxes](https://www.kaggle.com/c/inclusive-images-challenge/discussion/69789)?",
    "426533": "Congrats and thanks for sharing.",
    "433005": "Congratulations and thank you for sharing this overview"
  },
  "source": "meta"
}