{
  "id": 118249,
  "title": "4th Place Solution with code",
  "url": "/competitions/rsna-intracranial-hemorrhage-detection/discussion/118249",
  "author_name": "Mindy X",
  "post_date": "2019-11-20T10:34:54.500000",
  "votes": 41,
  "comment_count": 12,
  "views": 0,
  "content": "<p>Code: <a href=\"https://github.com/XUXUSSS/kaggle_rsna2019_4th_solution\">https://github.com/XUXUSSS/kaggle_rsna2019_4th_solution</a> \nOur code is based on Appian's repo: <a href=\"https://github.com/appian42/kaggle-rsna-intracranial-hemorrhage\">https://github.com/appian42/kaggle-rsna-intracranial-hemorrhage</a></p>\n\n<h1>Overview of the proposed method</h1>\n\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F2215248%2F29e2a5b18ea11e273e34e3fd1ffff119%2Foverview.png?generation=1574318153545078&amp;alt=media\" alt=\"\"></p>\n\n<p>Our solution includes two stages. We train  2D CNN models in stage 1 for feature extraction, and 1D + 3D CNN models in stage 2 for classification.</p>\n\n<h2>Preprocess</h2>\n\n<ol>\n<li>Two window policies:\na)  use Appian’s windowing policy\n          i.    Three windows are: [40, 80], [80, 200], [40, 380][<a href=\"https://github.com/XUXUSSS/kaggle_rsna2019_4th_solution/blob/1e9b6a5bb46d1d329f4af04e9066a3a0b7fa7769/IFE_1/src/cnn/dataset/custom_dataset.py#L68\">link</a>]\nb)  Stack three consecutive slices to a 3-channel image. [<a href=\"https://github.com/XUXUSSS/kaggle_rsna2019_4th_solution/blob/1e9b6a5bb46d1d329f4af04e9066a3a0b7fa7769/IFE_3/src/cnn/dataset/custom_dataset.py#L97\">link</a>] \n          i.    Window: [40, 80] </li>\n<li>Remove corrupted images </li>\n<li>Filter out blank images by \na)  Obtain the difference between maximum and minimum intensity value of each image, i.e., the intensity range, after applying a custom windowing scheme (center = 40, window = 80) \nb)  Remove images with intensity range &lt; 60 from both training and test sets. \nc)  The removed test images will be classified as negative during post-processing.</li>\n<li>Extract useful meta data from dicom files\na)  Patient ID\nb)  StudyInstance ID\nc)  SeriesInstance ID\nd)  Position2</li>\n<li>Make patient-wise stratified five folds\na)  Images from one patient always belong to the same fold\nb)  Class distributions are roughly the same across different folds</li>\n</ol>\n\n<h2>STAGE 1: 2D Image Feature Extraction</h2>\n\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F2215248%2F69ccd1b230d567e1c473413541545b27%2FfeatureExtraction.png?generation=1574240192793088&amp;alt=media\" alt=\"\"></p>\n\n<h3>1.  Training strategy:</h3>\n\n<p>a)  Randomly split the training dataset into 5 folds and train the model five times. Use 4 folds as training set and 1 fold as validation set each time.</p>\n\n<h3>2.  Models</h3>\n\na) EfficientNet B0\n\n<p>i.  ImageNet pretrained\nii. Input image size: 512x512\niii.    Augmentation: random crop, random hflip, random rotate, random contrast\niv. 5-fold training\nv.  TTA5： random crop, random hflip , random rotate, random contrast</p>\n\nb) ResNext50 32x4d swsl\n\n<p>i.  Semi-Supervised and Semi-Weakly Supervised ImageNet Models <a href=\"https://github.com/facebookresearch/semi-supervised-ImageNet1K-models\">https://github.com/facebookresearch/semi-supervised-ImageNet1K-models</a>\nii. Input image size: 448x448\niii.    Augmentation: random crop, random hflip , random rotate, random contrast, pixel and window jittering\niv. 5-fold training\nv.     Cosine learning rate scheduler\nvi. TTA5： random crop, random hflip , random rotate, random contrast</p>\n\n<h3>Summary of stage 1 models:</h3>\n\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F2215248%2F9e735ab0c676de4ca8c1eb94df51404e%2FIFLmodels.png?generation=1574238657232358&amp;alt=media\" alt=\"\"></p>\n\n<h2>STAGE1: Meta Data Feature Engineering</h2>\n\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F2215248%2F22895a3229aa1374353d025496988e4e%2Fmetadata.png?generation=1574245207505107&amp;alt=media\" alt=\"\"></p>\n\n<h2>STAGE2: Slice Sequence Model</h2>\n\n<p>In stage2,   we train 1D CNN model and 1D+3D CNN models for classification.</p>\n\n<h3>1D CNN model:</h3>\n\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F2215248%2Ff3f240c485b348322e17a5081252863c%2F1Dconv.png?generation=1574239313394661&amp;alt=media\" alt=\"\"></p>\n\n<h3>1.  Pipeline:</h3>\n\n<p>a)  Extract 1D feature and metadata from stage 1\nb)  Stack the features that belong to one CT series together.\nc)  Pass the stacked feature to customized fully convolutional neuronal networks, and generate the output. [<a href=\"https://github.com/XUXUSSS/kaggle_rsna2019_4th_solution/blob/ed1c6f59b3077e3c8226671a5d9c38c2028aab5d/cls_2/src/cnn/models/model.py#L22\">link</a>]</p>\n\n<h3>2.  Augmentation:</h3>\n\n<p>a)  No data augmentation</p>\n\n<h3>3.  Training strategy</h3>\n\n<p>a)  Follow 2D CNN’s fold split</p>\n\n<h3>1D+3D CNN model</h3>\n\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F2215248%2Fb5e6427293552f7563b11f71610203ea%2F1D3D.png?generation=1574239073870529&amp;alt=media\" alt=\"\"></p>\n\n<h3>1.  Pipeline:</h3>\n\n<p>a)  Extract metatdata,  1D and 3D features from stage 1.\nb)  Stack the features that belong to one CT series together.\nc)  Pass the stacked feature to customized fully convolutional neuronal networks, and generate the final output. [<a href=\"https://github.com/XUXUSSS/kaggle_rsna2019_4th_solution/blob/ed1c6f59b3077e3c8226671a5d9c38c2028aab5d/cls_1/src/cnn/models/model.py#L141\">link</a>]</p>\n\n<h3>2.  Augmentation:</h3>\n\n<p>a)  No data augmentation</p>\n\n<h3>3.  Training strategy</h3>\n\n<p>a)  Follow 2D CNN’s fold split</p>\n\n<h3>Summary of Stage 2 models:</h3>\n\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F2215248%2Fa93f38cf0b81ef5ec96ad0239c37b410%2Fclsmodel.png?generation=1574246559021560&amp;alt=media\" alt=\"\"></p>\n\n<h2>Ensemble Predictions</h2>\n\n<p>4 x 5 x 5 = 100 Predictions from\n1.  4 Models\n    a)  Cls_1a trained on Fold_Set_a,\n    b)  Cls_1b trained on Fold_Set_b,\n    c)  Cls_2 trained on Fold_Set_a,\n    d)  Cls_3 trained on Fold_Set_c\n2.  5 Folds per Fold Set\n3.  5 TTA</p>\n\n<h2>Post-processing</h2>\n\n<ol>\n<li>Assign the minimum value over all predictions to the blank test images</li>\n<li>Clip the predicted value to the range of [1e-6, 1-1e-6]</li>\n<li>Convert the predictions to the required submission format</li>\n</ol>\n\n<h2>Score Growth Chart</h2>\n\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F2215248%2Fba114abed56147359750a1da8a20c75a%2Fscorechart.png?generation=1574245503408955&amp;alt=media\" alt=\"\"></p>\n\n<p>Acknowledgement: Our code is based on Appian’s repo.  <a href=\"/appian\">@appian</a> Thank you very much for your great and beautiful work!</p>",
  "messages": [
    {
      "id": 677573,
      "postDate": "2019-11-20T10:34:54.500Z",
      "content": "<p>Code: <a href=\"https://github.com/XUXUSSS/kaggle_rsna2019_4th_solution\">https://github.com/XUXUSSS/kaggle_rsna2019_4th_solution</a> \nOur code is based on Appian's repo: <a href=\"https://github.com/appian42/kaggle-rsna-intracranial-hemorrhage\">https://github.com/appian42/kaggle-rsna-intracranial-hemorrhage</a></p>\n\n<h1>Overview of the proposed method</h1>\n\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F2215248%2F29e2a5b18ea11e273e34e3fd1ffff119%2Foverview.png?generation=1574318153545078&amp;alt=media\" alt=\"\"></p>\n\n<p>Our solution includes two stages. We train  2D CNN models in stage 1 for feature extraction, and 1D + 3D CNN models in stage 2 for classification.</p>\n\n<h2>Preprocess</h2>\n\n<ol>\n<li>Two window policies:\na)  use Appian’s windowing policy\n          i.    Three windows are: [40, 80], [80, 200], [40, 380][<a href=\"https://github.com/XUXUSSS/kaggle_rsna2019_4th_solution/blob/1e9b6a5bb46d1d329f4af04e9066a3a0b7fa7769/IFE_1/src/cnn/dataset/custom_dataset.py#L68\">link</a>]\nb)  Stack three consecutive slices to a 3-channel image. [<a href=\"https://github.com/XUXUSSS/kaggle_rsna2019_4th_solution/blob/1e9b6a5bb46d1d329f4af04e9066a3a0b7fa7769/IFE_3/src/cnn/dataset/custom_dataset.py#L97\">link</a>] \n          i.    Window: [40, 80] </li>\n<li>Remove corrupted images </li>\n<li>Filter out blank images by \na)  Obtain the difference between maximum and minimum intensity value of each image, i.e., the intensity range, after applying a custom windowing scheme (center = 40, window = 80) \nb)  Remove images with intensity range &lt; 60 from both training and test sets. \nc)  The removed test images will be classified as negative during post-processing.</li>\n<li>Extract useful meta data from dicom files\na)  Patient ID\nb)  StudyInstance ID\nc)  SeriesInstance ID\nd)  Position2</li>\n<li>Make patient-wise stratified five folds\na)  Images from one patient always belong to the same fold\nb)  Class distributions are roughly the same across different folds</li>\n</ol>\n\n<h2>STAGE 1: 2D Image Feature Extraction</h2>\n\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F2215248%2F69ccd1b230d567e1c473413541545b27%2FfeatureExtraction.png?generation=1574240192793088&amp;alt=media\" alt=\"\"></p>\n\n<h3>1.  Training strategy:</h3>\n\n<p>a)  Randomly split the training dataset into 5 folds and train the model five times. Use 4 folds as training set and 1 fold as validation set each time.</p>\n\n<h3>2.  Models</h3>\n\na) EfficientNet B0\n\n<p>i.  ImageNet pretrained\nii. Input image size: 512x512\niii.    Augmentation: random crop, random hflip, random rotate, random contrast\niv. 5-fold training\nv.  TTA5： random crop, random hflip , random rotate, random contrast</p>\n\nb) ResNext50 32x4d swsl\n\n<p>i.  Semi-Supervised and Semi-Weakly Supervised ImageNet Models <a href=\"https://github.com/facebookresearch/semi-supervised-ImageNet1K-models\">https://github.com/facebookresearch/semi-supervised-ImageNet1K-models</a>\nii. Input image size: 448x448\niii.    Augmentation: random crop, random hflip , random rotate, random contrast, pixel and window jittering\niv. 5-fold training\nv.     Cosine learning rate scheduler\nvi. TTA5： random crop, random hflip , random rotate, random contrast</p>\n\n<h3>Summary of stage 1 models:</h3>\n\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F2215248%2F9e735ab0c676de4ca8c1eb94df51404e%2FIFLmodels.png?generation=1574238657232358&amp;alt=media\" alt=\"\"></p>\n\n<h2>STAGE1: Meta Data Feature Engineering</h2>\n\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F2215248%2F22895a3229aa1374353d025496988e4e%2Fmetadata.png?generation=1574245207505107&amp;alt=media\" alt=\"\"></p>\n\n<h2>STAGE2: Slice Sequence Model</h2>\n\n<p>In stage2,   we train 1D CNN model and 1D+3D CNN models for classification.</p>\n\n<h3>1D CNN model:</h3>\n\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F2215248%2Ff3f240c485b348322e17a5081252863c%2F1Dconv.png?generation=1574239313394661&amp;alt=media\" alt=\"\"></p>\n\n<h3>1.  Pipeline:</h3>\n\n<p>a)  Extract 1D feature and metadata from stage 1\nb)  Stack the features that belong to one CT series together.\nc)  Pass the stacked feature to customized fully convolutional neuronal networks, and generate the output. [<a href=\"https://github.com/XUXUSSS/kaggle_rsna2019_4th_solution/blob/ed1c6f59b3077e3c8226671a5d9c38c2028aab5d/cls_2/src/cnn/models/model.py#L22\">link</a>]</p>\n\n<h3>2.  Augmentation:</h3>\n\n<p>a)  No data augmentation</p>\n\n<h3>3.  Training strategy</h3>\n\n<p>a)  Follow 2D CNN’s fold split</p>\n\n<h3>1D+3D CNN model</h3>\n\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F2215248%2Fb5e6427293552f7563b11f71610203ea%2F1D3D.png?generation=1574239073870529&amp;alt=media\" alt=\"\"></p>\n\n<h3>1.  Pipeline:</h3>\n\n<p>a)  Extract metatdata,  1D and 3D features from stage 1.\nb)  Stack the features that belong to one CT series together.\nc)  Pass the stacked feature to customized fully convolutional neuronal networks, and generate the final output. [<a href=\"https://github.com/XUXUSSS/kaggle_rsna2019_4th_solution/blob/ed1c6f59b3077e3c8226671a5d9c38c2028aab5d/cls_1/src/cnn/models/model.py#L141\">link</a>]</p>\n\n<h3>2.  Augmentation:</h3>\n\n<p>a)  No data augmentation</p>\n\n<h3>3.  Training strategy</h3>\n\n<p>a)  Follow 2D CNN’s fold split</p>\n\n<h3>Summary of Stage 2 models:</h3>\n\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F2215248%2Fa93f38cf0b81ef5ec96ad0239c37b410%2Fclsmodel.png?generation=1574246559021560&amp;alt=media\" alt=\"\"></p>\n\n<h2>Ensemble Predictions</h2>\n\n<p>4 x 5 x 5 = 100 Predictions from\n1.  4 Models\n    a)  Cls_1a trained on Fold_Set_a,\n    b)  Cls_1b trained on Fold_Set_b,\n    c)  Cls_2 trained on Fold_Set_a,\n    d)  Cls_3 trained on Fold_Set_c\n2.  5 Folds per Fold Set\n3.  5 TTA</p>\n\n<h2>Post-processing</h2>\n\n<ol>\n<li>Assign the minimum value over all predictions to the blank test images</li>\n<li>Clip the predicted value to the range of [1e-6, 1-1e-6]</li>\n<li>Convert the predictions to the required submission format</li>\n</ol>\n\n<h2>Score Growth Chart</h2>\n\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F2215248%2Fba114abed56147359750a1da8a20c75a%2Fscorechart.png?generation=1574245503408955&amp;alt=media\" alt=\"\"></p>\n\n<p>Acknowledgement: Our code is based on Appian’s repo.  <a href=\"/appian\">@appian</a> Thank you very much for your great and beautiful work!</p>",
      "rawMarkdown": "Code: https://github.com/XUXUSSS/kaggle_rsna2019_4th_solution \nOur code is based on Appian's repo: https://github.com/appian42/kaggle-rsna-intracranial-hemorrhage\n\n# Overview of the proposed method\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F2215248%2F29e2a5b18ea11e273e34e3fd1ffff119%2Foverview.png?generation=1574318153545078&amp;alt=media)\n\nOur solution includes two stages. We train  2D CNN models in stage 1 for feature extraction, and 1D + 3D CNN models in stage 2 for classification.\n\n## Preprocess\n1.\tTwo window policies:\n    a)\tuse Appian’s windowing policy\n              i.\tThree windows are: [40, 80], [80, 200], [40, 380][[link](https://github.com/XUXUSSS/kaggle_rsna2019_4th_solution/blob/1e9b6a5bb46d1d329f4af04e9066a3a0b7fa7769/IFE_1/src/cnn/dataset/custom_dataset.py#L68)]\n    b)\tStack three consecutive slices to a 3-channel image. [[link](https://github.com/XUXUSSS/kaggle_rsna2019_4th_solution/blob/1e9b6a5bb46d1d329f4af04e9066a3a0b7fa7769/IFE_3/src/cnn/dataset/custom_dataset.py#L97)] \n              i.\tWindow: [40, 80] \n2.\tRemove corrupted images \n3.\tFilter out blank images by \na)\tObtain the difference between maximum and minimum intensity value of each image, i.e., the intensity range, after applying a custom windowing scheme (center = 40, window = 80) \nb)\tRemove images with intensity range &lt; 60 from both training and test sets. \nc)\tThe removed test images will be classified as negative during post-processing.\n4.\tExtract useful meta data from dicom files\na)\tPatient ID\nb)\tStudyInstance ID\nc)\tSeriesInstance ID\nd)\tPosition2\n5.\tMake patient-wise stratified five folds\na)\tImages from one patient always belong to the same fold\nb)\tClass distributions are roughly the same across different folds\n\n## STAGE 1: 2D Image Feature Extraction\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F2215248%2F69ccd1b230d567e1c473413541545b27%2FfeatureExtraction.png?generation=1574240192793088&amp;alt=media)\n\n\n### 1.\tTraining strategy:\na)\tRandomly split the training dataset into 5 folds and train the model five times. Use 4 folds as training set and 1 fold as validation set each time.\n\n### 2.\tModels \n#### a)\tEfficientNet B0\ni.\tImageNet pretrained\nii.\tInput image size: 512x512\niii.\tAugmentation: random crop, random hflip, random rotate, random contrast\niv.\t5-fold training\nv.\tTTA5： random crop, random hflip , random rotate, random contrast\n\n#### b)\tResNext50 32x4d swsl \ni.\tSemi-Supervised and Semi-Weakly Supervised ImageNet Models https://github.com/facebookresearch/semi-supervised-ImageNet1K-models\nii.\tInput image size: 448x448\niii.\tAugmentation: random crop, random hflip , random rotate, random contrast, pixel and window jittering\niv.\t5-fold training\nv.     Cosine learning rate scheduler\nvi.\tTTA5： random crop, random hflip , random rotate, random contrast\n\n### Summary of stage 1 models:\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F2215248%2F9e735ab0c676de4ca8c1eb94df51404e%2FIFLmodels.png?generation=1574238657232358&amp;alt=media)\n\n## STAGE1: Meta Data Feature Engineering\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F2215248%2F22895a3229aa1374353d025496988e4e%2Fmetadata.png?generation=1574245207505107&amp;alt=media)\n\n \n##STAGE2: Slice Sequence Model\nIn stage2,   we train 1D CNN model and 1D+3D CNN models for classification.\n### 1D CNN model:\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F2215248%2Ff3f240c485b348322e17a5081252863c%2F1Dconv.png?generation=1574239313394661&amp;alt=media)\n\n### 1.\tPipeline:\na)\tExtract 1D feature and metadata from stage 1\nb)\tStack the features that belong to one CT series together.\nc)\tPass the stacked feature to customized fully convolutional neuronal networks, and generate the output. [[link](https://github.com/XUXUSSS/kaggle_rsna2019_4th_solution/blob/ed1c6f59b3077e3c8226671a5d9c38c2028aab5d/cls_2/src/cnn/models/model.py#L22)]\n### 2.\tAugmentation:\na)\tNo data augmentation\n### 3.\tTraining strategy\na)\tFollow 2D CNN’s fold split\n### 1D+3D CNN model\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F2215248%2Fb5e6427293552f7563b11f71610203ea%2F1D3D.png?generation=1574239073870529&amp;alt=media)\n\n### 1.\tPipeline:\na)\tExtract metatdata,  1D and 3D features from stage 1.\nb)\tStack the features that belong to one CT series together.\nc)\tPass the stacked feature to customized fully convolutional neuronal networks, and generate the final output. [[link](https://github.com/XUXUSSS/kaggle_rsna2019_4th_solution/blob/ed1c6f59b3077e3c8226671a5d9c38c2028aab5d/cls_1/src/cnn/models/model.py#L141)]\n### 2.\tAugmentation:\na)\tNo data augmentation\n### 3.\tTraining strategy\na)\tFollow 2D CNN’s fold split\n### Summary of Stage 2 models:\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F2215248%2Fa93f38cf0b81ef5ec96ad0239c37b410%2Fclsmodel.png?generation=1574246559021560&amp;alt=media)\n\n\n## Ensemble Predictions\n\n4 x 5 x 5 = 100 Predictions from\n1. \t4 Models\n    a)\tCls_1a trained on Fold_Set_a,\n    b)\tCls_1b trained on Fold_Set_b,\n    c)\tCls_2 trained on Fold_Set_a,\n    d)\tCls_3 trained on Fold_Set_c\n2.\t5 Folds per Fold Set\n3.\t5 TTA\n\n## Post-processing\n1. Assign the minimum value over all predictions to the blank test images\n2. Clip the predicted value to the range of [1e-6, 1-1e-6]\n3. Convert the predictions to the required submission format\n\n## Score Growth Chart\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F2215248%2Fba114abed56147359750a1da8a20c75a%2Fscorechart.png?generation=1574245503408955&amp;alt=media)\n\nAcknowledgement: Our code is based on Appian’s repo.  @appian Thank you very much for your great and beautiful work!",
      "votes": 41
    },
    {
      "id": 678172,
      "postDate": "2019-11-21T03:50:24.553Z",
      "content": "<p>Congrats! such beautiful and detailed write up. how did you create such elegant flow chart visuals?</p>",
      "rawMarkdown": "Congrats! such beautiful and detailed write up. how did you create such elegant flow chart visuals?",
      "votes": 3,
      "replies": [
        {
          "id": 678255,
          "postDate": "2019-11-21T06:39:18.433Z",
          "content": "<p>I have the same question. I'm preparing my materials and really impressed with the flow chart visuals. </p>",
          "rawMarkdown": "I have the same question. I'm preparing my materials and really impressed with the flow chart visuals. ",
          "votes": 1
        },
        {
          "id": 678295,
          "postDate": "2019-11-21T07:45:49.937Z",
          "content": "<p>Ha, we use PowerPoint to draw all the flow charts. 😊 </p>",
          "rawMarkdown": "Ha, we use PowerPoint to draw all the flow charts. 😊 ",
          "votes": 3
        },
        {
          "id": 678438,
          "postDate": "2019-11-21T12:04:02.530Z",
          "content": "<p>drawio is another option :D </p>",
          "rawMarkdown": "drawio is another option :D ",
          "votes": 1
        },
        {
          "id": 678903,
          "postDate": "2019-11-22T03:16:05.517Z",
          "content": "<p>👍 </p>",
          "rawMarkdown": "👍 "
        }
      ]
    },
    {
      "id": 680830,
      "postDate": "2019-11-25T10:00:10.930Z",
      "content": "<p>congratulations. </p>",
      "rawMarkdown": "congratulations. "
    },
    {
      "id": 678164,
      "postDate": "2019-11-21T03:35:23.523Z",
      "content": "<p>Congratulations！Really nice write up!</p>",
      "rawMarkdown": "Congratulations！Really nice write up!",
      "replies": [
        {
          "id": 678293,
          "postDate": "2019-11-21T07:41:32.067Z",
          "content": "<p>Thanks!</p>",
          "rawMarkdown": "Thanks!"
        }
      ]
    },
    {
      "id": 678822,
      "postDate": "2019-11-21T23:56:56.933Z",
      "rawMarkdown": "",
      "votes": 1,
      "isDeleted": true,
      "replies": [
        {
          "id": 678869,
          "postDate": "2019-11-22T02:08:49.757Z",
          "content": "<p>PowerPoint😄 </p>",
          "rawMarkdown": "PowerPoint😄 ",
          "votes": 2
        }
      ]
    },
    {
      "id": 677715,
      "postDate": "2019-11-20T14:19:08.387Z",
      "rawMarkdown": "",
      "isDeleted": true,
      "replies": [
        {
          "id": 678291,
          "postDate": "2019-11-21T07:41:24.873Z",
          "content": "<p>Thanks!</p>",
          "rawMarkdown": "Thanks!"
        }
      ]
    }
  ],
  "comments": [
    {
      "id": 678172,
      "author_name": "Tim Yee",
      "author_url": "",
      "post_date": "2019-11-21T03:50:24.553000",
      "content": "<p>Congrats! such beautiful and detailed write up. how did you create such elegant flow chart visuals?</p>",
      "votes": 3,
      "replies": [
        {
          "id": 678255,
          "author_name": "SeuTao",
          "author_url": "",
          "post_date": "2019-11-21T06:39:18.433000",
          "content": "<p>I have the same question. I'm preparing my materials and really impressed with the flow chart visuals. </p>",
          "votes": 1,
          "replies": []
        },
        {
          "id": 678295,
          "author_name": "Mindy X",
          "author_url": "",
          "post_date": "2019-11-21T07:45:49.937000",
          "content": "<p>Ha, we use PowerPoint to draw all the flow charts. 😊 </p>",
          "votes": 3,
          "replies": []
        },
        {
          "id": 678438,
          "author_name": "cab",
          "author_url": "",
          "post_date": "2019-11-21T12:04:02.530000",
          "content": "<p>drawio is another option :D </p>",
          "votes": 1,
          "replies": []
        },
        {
          "id": 678903,
          "author_name": "SeuTao",
          "author_url": "",
          "post_date": "2019-11-22T03:16:05.517000",
          "content": "<p>👍 </p>",
          "votes": 0,
          "replies": []
        }
      ]
    },
    {
      "id": 680830,
      "author_name": "tokyosmallfoot",
      "author_url": "",
      "post_date": "2019-11-25T10:00:10.930000",
      "content": "<p>congratulations. </p>",
      "votes": 0,
      "replies": []
    },
    {
      "id": 678164,
      "author_name": "SeuTao",
      "author_url": "",
      "post_date": "2019-11-21T03:35:23.523000",
      "content": "<p>Congratulations！Really nice write up!</p>",
      "votes": 0,
      "replies": [
        {
          "id": 678293,
          "author_name": "Mindy X",
          "author_url": "",
          "post_date": "2019-11-21T07:41:32.067000",
          "content": "<p>Thanks!</p>",
          "votes": 0,
          "replies": []
        }
      ]
    },
    {
      "id": 678822,
      "author_name": "",
      "author_url": "",
      "post_date": "2019-11-21T23:56:56.933000",
      "content": "",
      "votes": 1,
      "replies": [
        {
          "id": 678869,
          "author_name": "Mindy X",
          "author_url": "",
          "post_date": "2019-11-22T02:08:49.757000",
          "content": "<p>PowerPoint😄 </p>",
          "votes": 2,
          "replies": []
        }
      ]
    },
    {
      "id": 677715,
      "author_name": "",
      "author_url": "",
      "post_date": "2019-11-20T14:19:08.387000",
      "content": "",
      "votes": 0,
      "replies": [
        {
          "id": 678291,
          "author_name": "Mindy X",
          "author_url": "",
          "post_date": "2019-11-21T07:41:24.873000",
          "content": "<p>Thanks!</p>",
          "votes": 0,
          "replies": []
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "677573": "Code: https://github.com/XUXUSSS/kaggle_rsna2019_4th_solution \nOur code is based on Appian's repo: https://github.com/appian42/kaggle-rsna-intracranial-hemorrhage\n\n# Overview of the proposed method\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F2215248%2F29e2a5b18ea11e273e34e3fd1ffff119%2Foverview.png?generation=1574318153545078&amp;alt=media)\n\nOur solution includes two stages. We train  2D CNN models in stage 1 for feature extraction, and 1D + 3D CNN models in stage 2 for classification.\n\n## Preprocess\n1.\tTwo window policies:\n    a)\tuse Appian’s windowing policy\n              i.\tThree windows are: [40, 80], [80, 200], [40, 380][[link](https://github.com/XUXUSSS/kaggle_rsna2019_4th_solution/blob/1e9b6a5bb46d1d329f4af04e9066a3a0b7fa7769/IFE_1/src/cnn/dataset/custom_dataset.py#L68)]\n    b)\tStack three consecutive slices to a 3-channel image. [[link](https://github.com/XUXUSSS/kaggle_rsna2019_4th_solution/blob/1e9b6a5bb46d1d329f4af04e9066a3a0b7fa7769/IFE_3/src/cnn/dataset/custom_dataset.py#L97)] \n              i.\tWindow: [40, 80] \n2.\tRemove corrupted images \n3.\tFilter out blank images by \na)\tObtain the difference between maximum and minimum intensity value of each image, i.e., the intensity range, after applying a custom windowing scheme (center = 40, window = 80) \nb)\tRemove images with intensity range &lt; 60 from both training and test sets. \nc)\tThe removed test images will be classified as negative during post-processing.\n4.\tExtract useful meta data from dicom files\na)\tPatient ID\nb)\tStudyInstance ID\nc)\tSeriesInstance ID\nd)\tPosition2\n5.\tMake patient-wise stratified five folds\na)\tImages from one patient always belong to the same fold\nb)\tClass distributions are roughly the same across different folds\n\n## STAGE 1: 2D Image Feature Extraction\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F2215248%2F69ccd1b230d567e1c473413541545b27%2FfeatureExtraction.png?generation=1574240192793088&amp;alt=media)\n\n\n### 1.\tTraining strategy:\na)\tRandomly split the training dataset into 5 folds and train the model five times. Use 4 folds as training set and 1 fold as validation set each time.\n\n### 2.\tModels \n#### a)\tEfficientNet B0\ni.\tImageNet pretrained\nii.\tInput image size: 512x512\niii.\tAugmentation: random crop, random hflip, random rotate, random contrast\niv.\t5-fold training\nv.\tTTA5： random crop, random hflip , random rotate, random contrast\n\n#### b)\tResNext50 32x4d swsl \ni.\tSemi-Supervised and Semi-Weakly Supervised ImageNet Models https://github.com/facebookresearch/semi-supervised-ImageNet1K-models\nii.\tInput image size: 448x448\niii.\tAugmentation: random crop, random hflip , random rotate, random contrast, pixel and window jittering\niv.\t5-fold training\nv.     Cosine learning rate scheduler\nvi.\tTTA5： random crop, random hflip , random rotate, random contrast\n\n### Summary of stage 1 models:\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F2215248%2F9e735ab0c676de4ca8c1eb94df51404e%2FIFLmodels.png?generation=1574238657232358&amp;alt=media)\n\n## STAGE1: Meta Data Feature Engineering\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F2215248%2F22895a3229aa1374353d025496988e4e%2Fmetadata.png?generation=1574245207505107&amp;alt=media)\n\n \n##STAGE2: Slice Sequence Model\nIn stage2,   we train 1D CNN model and 1D+3D CNN models for classification.\n### 1D CNN model:\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F2215248%2Ff3f240c485b348322e17a5081252863c%2F1Dconv.png?generation=1574239313394661&amp;alt=media)\n\n### 1.\tPipeline:\na)\tExtract 1D feature and metadata from stage 1\nb)\tStack the features that belong to one CT series together.\nc)\tPass the stacked feature to customized fully convolutional neuronal networks, and generate the output. [[link](https://github.com/XUXUSSS/kaggle_rsna2019_4th_solution/blob/ed1c6f59b3077e3c8226671a5d9c38c2028aab5d/cls_2/src/cnn/models/model.py#L22)]\n### 2.\tAugmentation:\na)\tNo data augmentation\n### 3.\tTraining strategy\na)\tFollow 2D CNN’s fold split\n### 1D+3D CNN model\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F2215248%2Fb5e6427293552f7563b11f71610203ea%2F1D3D.png?generation=1574239073870529&amp;alt=media)\n\n### 1.\tPipeline:\na)\tExtract metatdata,  1D and 3D features from stage 1.\nb)\tStack the features that belong to one CT series together.\nc)\tPass the stacked feature to customized fully convolutional neuronal networks, and generate the final output. [[link](https://github.com/XUXUSSS/kaggle_rsna2019_4th_solution/blob/ed1c6f59b3077e3c8226671a5d9c38c2028aab5d/cls_1/src/cnn/models/model.py#L141)]\n### 2.\tAugmentation:\na)\tNo data augmentation\n### 3.\tTraining strategy\na)\tFollow 2D CNN’s fold split\n### Summary of Stage 2 models:\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F2215248%2Fa93f38cf0b81ef5ec96ad0239c37b410%2Fclsmodel.png?generation=1574246559021560&amp;alt=media)\n\n\n## Ensemble Predictions\n\n4 x 5 x 5 = 100 Predictions from\n1. \t4 Models\n    a)\tCls_1a trained on Fold_Set_a,\n    b)\tCls_1b trained on Fold_Set_b,\n    c)\tCls_2 trained on Fold_Set_a,\n    d)\tCls_3 trained on Fold_Set_c\n2.\t5 Folds per Fold Set\n3.\t5 TTA\n\n## Post-processing\n1. Assign the minimum value over all predictions to the blank test images\n2. Clip the predicted value to the range of [1e-6, 1-1e-6]\n3. Convert the predictions to the required submission format\n\n## Score Growth Chart\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F2215248%2Fba114abed56147359750a1da8a20c75a%2Fscorechart.png?generation=1574245503408955&amp;alt=media)\n\nAcknowledgement: Our code is based on Appian’s repo.  @appian Thank you very much for your great and beautiful work!",
    "678172": "Congrats! such beautiful and detailed write up. how did you create such elegant flow chart visuals?",
    "680830": "congratulations. ",
    "678164": "Congratulations！Really nice write up!",
    "678822": "",
    "677715": ""
  }
}