{
  "id": 193422,
  "title": "A CNN Post-Processing method for Image level.",
  "url": "/competitions/rsna-str-pulmonary-embolism-detection/discussion/193422",
  "author_name": "Gary",
  "post_date": "2020-10-27T02:42:44.263000",
  "votes": 19,
  "comment_count": 2,
  "views": 0,
  "content": "<p>Congratulations to all the participants and the winners. And I also want to thank my teammates <a href=\"https://www.kaggle.com/haqishen\" target=\"_blank\">qishen</a>, <a href=\"https://www.kaggle.com/boliu0\" target=\"_blank\">Bo</a> for their efforts.<br>\nI'd like to share a trick used by our team here, which may not be as good as the top team's solution, but I hope this can help you.<br>\nAnd this trick is a post-processing method for image level.</p>\n<h2>Extract the probability prediction</h2>\n<p>Extract the probability prediction from 2D-CNN(like efficientnet-b0), which was trained on 2D images. And save the prediction for next step.</p>\n<h2>Pooling Post-Processing</h2>\n<p>From the previous step, we have the 2d-CNN probability, and then we sort them by the <strong>ImagePositionPatient_z</strong>.  As we all know, contiguous images from same person should have similar label/probability after sorted. So we used 1D-Pooling to adjust the contiguous probability, it can improve our image level CV by about 0.01+<br>\nThe code below.<br>\n<img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1270655%2F4ee0cb9c54a362ff8f2cc4ff7d5088dc%2Fpoolingpp.png?generation=1603765054719087&amp;alt=media\" alt=\"\"></p>\n<h2>CNN Post-Processing</h2>\n<p>Meanwhile, we also designed a simple cnn as a stage2-model to predict the contiguous probability, hope that the cnn can learn more context information from the contiguous probability. And the training-set is also 2d-CNN probabilitysorted by <strong>ImagePositionPatient_z</strong>. In training, we sampling 80 probs to train the cnn, like that.<br>\nThe CNN Post-Processing is improve our image level CV by about 0.01+.<br>\n<img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1270655%2F099c16938208c0c881f7c53440b56475%2Fsampling.jpg?generation=1603765599705036&amp;alt=media\" alt=\"\"><br>\nAnd the shape of model's output is same as input. Finally, we interpolated the probability predictions back based on the total number of the person's original image samples.<br>\n<img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1270655%2Feca02ccfc3151804652067a84bd9cde5%2Finter.jpg?generation=1603765870690625&amp;alt=media\" alt=\"\"></p>\n<p>and the cnn model<br>\n<img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1270655%2F9e0cca527bed91c0d0ff03bd340ffcbc%2Fcnn.jpg?generation=1603765956961639&amp;alt=media\" alt=\"\"></p>\n<h2>Combined the Pooling Post-Processing and CNN Post-Processing</h2>\n<p>Finally, just combined the above two Post-Processing results directly. it would improve our image level CV by about 0.02+.</p>\n<p>That's all I want to share, and I hope it helps.</p>",
  "messages": [
    {
      "id": 1061454,
      "postDate": "2020-10-27T02:42:44.263Z",
      "content": "<p>Congratulations to all the participants and the winners. And I also want to thank my teammates <a href=\"https://www.kaggle.com/haqishen\" target=\"_blank\">qishen</a>, <a href=\"https://www.kaggle.com/boliu0\" target=\"_blank\">Bo</a> for their efforts.<br>\nI'd like to share a trick used by our team here, which may not be as good as the top team's solution, but I hope this can help you.<br>\nAnd this trick is a post-processing method for image level.</p>\n<h2>Extract the probability prediction</h2>\n<p>Extract the probability prediction from 2D-CNN(like efficientnet-b0), which was trained on 2D images. And save the prediction for next step.</p>\n<h2>Pooling Post-Processing</h2>\n<p>From the previous step, we have the 2d-CNN probability, and then we sort them by the <strong>ImagePositionPatient_z</strong>.  As we all know, contiguous images from same person should have similar label/probability after sorted. So we used 1D-Pooling to adjust the contiguous probability, it can improve our image level CV by about 0.01+<br>\nThe code below.<br>\n<img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1270655%2F4ee0cb9c54a362ff8f2cc4ff7d5088dc%2Fpoolingpp.png?generation=1603765054719087&amp;alt=media\" alt=\"\"></p>\n<h2>CNN Post-Processing</h2>\n<p>Meanwhile, we also designed a simple cnn as a stage2-model to predict the contiguous probability, hope that the cnn can learn more context information from the contiguous probability. And the training-set is also 2d-CNN probabilitysorted by <strong>ImagePositionPatient_z</strong>. In training, we sampling 80 probs to train the cnn, like that.<br>\nThe CNN Post-Processing is improve our image level CV by about 0.01+.<br>\n<img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1270655%2F099c16938208c0c881f7c53440b56475%2Fsampling.jpg?generation=1603765599705036&amp;alt=media\" alt=\"\"><br>\nAnd the shape of model's output is same as input. Finally, we interpolated the probability predictions back based on the total number of the person's original image samples.<br>\n<img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1270655%2Feca02ccfc3151804652067a84bd9cde5%2Finter.jpg?generation=1603765870690625&amp;alt=media\" alt=\"\"></p>\n<p>and the cnn model<br>\n<img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1270655%2F9e0cca527bed91c0d0ff03bd340ffcbc%2Fcnn.jpg?generation=1603765956961639&amp;alt=media\" alt=\"\"></p>\n<h2>Combined the Pooling Post-Processing and CNN Post-Processing</h2>\n<p>Finally, just combined the above two Post-Processing results directly. it would improve our image level CV by about 0.02+.</p>\n<p>That's all I want to share, and I hope it helps.</p>",
      "rawMarkdown": "Congratulations to all the participants and the winners. And I also want to thank my teammates [qishen](https://www.kaggle.com/haqishen), [Bo](https://www.kaggle.com/boliu0) for their efforts.\nI'd like to share a trick used by our team here, which may not be as good as the top team's solution, but I hope this can help you.\nAnd this trick is a post-processing method for image level.\n\n## Extract the probability prediction\nExtract the probability prediction from 2D-CNN(like efficientnet-b0), which was trained on 2D images. And save the prediction for next step.\n\n## Pooling Post-Processing\nFrom the previous step, we have the 2d-CNN probability, and then we sort them by the **ImagePositionPatient_z**.  As we all know, contiguous images from same person should have similar label/probability after sorted. So we used 1D-Pooling to adjust the contiguous probability, it can improve our image level CV by about 0.01+\nThe code below.\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1270655%2F4ee0cb9c54a362ff8f2cc4ff7d5088dc%2Fpoolingpp.png?generation=1603765054719087&alt=media)\n\n## CNN Post-Processing\nMeanwhile, we also designed a simple cnn as a stage2-model to predict the contiguous probability, hope that the cnn can learn more context information from the contiguous probability. And the training-set is also 2d-CNN probabilitysorted by **ImagePositionPatient_z**. In training, we sampling 80 probs to train the cnn, like that.\nThe CNN Post-Processing is improve our image level CV by about 0.01+.\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1270655%2F099c16938208c0c881f7c53440b56475%2Fsampling.jpg?generation=1603765599705036&alt=media)\nAnd the shape of model's output is same as input. Finally, we interpolated the probability predictions back based on the total number of the person's original image samples.\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1270655%2Feca02ccfc3151804652067a84bd9cde5%2Finter.jpg?generation=1603765870690625&alt=media)\n\nand the cnn model\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1270655%2F9e0cca527bed91c0d0ff03bd340ffcbc%2Fcnn.jpg?generation=1603765956961639&alt=media)\n\n## Combined the Pooling Post-Processing and CNN Post-Processing\nFinally, just combined the above two Post-Processing results directly. it would improve our image level CV by about 0.02+.\n\nThat's all I want to share, and I hope it helps.\n\n\n\n\n\n\n\n",
      "votes": 19
    },
    {
      "id": 1061643,
      "postDate": "2020-10-27T06:56:32.457Z",
      "content": "<p><a href=\"https://www.kaggle.com/garybios\" target=\"_blank\">@garybios</a> congrats for the standing  &amp; many thanks for sharing this insight.. could be useful in other competitions..<br>\nSelf attn method also worked quite good in lifting score above baseline score of stage2 public kernel..<br>\non the top of this ,this could further  push the score..</p>\n<p>btw i look to work on lyft next ,with background of baidu Auto competition.</p>\n<p>Would you like to join it with me there </p>",
      "rawMarkdown": "@garybios congrats for the standing  & many thanks for sharing this insight.. could be useful in other competitions..\nSelf attn method also worked quite good in lifting score above baseline score of stage2 public kernel..\non the top of this ,this could further  push the score..\n\nbtw i look to work on lyft next ,with background of baidu Auto competition.\n\nWould you like to join it with me there \n \n\n",
      "votes": -3
    },
    {
      "id": 1063918,
      "postDate": "2020-10-29T13:58:39.650Z",
      "content": "<p><a href=\"https://www.kaggle.com/garybios\" target=\"_blank\">@garybios</a> Thanks for sharing this. It is quite a nice idea to use 1d pooling for post-processing. But did you also use other post-processing after the output of this? Or this 1d pooling design already can cover the consistent of competition metric? Thanks in advance</p>",
      "rawMarkdown": "@garybios Thanks for sharing this. It is quite a nice idea to use 1d pooling for post-processing. But did you also use other post-processing after the output of this? Or this 1d pooling design already can cover the consistent of competition metric? Thanks in advance"
    }
  ],
  "comments": [
    {
      "id": 1061643,
      "author_name": "Jaideep",
      "author_url": "",
      "post_date": "2020-10-27T06:56:32.457000",
      "content": "<p><a href=\"https://www.kaggle.com/garybios\" target=\"_blank\">@garybios</a> congrats for the standing  &amp; many thanks for sharing this insight.. could be useful in other competitions..<br>\nSelf attn method also worked quite good in lifting score above baseline score of stage2 public kernel..<br>\non the top of this ,this could further  push the score..</p>\n<p>btw i look to work on lyft next ,with background of baidu Auto competition.</p>\n<p>Would you like to join it with me there </p>",
      "votes": -3,
      "replies": []
    },
    {
      "id": 1063918,
      "author_name": "Tsai29",
      "author_url": "",
      "post_date": "2020-10-29T13:58:39.650000",
      "content": "<p><a href=\"https://www.kaggle.com/garybios\" target=\"_blank\">@garybios</a> Thanks for sharing this. It is quite a nice idea to use 1d pooling for post-processing. But did you also use other post-processing after the output of this? Or this 1d pooling design already can cover the consistent of competition metric? Thanks in advance</p>",
      "votes": 0,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "1061454": "Congratulations to all the participants and the winners. And I also want to thank my teammates [qishen](https://www.kaggle.com/haqishen), [Bo](https://www.kaggle.com/boliu0) for their efforts.\nI'd like to share a trick used by our team here, which may not be as good as the top team's solution, but I hope this can help you.\nAnd this trick is a post-processing method for image level.\n\n## Extract the probability prediction\nExtract the probability prediction from 2D-CNN(like efficientnet-b0), which was trained on 2D images. And save the prediction for next step.\n\n## Pooling Post-Processing\nFrom the previous step, we have the 2d-CNN probability, and then we sort them by the **ImagePositionPatient_z**.  As we all know, contiguous images from same person should have similar label/probability after sorted. So we used 1D-Pooling to adjust the contiguous probability, it can improve our image level CV by about 0.01+\nThe code below.\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1270655%2F4ee0cb9c54a362ff8f2cc4ff7d5088dc%2Fpoolingpp.png?generation=1603765054719087&alt=media)\n\n## CNN Post-Processing\nMeanwhile, we also designed a simple cnn as a stage2-model to predict the contiguous probability, hope that the cnn can learn more context information from the contiguous probability. And the training-set is also 2d-CNN probabilitysorted by **ImagePositionPatient_z**. In training, we sampling 80 probs to train the cnn, like that.\nThe CNN Post-Processing is improve our image level CV by about 0.01+.\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1270655%2F099c16938208c0c881f7c53440b56475%2Fsampling.jpg?generation=1603765599705036&alt=media)\nAnd the shape of model's output is same as input. Finally, we interpolated the probability predictions back based on the total number of the person's original image samples.\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1270655%2Feca02ccfc3151804652067a84bd9cde5%2Finter.jpg?generation=1603765870690625&alt=media)\n\nand the cnn model\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1270655%2F9e0cca527bed91c0d0ff03bd340ffcbc%2Fcnn.jpg?generation=1603765956961639&alt=media)\n\n## Combined the Pooling Post-Processing and CNN Post-Processing\nFinally, just combined the above two Post-Processing results directly. it would improve our image level CV by about 0.02+.\n\nThat's all I want to share, and I hope it helps.\n\n\n\n\n\n\n\n",
    "1061643": "@garybios congrats for the standing  & many thanks for sharing this insight.. could be useful in other competitions..\nSelf attn method also worked quite good in lifting score above baseline score of stage2 public kernel..\non the top of this ,this could further  push the score..\n\nbtw i look to work on lyft next ,with background of baidu Auto competition.\n\nWould you like to join it with me there \n \n\n",
    "1063918": "@garybios Thanks for sharing this. It is quite a nice idea to use 1d pooling for post-processing. But did you also use other post-processing after the output of this? Or this 1d pooling design already can cover the consistent of competition metric? Thanks in advance"
  }
}