{
  "id": 117718,
  "title": "Small tip to save your ensemble time",
  "url": "/competitions/understanding_cloud_organization/discussion/117718",
  "author_name": "",
  "post_date": "2019-11-17T10:25:33.193880Z",
  "votes": 14,
  "comment_count": 2,
  "views": 0,
  "content": "<p>Since I don't own a GPU and GPU time in kaggle is quite precious. So after I done training a model, I will use colab or kaggle GPU to predict the raw prediction(without any post-processing) and save the raw prediction with npy file. </p>\n\n<p>Then save the npy file to my local memory. When you want to ensemble the model, you just need to load the npy files of the models you prefer and do any post-processing you want. It only take a little time to finish, even on CPU. And you only spend your GPU time on a model once.</p>\n\n<p>Also if you have trained several models and try to find the best combination of your models, this is much easier to do.</p>\n\n<p>save:\n<code>np.save('seg_prediction', prediction)</code>\nload:\n<code>prediction = np.load('seg_prediction.npy')</code></p>\n\n<p>Make sure you save the npy file in small batch, or your RAM is gonna run out very soon.\n(I used to save 250 masks in one npy file, it is workable for my laptop(8G ram) )</p>\n\n<p>Just a small tip for people who don't own a gpu either.</p>",
  "messages": [
    {
      "id": "674959",
      "postDate": "11/17/2019 10:25:33",
      "content": "<p>Since I don't own a GPU and GPU time in kaggle is quite precious. So after I done training a model, I will use colab or kaggle GPU to predict the raw prediction(without any post-processing) and save the raw prediction with npy file. </p>\n\n<p>Then save the npy file to my local memory. When you want to ensemble the model, you just need to load the npy files of the models you prefer and do any post-processing you want. It only take a little time to finish, even on CPU. And you only spend your GPU time on a model once.</p>\n\n<p>Also if you have trained several models and try to find the best combination of your models, this is much easier to do.</p>\n\n<p>save:\n<code>np.save('seg_prediction', prediction)</code>\nload:\n<code>prediction = np.load('seg_prediction.npy')</code></p>\n\n<p>Make sure you save the npy file in small batch, or your RAM is gonna run out very soon.\n(I used to save 250 masks in one npy file, it is workable for my laptop(8G ram) )</p>\n\n<p>Just a small tip for people who don't own a gpu either.</p>",
      "rawMarkdown": "Since I don't own a GPU and GPU time in kaggle is quite precious. So after I done training a model, I will use colab or kaggle GPU to predict the raw prediction(without any post-processing) and save the raw prediction with npy file. \n\nThen save the npy file to my local memory. When you want to ensemble the model, you just need to load the npy files of the models you prefer and do any post-processing you want. It only take a little time to finish, even on CPU. And you only spend your GPU time on a model once.\n\nAlso if you have trained several models and try to find the best combination of your models, this is much easier to do.\n\nsave:\n`np.save('seg_prediction', prediction)`\nload:\n`prediction = np.load('seg_prediction.npy')`\n\nMake sure you save the npy file in small batch, or your RAM is gonna run out very soon.\n(I used to save 250 masks in one npy file, it is workable for my laptop(8G ram) )\n\nJust a small tip for people who don't own a gpu either.",
      "votes": null
    },
    {
      "id": "674962",
      "postDate": "11/17/2019 10:47:25",
      "content": "<p>change to 8-bit e.g. probability8bit =  (probability*255).astype(np.uint8)\nand use npz.</p>\n\n<p>if you want, you can zero out low values for better compression, e.g. probability8bit[probability8bit&lt;16]=0</p>",
      "rawMarkdown": "change to 8-bit e.g. probability8bit =  (probability*255).astype(np.uint8)\nand use npz.\n\nif you want, you can zero out low values for better compression, e.g. probability8bit[probability8bit&lt;16]=0",
      "votes": null
    },
    {
      "id": "675191",
      "postDate": "11/17/2019 18:23:22",
      "content": "<p>This is useful, thanks for sharing.</p>",
      "rawMarkdown": "This is useful, thanks for sharing.",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 674962,
      "author_name": "hengck23",
      "author_url": "",
      "post_date": "11/17/2019 10:47:25",
      "content": "<p>change to 8-bit e.g. probability8bit =  (probability*255).astype(np.uint8)\nand use npz.</p>\n\n<p>if you want, you can zero out low values for better compression, e.g. probability8bit[probability8bit&lt;16]=0</p>",
      "votes": null,
      "replies": [
        {
          "id": 675191,
          "author_name": "prachi1211",
          "author_url": "",
          "post_date": "11/17/2019 18:23:22",
          "content": "<p>This is useful, thanks for sharing.</p>",
          "votes": null,
          "replies": []
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "674959": "Since I don't own a GPU and GPU time in kaggle is quite precious. So after I done training a model, I will use colab or kaggle GPU to predict the raw prediction(without any post-processing) and save the raw prediction with npy file. \n\nThen save the npy file to my local memory. When you want to ensemble the model, you just need to load the npy files of the models you prefer and do any post-processing you want. It only take a little time to finish, even on CPU. And you only spend your GPU time on a model once.\n\nAlso if you have trained several models and try to find the best combination of your models, this is much easier to do.\n\nsave:\n`np.save('seg_prediction', prediction)`\nload:\n`prediction = np.load('seg_prediction.npy')`\n\nMake sure you save the npy file in small batch, or your RAM is gonna run out very soon.\n(I used to save 250 masks in one npy file, it is workable for my laptop(8G ram) )\n\nJust a small tip for people who don't own a gpu either.",
    "674962": "change to 8-bit e.g. probability8bit =  (probability*255).astype(np.uint8)\nand use npz.\n\nif you want, you can zero out low values for better compression, e.g. probability8bit[probability8bit&lt;16]=0",
    "675191": "This is useful, thanks for sharing."
  },
  "source": "meta"
}