{
  "id": 65438,
  "title": "Storing and using out-of-fold predictions",
  "url": "/competitions/rsna-pneumonia-detection-challenge/discussion/65438",
  "author_name": "",
  "post_date": "2018-09-10T23:59:03.459250400Z",
  "votes": 7,
  "comment_count": 1,
  "views": 0,
  "content": "<p>@CoreyLevinson has <a href=\"https://www.kaggle.com/returnofsputnik/jonne-cnn-create-out-of-folds-4fold-8epoc\">a kernel</a> that generates out-of-fold predictions for 4 folds using the <a href=\"https://www.kaggle.com/jonnedtc/cnn-segmentation-connected-components\">model</a> popularized by @Jonne.  Corey saves the OOF predictions in the same form required for test predictions (EDIT: but there is a bug; see comment below).  This is useful for cross-validating individual models, but if one is trying to stack models, we need a way to combine the results.  One possibility is to use non-max suppression, as discussed in <a href=\"https://www.kaggle.com/c/rsna-pneumonia-detection-challenge/discussion/64736\">this thread</a>.  After thinking about it, I'm not sure that's the best approach, particularly when some models are going to be better than others but you want to get all the information you can out of the combination.  It doesn't allow for much subtlety in combining predictions.  </p>\n\n<p>The alternative is to combine pixel probabilities directly and then generate boxes from the resulting probabilities.  The problem with that approach is that there are 25 gigapixels of data in each set of OOF predictions, which makes them difficult to work with unless there is some kind of compression.  (<strike>In particular, kaggle kernels, last time I looked, had a 1 GB size limit for outputs, so the compression has to be good enough to get an average of 25 pixels into one byte of data.</strike> EDIT: Apparently kaggle kernels <a href=\"https://www.kaggle.com/docs/kernels\">now get</a> 5GB of disk space, so the compression only has to be good enough to get an average of 5 pixels into one byte of data.)  Fortunately, since typical predictions have a lot of redundancy in them, there is a lot of room for compression.  In <a href=\"https://www.kaggle.com/aharless/oof-probabilities\">this kernel</a>, I've reduced the pixel space by a factor of 16 (since that what the predictions of Jonne's model generate anyhow), represented each 16-pixel unit as uint8, and then gzipped the result.  The whole set of OOF predictions in this example fits in 8GB, though a richer model would of course allow for less compression.  I also have <a href=\"https://www.kaggle.com/aharless/cv-scores-from-256x256-oof-predictions\">a kernel</a> that takes the resulting file and generates a CV score.</p>",
  "messages": [
    {
      "id": "385399",
      "postDate": "09/10/2018 23:59:03",
      "content": "<p>@CoreyLevinson has <a href=\"https://www.kaggle.com/returnofsputnik/jonne-cnn-create-out-of-folds-4fold-8epoc\">a kernel</a> that generates out-of-fold predictions for 4 folds using the <a href=\"https://www.kaggle.com/jonnedtc/cnn-segmentation-connected-components\">model</a> popularized by @Jonne.  Corey saves the OOF predictions in the same form required for test predictions (EDIT: but there is a bug; see comment below).  This is useful for cross-validating individual models, but if one is trying to stack models, we need a way to combine the results.  One possibility is to use non-max suppression, as discussed in <a href=\"https://www.kaggle.com/c/rsna-pneumonia-detection-challenge/discussion/64736\">this thread</a>.  After thinking about it, I'm not sure that's the best approach, particularly when some models are going to be better than others but you want to get all the information you can out of the combination.  It doesn't allow for much subtlety in combining predictions.  </p>\n\n<p>The alternative is to combine pixel probabilities directly and then generate boxes from the resulting probabilities.  The problem with that approach is that there are 25 gigapixels of data in each set of OOF predictions, which makes them difficult to work with unless there is some kind of compression.  (<strike>In particular, kaggle kernels, last time I looked, had a 1 GB size limit for outputs, so the compression has to be good enough to get an average of 25 pixels into one byte of data.</strike> EDIT: Apparently kaggle kernels <a href=\"https://www.kaggle.com/docs/kernels\">now get</a> 5GB of disk space, so the compression only has to be good enough to get an average of 5 pixels into one byte of data.)  Fortunately, since typical predictions have a lot of redundancy in them, there is a lot of room for compression.  In <a href=\"https://www.kaggle.com/aharless/oof-probabilities\">this kernel</a>, I've reduced the pixel space by a factor of 16 (since that what the predictions of Jonne's model generate anyhow), represented each 16-pixel unit as uint8, and then gzipped the result.  The whole set of OOF predictions in this example fits in 8GB, though a richer model would of course allow for less compression.  I also have <a href=\"https://www.kaggle.com/aharless/cv-scores-from-256x256-oof-predictions\">a kernel</a> that takes the resulting file and generates a CV score.</p>",
      "rawMarkdown": "CoreyLevinson has [a kernel][1] that generates out-of-fold predictions for 4 folds using the [model][2] popularized by @Jonne.  Corey saves the OOF predictions in the same form required for test predictions (EDIT: but there is a bug; see comment below).  This is useful for cross-validating individual models, but if one is trying to stack models, we need a way to combine the results.  One possibility is to use non-max suppression, as discussed in [this thread][3].  After thinking about it, I'm not sure that's the best approach, particularly when some models are going to be better than others but you want to get all the information you can out of the combination.  It doesn't allow for much subtlety in combining predictions.  \n\nThe alternative is to combine pixel probabilities directly and then generate boxes from the resulting probabilities.  The problem with that approach is that there are 25 gigapixels of data in each set of OOF predictions, which makes them difficult to work with unless there is some kind of compression.  (<strike>In particular, kaggle kernels, last time I looked, had a 1 GB size limit for outputs, so the compression has to be good enough to get an average of 25 pixels into one byte of data.</strike> EDIT: Apparently kaggle kernels [now get][4] 5GB of disk space, so the compression only has to be good enough to get an average of 5 pixels into one byte of data.)  Fortunately, since typical predictions have a lot of redundancy in them, there is a lot of room for compression.  In [this kernel][5], I've reduced the pixel space by a factor of 16 (since that what the predictions of Jonne's model generate anyhow), represented each 16-pixel unit as uint8, and then gzipped the result.  The whole set of OOF predictions in this example fits in 8GB, though a richer model would of course allow for less compression.  I also have [a kernel][6] that takes the resulting file and generates a CV score.\n\n [1]: https://www.kaggle.com/returnofsputnik/jonne-cnn-create-out-of-folds-4fold-8epoc\n [2]: https://www.kaggle.com/jonnedtc/cnn-segmentation-connected-components\n [3]: https://www.kaggle.com/c/rsna-pneumonia-detection-challenge/discussion/64736\n [4]: https://www.kaggle.com/docs/kernels\n [5]: https://www.kaggle.com/aharless/oof-probabilities\n [6]: https://www.kaggle.com/aharless/cv-scores-from-256x256-oof-predictions",
      "votes": null
    },
    {
      "id": "386330",
      "postDate": "09/12/2018 16:27:27",
      "content": "<p>I want to mention that my kernel is not a very good one for using as folds. It only saves one bounding box per person; it overwrites previous boxes if the model finds more than one box. Yea, it's an error I just haven't fixed yet. So, keep that as a warning!</p>",
      "rawMarkdown": "I want to mention that my kernel is not a very good one for using as folds. It only saves one bounding box per person; it overwrites previous boxes if the model finds more than one box. Yea, it's an error I just haven't fixed yet. So, keep that as a warning!",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 386330,
      "author_name": "returnofsputnik",
      "author_url": "",
      "post_date": "09/12/2018 16:27:27",
      "content": "<p>I want to mention that my kernel is not a very good one for using as folds. It only saves one bounding box per person; it overwrites previous boxes if the model finds more than one box. Yea, it's an error I just haven't fixed yet. So, keep that as a warning!</p>",
      "votes": null,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "385399": "CoreyLevinson has [a kernel][1] that generates out-of-fold predictions for 4 folds using the [model][2] popularized by @Jonne.  Corey saves the OOF predictions in the same form required for test predictions (EDIT: but there is a bug; see comment below).  This is useful for cross-validating individual models, but if one is trying to stack models, we need a way to combine the results.  One possibility is to use non-max suppression, as discussed in [this thread][3].  After thinking about it, I'm not sure that's the best approach, particularly when some models are going to be better than others but you want to get all the information you can out of the combination.  It doesn't allow for much subtlety in combining predictions.  \n\nThe alternative is to combine pixel probabilities directly and then generate boxes from the resulting probabilities.  The problem with that approach is that there are 25 gigapixels of data in each set of OOF predictions, which makes them difficult to work with unless there is some kind of compression.  (<strike>In particular, kaggle kernels, last time I looked, had a 1 GB size limit for outputs, so the compression has to be good enough to get an average of 25 pixels into one byte of data.</strike> EDIT: Apparently kaggle kernels [now get][4] 5GB of disk space, so the compression only has to be good enough to get an average of 5 pixels into one byte of data.)  Fortunately, since typical predictions have a lot of redundancy in them, there is a lot of room for compression.  In [this kernel][5], I've reduced the pixel space by a factor of 16 (since that what the predictions of Jonne's model generate anyhow), represented each 16-pixel unit as uint8, and then gzipped the result.  The whole set of OOF predictions in this example fits in 8GB, though a richer model would of course allow for less compression.  I also have [a kernel][6] that takes the resulting file and generates a CV score.\n\n [1]: https://www.kaggle.com/returnofsputnik/jonne-cnn-create-out-of-folds-4fold-8epoc\n [2]: https://www.kaggle.com/jonnedtc/cnn-segmentation-connected-components\n [3]: https://www.kaggle.com/c/rsna-pneumonia-detection-challenge/discussion/64736\n [4]: https://www.kaggle.com/docs/kernels\n [5]: https://www.kaggle.com/aharless/oof-probabilities\n [6]: https://www.kaggle.com/aharless/cv-scores-from-256x256-oof-predictions",
    "386330": "I want to mention that my kernel is not a very good one for using as folds. It only saves one bounding box per person; it overwrites previous boxes if the model finds more than one box. Yea, it's an error I just haven't fixed yet. So, keep that as a warning!"
  },
  "source": "meta"
}