{
  "id": 31551,
  "title": "Very quick 1st summary of julian's part of 2nd place solution.",
  "content": "<p>Hello, here a very quick 1st summary on my part our 2nd place solution. Of course a real writeup and code will follow.</p>\n\n<p><strong>Tools.</strong><br>\nI used Keras + Tensorflow on windows 64.\nIt just came out and wanted to give it a go.\nFor visualisation + debugging I used a specially built viewer.\nI used that one for checking labels, predictions etc.</p>\n\n<p><strong>General approach.</strong><br>\nThe main insight for me (and as a coincidence Daniel) was to use <strong>the malignancy information from the LIDC database</strong> as labeled by the doctors and combine it with the LUNA16 negative labels.\nI trained up a 32x32x32 3d convnet to detect nodules AND predict malignancy in one go.\nI did <strong>not use segmented lungs</strong> but rather trained on the full images to not miss any nodules located near the edges.</p>\n\n<p>Furthermore it was appearantly extremely important you <strong>not let yourself get too distracted by the leaderboard</strong>. \nAs Daniel said \"In CV we trust\".</p>\n\n<p><strong>Preprocessing</strong><br>\nScale everything to 1x1x1 mm. Make sure that all patients have the same orientation in both LUNA and NDSB.\nConnect the LIDC data to the LUNA data. I expressed all coordinates as 0.0 to 1.0 so that it was scale independent.\nI used my viewer to check if all positive and negative labels. </p>\n\n<p><strong>Labels</strong><br>\nI used ALL positive LIDC doctor assessments as positive, malignancy label info. Even when only one doctor saw something.\nThe though was that the malignancy info was still very valuable. Then I used the negative entries of candidatesv2.csv from LUNA16 as negatives labels.\nNote that some overlapped with nodules that were tagged by only one doctor.\nTo train on the full images I samples extra negative labels on non-lung tissue. I found that tissue by taking the segmenter from the forum and sampling around the mask edges.\nThen I trained a first network and predicted on the LUNA set. All false positives I added as extra negative examples.\nAll in all ca. 400.000 candidates, 100.000 non lung tissue, 10.000 false positives, 2000 LIDC positives.</p>\n\n<p>For my 2nd model I predicted on the NDSB data and then played \"doctor julian\" and manually annotated positive nodules and false positives and added those to the trainset.</p>\n\n<p>Another important observation was that in LUNA16 nodules &gt; 3cm (masses) were NOT labeled. So I excluded negative labels that overlapped these masses since it migt confuse the network.</p>\n\n<p><strong>3D convnet nodule, malignancy detector.</strong><br>\nI trained a 32x32x32 3D convnet on extracted, labeled crops . The architecture was a butchered version of the C3D architecture, which is basically VGG like.\nI spent very (too?) little time optimizing the network architecture.</p>\n\n<p>Somehow I made it so to do multitask learning. So I trained on Nodule Y/N, Malignancy in one go. This worked best for me but Daniel\ndid it in 2 stages.</p>\n\n<p>The labels were very unbalanced so I upsampled the positive cases onto 1:20. Heavy (lossless) augmentation somehow worked.\nI'm still a bit surprised how few positive cases were needed.</p>\n\n<p>Using the trained network I prediced on the NDSB data using a 12 mm stepsize which gave a lattice with nodule malignancies.\nFor every patient I only used the max malignancy and the z-location. I did this at 3 zoom levels to also be able to detect bigger nodules.</p>\n\n<p><strong>Strange tissue detector.</strong><br>\nA small part of the solution was a \"strange tissue\" detector. I basically used some examples of strange tissue from LUNA, NDSB, a few axamples from the extra data thread.\nI labeled them with the same program I used for the 2nd NDSB. Then I trained a small U-Net. This net gave per patient the amount of strange tissue.\nI also tried the same trick for overal holistic info and empysema but they did not have any significant impact.</p>\n\n<p><strong>Final classifier.</strong><br>\nI used Xgboost on the max malignancy at 3 zoom levels, the z-location and the amount of strange tissue.\nI used min-childweight of 60 to prevent overfitting.\nLocal CV was around 0.39 but the LB had a will of its own and I had a very hard time finding improvements that improved both local CV and LB.</p>\n\n<p><strong>Daniels models.</strong><br>\nI joined with Daniel Hammack and we both were convinced we had an original idea. Turned out that we both used malignancy info from LIDC.\nHowever, his network architecture was 64x64x64, resnet like and used 2 stages. Also he used extra nodule info from LIDC. So in the end our models were still quite complimentary.\nMore info on his stuff will be in his writeup. My strategy was to average the models into one final solution. </p>\n\n<p><strong>My thanks to Daniel.</strong><br> \nHe really kept his cool when the LB was at complete chaos with all the overfitting taking place.\nYou are extremely bright and much more sophisticated than me in your ML approach :)</p>",
  "comments": [
    {
      "id": 175604,
      "author_name": "Nick Norm",
      "author_url": "",
      "post_date": "2017-04-16T13:22:38.530000",
      "content": "<p>Really good point about trusting in CV and not over-fitting the leaderboard.</p>",
      "votes": 3,
      "replies": []
    },
    {
      "id": 174934,
      "author_name": "Fréderic Godin",
      "author_url": "",
      "post_date": "2017-04-13T08:40:16.960000",
      "content": "<p>Congratz Julian &amp; Daniel!</p>",
      "votes": 3,
      "replies": []
    },
    {
      "id": 176145,
      "author_name": "SHU-JU TU",
      "author_url": "",
      "post_date": "2017-04-19T03:58:57.727000",
      "content": "<p>Hi</p>\n\n<p>Congratulate on your great work!</p>\n\n<p>I notice that your log-loss is around 0.4.\nIs there a way that you can convert this metric to something like true-positive rate, false-positive rate, true-negative rate, or false-negative rate?</p>\n\n<p>Warm regards,\nShu-Ju</p>",
      "votes": 2,
      "replies": [
        {
          "id": 176193,
          "author_name": "Julian de Wit",
          "author_url": "",
          "post_date": "2017-04-19T10:33:35.330000",
          "content": "<p>Hello, thanks!<br>\nFor stage 1. public LB. Logloss 0.43 AUC was 0.85.<br>\nFor stage2 (0.40) we do not have the labels..<br></p>\n\n<p><img src=\"https://retinopaty.blob.core.windows.net/ndsb3/roc_public_lb2.png\" alt=\"ROC\" title=\"\"></p>",
          "votes": 2,
          "replies": []
        }
      ]
    },
    {
      "id": 175146,
      "author_name": "danieleewww",
      "author_url": "",
      "post_date": "2017-04-14T01:28:26.387000",
      "content": "<p>Cool mindset on handling such competitive ML subject!</p>",
      "votes": 2,
      "replies": []
    },
    {
      "id": 175118,
      "author_name": "jsardinha",
      "author_url": "",
      "post_date": "2017-04-13T20:57:39.603000",
      "content": "<p>Congrats Julian and Daniel and thanks for sharing. </p>\n\n<p>Do you know how big of a difference the <strong>strange tissue detector</strong> made to your overall score? </p>",
      "votes": 2,
      "replies": [
        {
          "id": 175176,
          "author_name": "Julian de Wit",
          "author_url": "",
          "post_date": "2017-04-14T06:03:32.430000",
          "content": "<p>Not much but I'd like to think that it just made the difference.\nThere are about 10 cases in the trainset with a lot of strange tissue and no or small nodules.\nOf those 10 cases about 5 of them are cancer. So with strange tissue the chance of being cancer is higher. Instead of a hard negative the classifier with raise the chance a bit. So instead of a big logloss penalty you get a more mild penalty.</p>\n\n<p>Here an example.\n<img src=\"https://retinopaty.blob.core.windows.net/ndsb3/tissue.png\" alt=\"enter image description here\" title=\"\"></p>",
          "votes": 1,
          "replies": []
        }
      ]
    },
    {
      "id": 175071,
      "author_name": "malhot",
      "author_url": "",
      "post_date": "2017-04-13T17:13:43.297000",
      "content": "<p>Thanks a lot for sharing! Do you mind sharing what kind of hardware you were using? Also, is your visualisation tool publicly available?</p>",
      "votes": 2,
      "replies": [
        {
          "id": 175178,
          "author_name": "Julian de Wit",
          "author_url": "",
          "post_date": "2017-04-14T06:08:56.467000",
          "content": "<p>I trained on backup computer with a GTX 980. <br>\nSince I was on 32x32x32 you did not need a heavy card.<br>\nI think having SSD harddrives was more imprortant for high throughput.</p>\n\n<p>The viewer is a hasty job and depends on specific folder structures.\nIt would be a pain to run.</p>",
          "votes": 0,
          "replies": []
        }
      ]
    },
    {
      "id": 174932,
      "author_name": "sh1ng",
      "author_url": "",
      "post_date": "2017-04-13T08:29:26.633000",
      "content": "<p>Big thanks for your sharing and congratulations!</p>\n\n<p>Could you elaborate a little more about loss function in each case. Was it cross entropy, dice or something else?</p>\n\n<p>By predicting nodule and malignancy do you mean two masks with probability per pixel(1x1x1 cube) or per whole patch?  </p>",
      "votes": 2,
      "replies": []
    },
    {
      "id": 175976,
      "author_name": "Georgios Sarantitis",
      "author_url": "",
      "post_date": "2017-04-18T10:39:56.847000",
      "content": "<p>Thanks for sharing! Great job, it was really helpful to me since I am just starting my journey on image recognition competitions..!</p>",
      "votes": 1,
      "replies": []
    },
    {
      "id": 175465,
      "author_name": "Dex De Guzman",
      "author_url": "",
      "post_date": "2017-04-15T16:01:37.487000",
      "content": "<p>congrats julian!! when r u planning on posting the code? </p>",
      "votes": 1,
      "replies": [
        {
          "id": 175469,
          "author_name": "Julian de Wit",
          "author_url": "",
          "post_date": "2017-04-15T16:53:22.227000",
          "content": "<p>Thanks,<br>\nYes, we'll publish the code.<br>\nEverybody that wants to win a prize has to if I understood correctly.<br>\nJust have to clean up a bit. :)</p>",
          "votes": 0,
          "replies": []
        }
      ]
    },
    {
      "id": 175306,
      "author_name": "terravic",
      "author_url": "",
      "post_date": "2017-04-14T20:31:57.077000",
      "content": "<p>Congrats Julian and Daniel! Thank you for sharing your approach!</p>",
      "votes": 1,
      "replies": []
    },
    {
      "id": 175271,
      "author_name": "Junjie Bai",
      "author_url": "",
      "post_date": "2017-04-14T17:24:59.767000",
      "content": "<p>Congratulations, Julian &amp; Daniel! Thanks for sharing. I am wondering did you use convNet raw features (likely fully-connected layer input) from max malignancy locations? Or did you just use the scalar max malignancy probability? </p>\n\n<p>Also, does you final submission still have a big gap between local CV and stage 1 LB? We also had a very difficult time getting both improving at the same time. </p>",
      "votes": 1,
      "replies": [
        {
          "id": 175291,
          "author_name": "dhammack",
          "author_url": "",
          "post_date": "2017-04-14T18:51:49.290000",
          "content": "<blockquote>\n  <p>did you use convNet raw features (likely fully-connected layer input) from max malignancy locations? Or did you just use the scalar max malignancy probability?</p>\n</blockquote>\n\n<p>We did not chop off the last layer of the network if that is what you are asking. We both used the actual malignancy predictions to generate some 'hand crafted' features like:</p>\n\n<ul>\n<li>max (nodule malignancy predictions)</li>\n<li>stdev( nodule malignancy predictions)</li>\n<li>location of most malignant nodule, etc.</li>\n</ul>\n\n<p>It may be possible to slightly improve the score by doing what you suggest and using the inputs to the final layer at the most malignant nodule as features. I tried a variant of this earlier in the competition without success but I never tried it again later.</p>\n\n<p>Also, does you final submission still have a big gap between local CV and stage 1 LB?</p>\n\n<p>Yes. For example, my 'second ensemble' had a local CV score of 0.390 and a stage 1 LB score of 0.451. It was very hard to ignore the stage 1 LB and trust our CV score! Ultimately I ended up basically ignoring the stage 1 LB altogether and just focusing on improving CV as CV had 1400 scans compared to the 200 in the public LB.</p>",
          "votes": 2,
          "replies": []
        },
        {
          "id": 175320,
          "author_name": "Junjie Bai",
          "author_url": "",
          "post_date": "2017-04-14T22:01:44.300000",
          "content": "<p>Thank you very much for the detailed sharing, Daniel! </p>\n\n<p>I am deeply impressed by how well your results are without including the \"black art\" convNet features. Even though convNet is so popular on image tasks right now, it's good to know that we don't have to rely on such black features to achieve top results (or at least just keep the black features inside the black box itself). </p>\n\n<p>For the big gap between local CV and LB, it's really courageous to ignore LB altogether and just focus on local CV! I was too scared to do this, but guess I could be braver next time. </p>",
          "votes": 0,
          "replies": []
        }
      ]
    },
    {
      "id": 175010,
      "author_name": "Jun Shi",
      "author_url": "",
      "post_date": "2017-04-13T13:28:03.967000",
      "content": "<p>Congrats! Thanks for sharing.\nWhat do you mean by \"3 zoom levels\"? 3 different 3d-filter sizes (receptive field) at the first level of your 3d-cnn?</p>",
      "votes": 1,
      "replies": [
        {
          "id": 175020,
          "author_name": "Julian de Wit",
          "author_url": "",
          "post_date": "2017-04-13T13:44:46.040000",
          "content": "<p>I was not clear about that.<br>\nI trained the net on 1x1x1 mm per pixel.<br>\nSince the receptive field size was 32x32x32 it sometimes missed larger nodules.<br>\nSo during prediction I predicted on 3 scales<br></p>\n\n<ul>\n<li>1x1x1 mm per pixel.</li>\n<li>1.5x1.5x1.5 mm per pixel.</li>\n<li>2x2x2 mm per pixel.</li>\n</ul>\n\n<p><br>\nI used the same network every time.<br>\nIt was a cheeky fix but somehow it worked. </p>",
          "votes": 1,
          "replies": []
        },
        {
          "id": 175256,
          "author_name": "Jun Shi",
          "author_url": "",
          "post_date": "2017-04-14T16:07:02.960000",
          "content": "<p>I see. You resampled test scans three times, but using the same network instead. Thanks for sharing.</p>",
          "votes": 0,
          "replies": []
        }
      ]
    },
    {
      "id": 174974,
      "author_name": "Aleś",
      "author_url": "",
      "post_date": "2017-04-13T10:39:01.687000",
      "content": "<p>Dear all, I was trying to find the malignancy labels for LIDC data, but didn't quite manage to find them. Could you give a hint where those labels are stored?</p>",
      "votes": 1,
      "replies": [
        {
          "id": 174976,
          "author_name": "Julian de Wit",
          "author_url": "",
          "post_date": "2017-04-13T10:44:38.540000",
          "content": "<p><a href=\"https://wiki.cancerimagingarchive.net/display/Public/LIDC-IDRI#31cc3a04bc704e7f88d81c8df1a9e662\">This link</a><br>\nThen detailed description.<br>\nThen \"XML File Documentation\"<br></p>",
          "votes": 0,
          "replies": []
        },
        {
          "id": 174979,
          "author_name": "Aleś",
          "author_url": "",
          "post_date": "2017-04-13T10:47:21.260000",
          "content": "<p>thanks!</p>",
          "votes": 0,
          "replies": []
        }
      ]
    },
    {
      "id": 174962,
      "author_name": "Julian de Wit",
      "author_url": "",
      "post_date": "2017-04-13T10:01:30.800000",
      "content": "<p>@sh1ng\nLoss for nodule yes/no: binary cross entropy\nLoss for malignancy: Squared Error\nLoss for tissue segmenter: Dice\nPredictions were not per 1mm but I used a stride of 12mm.\nSo a 240x240x240 patient scan gave 20x20x20 predictions.\nYes one for malignancy and one for nodule yes/no..</p>\n\n<p>I will post some screenshots..</p>\n\n<p>@FangzouLiao\nYes.. 32x32x32 was a bit small but combined with different zoom levels it was quite adequate.\nThe 0.429 LB was a result of blending our models. Best single model was 0.441 LB, 0.385 CV.\nSomehow blending Daniel's stuff with mine did good on LB.\nHowever.. I really struggled with LB. Better CV usually gave worse LB and vise versa.\nI looked for directional improvements for both at the same time. Daniel's mantra was \"In CV we trust\" :)</p>",
      "votes": 1,
      "replies": [
        {
          "id": 174967,
          "author_name": "Fangzhou Liao",
          "author_url": "",
          "post_date": "2017-04-13T10:21:07.360000",
          "content": "<p>Yes, I finally realized that the LB is full of outliers and is not trustworthy, so I asked you the question in your last post. Your confirmation gives me the confidence to my CV. Thank you for that</p>",
          "votes": 1,
          "replies": []
        }
      ]
    },
    {
      "id": 174954,
      "author_name": "Argmen",
      "author_url": "",
      "post_date": "2017-04-13T09:31:38.700000",
      "content": "<p>Ok..I noticed the malignancy info but do not have much time to try that - -</p>",
      "votes": 1,
      "replies": []
    },
    {
      "id": 174935,
      "author_name": "Fangzhou Liao",
      "author_url": "",
      "post_date": "2017-04-13T08:43:59.923000",
      "content": "<p>Cool! 32x32x32? This model architecture is much simpler than mine! Does it work well?</p>\n\n<p>And how do you (and other guys) achieved 0.42 in stage 1? I can not achieve this score even after fine tuning the model on LB dataset.</p>",
      "votes": 1,
      "replies": []
    },
    {
      "id": 828728,
      "author_name": "karnabharath",
      "author_url": "",
      "post_date": "2020-05-01T08:46:20.790000",
      "content": "<p>Hi,</p>\n\n<p>Any links for the final code  ?</p>\n\n<p>Thnx</p>",
      "votes": 0,
      "replies": []
    },
    {
      "id": 175065,
      "author_name": "PhilGreenwood",
      "author_url": "",
      "post_date": "2017-04-13T16:51:15.223000",
      "content": "<p>Thanks very much for the detail</p>",
      "votes": 1,
      "replies": []
    },
    {
      "id": 175061,
      "author_name": "Jie Yang",
      "author_url": "",
      "post_date": "2017-04-13T16:39:51.430000",
      "content": "<p>Congrats! Thanks for sharing!</p>",
      "votes": 1,
      "replies": []
    },
    {
      "id": 174928,
      "author_name": "Keyur K. Mithawala",
      "author_url": "",
      "post_date": "2017-04-13T07:56:04.150000",
      "content": "<p>Thank you for the walk-through Julian!  </p>",
      "votes": 1,
      "replies": []
    }
  ],
  "comment_count": 31,
  "messages": [
    {
      "id": 174900,
      "postDate": "2017-04-13T06:20:22.873Z",
      "content": "<p>Hello, here a very quick 1st summary on my part our 2nd place solution. Of course a real writeup and code will follow.</p>\n\n<p><strong>Tools.</strong><br>\nI used Keras + Tensorflow on windows 64.\nIt just came out and wanted to give it a go.\nFor visualisation + debugging I used a specially built viewer.\nI used that one for checking labels, predictions etc.</p>\n\n<p><strong>General approach.</strong><br>\nThe main insight for me (and as a coincidence Daniel) was to use <strong>the malignancy information from the LIDC database</strong> as labeled by the doctors and combine it with the LUNA16 negative labels.\nI trained up a 32x32x32 3d convnet to detect nodules AND predict malignancy in one go.\nI did <strong>not use segmented lungs</strong> but rather trained on the full images to not miss any nodules located near the edges.</p>\n\n<p>Furthermore it was appearantly extremely important you <strong>not let yourself get too distracted by the leaderboard</strong>. \nAs Daniel said \"In CV we trust\".</p>\n\n<p><strong>Preprocessing</strong><br>\nScale everything to 1x1x1 mm. Make sure that all patients have the same orientation in both LUNA and NDSB.\nConnect the LIDC data to the LUNA data. I expressed all coordinates as 0.0 to 1.0 so that it was scale independent.\nI used my viewer to check if all positive and negative labels. </p>\n\n<p><strong>Labels</strong><br>\nI used ALL positive LIDC doctor assessments as positive, malignancy label info. Even when only one doctor saw something.\nThe though was that the malignancy info was still very valuable. Then I used the negative entries of candidatesv2.csv from LUNA16 as negatives labels.\nNote that some overlapped with nodules that were tagged by only one doctor.\nTo train on the full images I samples extra negative labels on non-lung tissue. I found that tissue by taking the segmenter from the forum and sampling around the mask edges.\nThen I trained a first network and predicted on the LUNA set. All false positives I added as extra negative examples.\nAll in all ca. 400.000 candidates, 100.000 non lung tissue, 10.000 false positives, 2000 LIDC positives.</p>\n\n<p>For my 2nd model I predicted on the NDSB data and then played \"doctor julian\" and manually annotated positive nodules and false positives and added those to the trainset.</p>\n\n<p>Another important observation was that in LUNA16 nodules &gt; 3cm (masses) were NOT labeled. So I excluded negative labels that overlapped these masses since it migt confuse the network.</p>\n\n<p><strong>3D convnet nodule, malignancy detector.</strong><br>\nI trained a 32x32x32 3D convnet on extracted, labeled crops . The architecture was a butchered version of the C3D architecture, which is basically VGG like.\nI spent very (too?) little time optimizing the network architecture.</p>\n\n<p>Somehow I made it so to do multitask learning. So I trained on Nodule Y/N, Malignancy in one go. This worked best for me but Daniel\ndid it in 2 stages.</p>\n\n<p>The labels were very unbalanced so I upsampled the positive cases onto 1:20. Heavy (lossless) augmentation somehow worked.\nI'm still a bit surprised how few positive cases were needed.</p>\n\n<p>Using the trained network I prediced on the NDSB data using a 12 mm stepsize which gave a lattice with nodule malignancies.\nFor every patient I only used the max malignancy and the z-location. I did this at 3 zoom levels to also be able to detect bigger nodules.</p>\n\n<p><strong>Strange tissue detector.</strong><br>\nA small part of the solution was a \"strange tissue\" detector. I basically used some examples of strange tissue from LUNA, NDSB, a few axamples from the extra data thread.\nI labeled them with the same program I used for the 2nd NDSB. Then I trained a small U-Net. This net gave per patient the amount of strange tissue.\nI also tried the same trick for overal holistic info and empysema but they did not have any significant impact.</p>\n\n<p><strong>Final classifier.</strong><br>\nI used Xgboost on the max malignancy at 3 zoom levels, the z-location and the amount of strange tissue.\nI used min-childweight of 60 to prevent overfitting.\nLocal CV was around 0.39 but the LB had a will of its own and I had a very hard time finding improvements that improved both local CV and LB.</p>\n\n<p><strong>Daniels models.</strong><br>\nI joined with Daniel Hammack and we both were convinced we had an original idea. Turned out that we both used malignancy info from LIDC.\nHowever, his network architecture was 64x64x64, resnet like and used 2 stages. Also he used extra nodule info from LIDC. So in the end our models were still quite complimentary.\nMore info on his stuff will be in his writeup. My strategy was to average the models into one final solution. </p>\n\n<p><strong>My thanks to Daniel.</strong><br> \nHe really kept his cool when the LB was at complete chaos with all the overfitting taking place.\nYou are extremely bright and much more sophisticated than me in your ML approach :)</p>",
      "rawMarkdown": "Hello, here a very quick 1st summary on my part our 2nd place solution. Of course a real writeup and code will follow.\n\n**Tools.**<br>\nI used Keras + Tensorflow on windows 64.\nIt just came out and wanted to give it a go.\nFor visualisation + debugging I used a specially built viewer.\nI used that one for checking labels, predictions etc.\n\n**General approach.**<br>\nThe main insight for me (and as a coincidence Daniel) was to use **the malignancy information from the LIDC database** as labeled by the doctors and combine it with the LUNA16 negative labels.\nI trained up a 32x32x32 3d convnet to detect nodules AND predict malignancy in one go.\nI did **not use segmented lungs** but rather trained on the full images to not miss any nodules located near the edges.\n\nFurthermore it was appearantly extremely important you **not let yourself get too distracted by the leaderboard**. \nAs Daniel said \"In CV we trust\".\n\n**Preprocessing**<br>\nScale everything to 1x1x1 mm. Make sure that all patients have the same orientation in both LUNA and NDSB.\nConnect the LIDC data to the LUNA data. I expressed all coordinates as 0.0 to 1.0 so that it was scale independent.\nI used my viewer to check if all positive and negative labels. \n\n**Labels**<br>\nI used ALL positive LIDC doctor assessments as positive, malignancy label info. Even when only one doctor saw something.\nThe though was that the malignancy info was still very valuable. Then I used the negative entries of candidatesv2.csv from LUNA16 as negatives labels.\nNote that some overlapped with nodules that were tagged by only one doctor.\nTo train on the full images I samples extra negative labels on non-lung tissue. I found that tissue by taking the segmenter from the forum and sampling around the mask edges.\nThen I trained a first network and predicted on the LUNA set. All false positives I added as extra negative examples.\nAll in all ca. 400.000 candidates, 100.000 non lung tissue, 10.000 false positives, 2000 LIDC positives.\n\nFor my 2nd model I predicted on the NDSB data and then played \"doctor julian\" and manually annotated positive nodules and false positives and added those to the trainset.\n\nAnother important observation was that in LUNA16 nodules > 3cm (masses) were NOT labeled. So I excluded negative labels that overlapped these masses since it migt confuse the network.\n\n**3D convnet nodule, malignancy detector.**<br>\nI trained a 32x32x32 3D convnet on extracted, labeled crops . The architecture was a butchered version of the C3D architecture, which is basically VGG like.\nI spent very (too?) little time optimizing the network architecture.\n\nSomehow I made it so to do multitask learning. So I trained on Nodule Y/N, Malignancy in one go. This worked best for me but Daniel\ndid it in 2 stages.\n\nThe labels were very unbalanced so I upsampled the positive cases onto 1:20. Heavy (lossless) augmentation somehow worked.\nI'm still a bit surprised how few positive cases were needed.\n\nUsing the trained network I prediced on the NDSB data using a 12 mm stepsize which gave a lattice with nodule malignancies.\nFor every patient I only used the max malignancy and the z-location. I did this at 3 zoom levels to also be able to detect bigger nodules.\n\n**Strange tissue detector.**<br>\nA small part of the solution was a \"strange tissue\" detector. I basically used some examples of strange tissue from LUNA, NDSB, a few axamples from the extra data thread.\nI labeled them with the same program I used for the 2nd NDSB. Then I trained a small U-Net. This net gave per patient the amount of strange tissue.\nI also tried the same trick for overal holistic info and empysema but they did not have any significant impact.\n\n**Final classifier.**<br>\nI used Xgboost on the max malignancy at 3 zoom levels, the z-location and the amount of strange tissue.\nI used min-childweight of 60 to prevent overfitting.\nLocal CV was around 0.39 but the LB had a will of its own and I had a very hard time finding improvements that improved both local CV and LB.\n\n**Daniels models.**<br>\nI joined with Daniel Hammack and we both were convinced we had an original idea. Turned out that we both used malignancy info from LIDC.\nHowever, his network architecture was 64x64x64, resnet like and used 2 stages. Also he used extra nodule info from LIDC. So in the end our models were still quite complimentary.\nMore info on his stuff will be in his writeup. My strategy was to average the models into one final solution. \n\n**My thanks to Daniel.**<br> \nHe really kept his cool when the LB was at complete chaos with all the overfitting taking place.\nYou are extremely bright and much more sophisticated than me in your ML approach :)",
      "votes": 88
    },
    {
      "id": 175604,
      "postDate": "2017-04-16T13:22:38.530Z",
      "content": "<p>Really good point about trusting in CV and not over-fitting the leaderboard.</p>",
      "rawMarkdown": "Really good point about trusting in CV and not over-fitting the leaderboard.",
      "votes": 3
    },
    {
      "id": 174934,
      "postDate": "2017-04-13T08:40:16.960Z",
      "content": "<p>Congratz Julian &amp; Daniel!</p>",
      "rawMarkdown": "Congratz Julian & Daniel!",
      "votes": 3
    },
    {
      "id": 176145,
      "postDate": "2017-04-19T03:58:57.727Z",
      "content": "<p>Hi</p>\n\n<p>Congratulate on your great work!</p>\n\n<p>I notice that your log-loss is around 0.4.\nIs there a way that you can convert this metric to something like true-positive rate, false-positive rate, true-negative rate, or false-negative rate?</p>\n\n<p>Warm regards,\nShu-Ju</p>",
      "rawMarkdown": "Hi\n\nCongratulate on your great work!\n\nI notice that your log-loss is around 0.4.\nIs there a way that you can convert this metric to something like true-positive rate, false-positive rate, true-negative rate, or false-negative rate?\n\nWarm regards,\nShu-Ju\n\n ",
      "votes": 2,
      "replies": [
        {
          "id": 176193,
          "postDate": "2017-04-19T10:33:35.330Z",
          "content": "<p>Hello, thanks!<br>\nFor stage 1. public LB. Logloss 0.43 AUC was 0.85.<br>\nFor stage2 (0.40) we do not have the labels..<br></p>\n\n<p><img src=\"https://retinopaty.blob.core.windows.net/ndsb3/roc_public_lb2.png\" alt=\"ROC\" title=\"\"></p>",
          "rawMarkdown": "Hello, thanks!<br>\nFor stage 1. public LB. Logloss 0.43 AUC was 0.85.<br>\nFor stage2 (0.40) we do not have the labels..<br>\n\n![ROC][1]\n\n\n  [1]: https://retinopaty.blob.core.windows.net:443/ndsb3/roc_public_lb2.png",
          "votes": 2
        }
      ]
    },
    {
      "id": 175146,
      "postDate": "2017-04-14T01:28:26.387Z",
      "content": "<p>Cool mindset on handling such competitive ML subject!</p>",
      "rawMarkdown": "Cool mindset on handling such competitive ML subject!",
      "votes": 2
    },
    {
      "id": 175118,
      "postDate": "2017-04-13T20:57:39.603Z",
      "content": "<p>Congrats Julian and Daniel and thanks for sharing. </p>\n\n<p>Do you know how big of a difference the <strong>strange tissue detector</strong> made to your overall score? </p>",
      "rawMarkdown": "Congrats Julian and Daniel and thanks for sharing. \n\nDo you know how big of a difference the **strange tissue detector** made to your overall score? ",
      "votes": 2,
      "replies": [
        {
          "id": 175176,
          "postDate": "2017-04-14T06:03:32.430Z",
          "content": "<p>Not much but I'd like to think that it just made the difference.\nThere are about 10 cases in the trainset with a lot of strange tissue and no or small nodules.\nOf those 10 cases about 5 of them are cancer. So with strange tissue the chance of being cancer is higher. Instead of a hard negative the classifier with raise the chance a bit. So instead of a big logloss penalty you get a more mild penalty.</p>\n\n<p>Here an example.\n<img src=\"https://retinopaty.blob.core.windows.net/ndsb3/tissue.png\" alt=\"enter image description here\" title=\"\"></p>",
          "rawMarkdown": "Not much but I'd like to think that it just made the difference.\nThere are about 10 cases in the trainset with a lot of strange tissue and no or small nodules.\nOf those 10 cases about 5 of them are cancer. So with strange tissue the chance of being cancer is higher. Instead of a hard negative the classifier with raise the chance a bit. So instead of a big logloss penalty you get a more mild penalty.\n\nHere an example.\n![enter image description here][1]\n\n\n  [1]: https://retinopaty.blob.core.windows.net/ndsb3/tissue.png",
          "votes": 1
        }
      ]
    },
    {
      "id": 175071,
      "postDate": "2017-04-13T17:13:43.297Z",
      "content": "<p>Thanks a lot for sharing! Do you mind sharing what kind of hardware you were using? Also, is your visualisation tool publicly available?</p>",
      "rawMarkdown": "Thanks a lot for sharing! Do you mind sharing what kind of hardware you were using? Also, is your visualisation tool publicly available?",
      "votes": 2,
      "replies": [
        {
          "id": 175178,
          "postDate": "2017-04-14T06:08:56.467Z",
          "content": "<p>I trained on backup computer with a GTX 980. <br>\nSince I was on 32x32x32 you did not need a heavy card.<br>\nI think having SSD harddrives was more imprortant for high throughput.</p>\n\n<p>The viewer is a hasty job and depends on specific folder structures.\nIt would be a pain to run.</p>",
          "rawMarkdown": "I trained on backup computer with a GTX 980. <br>\nSince I was on 32x32x32 you did not need a heavy card.<br>\nI think having SSD harddrives was more imprortant for high throughput.\n\nThe viewer is a hasty job and depends on specific folder structures.\nIt would be a pain to run.\n\n\n\n\n"
        }
      ]
    },
    {
      "id": 174932,
      "postDate": "2017-04-13T08:29:26.633Z",
      "content": "<p>Big thanks for your sharing and congratulations!</p>\n\n<p>Could you elaborate a little more about loss function in each case. Was it cross entropy, dice or something else?</p>\n\n<p>By predicting nodule and malignancy do you mean two masks with probability per pixel(1x1x1 cube) or per whole patch?  </p>",
      "rawMarkdown": "Big thanks for your sharing and congratulations!\n\n Could you elaborate a little more about loss function in each case. Was it cross entropy, dice or something else?\n\nBy predicting nodule and malignancy do you mean two masks with probability per pixel(1x1x1 cube) or per whole patch?  ",
      "votes": 2
    },
    {
      "id": 175976,
      "postDate": "2017-04-18T10:39:56.847Z",
      "content": "<p>Thanks for sharing! Great job, it was really helpful to me since I am just starting my journey on image recognition competitions..!</p>",
      "rawMarkdown": "Thanks for sharing! Great job, it was really helpful to me since I am just starting my journey on image recognition competitions..!",
      "votes": 1
    },
    {
      "id": 175465,
      "postDate": "2017-04-15T16:01:37.487Z",
      "content": "<p>congrats julian!! when r u planning on posting the code? </p>",
      "rawMarkdown": "congrats julian!! when r u planning on posting the code? ",
      "votes": 1,
      "replies": [
        {
          "id": 175469,
          "postDate": "2017-04-15T16:53:22.227Z",
          "content": "<p>Thanks,<br>\nYes, we'll publish the code.<br>\nEverybody that wants to win a prize has to if I understood correctly.<br>\nJust have to clean up a bit. :)</p>",
          "rawMarkdown": "Thanks,<br>\nYes, we'll publish the code.<br>\nEverybody that wants to win a prize has to if I understood correctly.<br>\nJust have to clean up a bit. :)\n"
        }
      ]
    },
    {
      "id": 175306,
      "postDate": "2017-04-14T20:31:57.077Z",
      "content": "<p>Congrats Julian and Daniel! Thank you for sharing your approach!</p>",
      "rawMarkdown": "Congrats Julian and Daniel! Thank you for sharing your approach!",
      "votes": 1
    },
    {
      "id": 175271,
      "postDate": "2017-04-14T17:24:59.767Z",
      "content": "<p>Congratulations, Julian &amp; Daniel! Thanks for sharing. I am wondering did you use convNet raw features (likely fully-connected layer input) from max malignancy locations? Or did you just use the scalar max malignancy probability? </p>\n\n<p>Also, does you final submission still have a big gap between local CV and stage 1 LB? We also had a very difficult time getting both improving at the same time. </p>",
      "rawMarkdown": "Congratulations, Julian & Daniel! Thanks for sharing. I am wondering did you use convNet raw features (likely fully-connected layer input) from max malignancy locations? Or did you just use the scalar max malignancy probability? \n\nAlso, does you final submission still have a big gap between local CV and stage 1 LB? We also had a very difficult time getting both improving at the same time. ",
      "votes": 1,
      "replies": [
        {
          "id": 175291,
          "postDate": "2017-04-14T18:51:49.290Z",
          "content": "<blockquote>\n  <p>did you use convNet raw features (likely fully-connected layer input) from max malignancy locations? Or did you just use the scalar max malignancy probability?</p>\n</blockquote>\n\n<p>We did not chop off the last layer of the network if that is what you are asking. We both used the actual malignancy predictions to generate some 'hand crafted' features like:</p>\n\n<ul>\n<li>max (nodule malignancy predictions)</li>\n<li>stdev( nodule malignancy predictions)</li>\n<li>location of most malignant nodule, etc.</li>\n</ul>\n\n<p>It may be possible to slightly improve the score by doing what you suggest and using the inputs to the final layer at the most malignant nodule as features. I tried a variant of this earlier in the competition without success but I never tried it again later.</p>\n\n<p>Also, does you final submission still have a big gap between local CV and stage 1 LB?</p>\n\n<p>Yes. For example, my 'second ensemble' had a local CV score of 0.390 and a stage 1 LB score of 0.451. It was very hard to ignore the stage 1 LB and trust our CV score! Ultimately I ended up basically ignoring the stage 1 LB altogether and just focusing on improving CV as CV had 1400 scans compared to the 200 in the public LB.</p>",
          "rawMarkdown": ">did you use convNet raw features (likely fully-connected layer input) from max malignancy locations? Or did you just use the scalar max malignancy probability?\n\nWe did not chop off the last layer of the network if that is what you are asking. We both used the actual malignancy predictions to generate some 'hand crafted' features like:\n\n* max (nodule malignancy predictions)\n* stdev( nodule malignancy predictions)\n* location of most malignant nodule, etc.\n\nIt may be possible to slightly improve the score by doing what you suggest and using the inputs to the final layer at the most malignant nodule as features. I tried a variant of this earlier in the competition without success but I never tried it again later.\n\nAlso, does you final submission still have a big gap between local CV and stage 1 LB?\n\nYes. For example, my 'second ensemble' had a local CV score of 0.390 and a stage 1 LB score of 0.451. It was very hard to ignore the stage 1 LB and trust our CV score! Ultimately I ended up basically ignoring the stage 1 LB altogether and just focusing on improving CV as CV had 1400 scans compared to the 200 in the public LB.\n\n",
          "votes": 2
        },
        {
          "id": 175320,
          "postDate": "2017-04-14T22:01:44.300Z",
          "content": "<p>Thank you very much for the detailed sharing, Daniel! </p>\n\n<p>I am deeply impressed by how well your results are without including the \"black art\" convNet features. Even though convNet is so popular on image tasks right now, it's good to know that we don't have to rely on such black features to achieve top results (or at least just keep the black features inside the black box itself). </p>\n\n<p>For the big gap between local CV and LB, it's really courageous to ignore LB altogether and just focus on local CV! I was too scared to do this, but guess I could be braver next time. </p>",
          "rawMarkdown": "Thank you very much for the detailed sharing, Daniel! \n\nI am deeply impressed by how well your results are without including the \"black art\" convNet features. Even though convNet is so popular on image tasks right now, it's good to know that we don't have to rely on such black features to achieve top results (or at least just keep the black features inside the black box itself). \n\nFor the big gap between local CV and LB, it's really courageous to ignore LB altogether and just focus on local CV! I was too scared to do this, but guess I could be braver next time. "
        }
      ]
    },
    {
      "id": 175010,
      "postDate": "2017-04-13T13:28:03.967Z",
      "content": "<p>Congrats! Thanks for sharing.\nWhat do you mean by \"3 zoom levels\"? 3 different 3d-filter sizes (receptive field) at the first level of your 3d-cnn?</p>",
      "rawMarkdown": "Congrats! Thanks for sharing.\nWhat do you mean by \"3 zoom levels\"? 3 different 3d-filter sizes (receptive field) at the first level of your 3d-cnn?",
      "votes": 1,
      "replies": [
        {
          "id": 175020,
          "postDate": "2017-04-13T13:44:46.040Z",
          "content": "<p>I was not clear about that.<br>\nI trained the net on 1x1x1 mm per pixel.<br>\nSince the receptive field size was 32x32x32 it sometimes missed larger nodules.<br>\nSo during prediction I predicted on 3 scales<br></p>\n\n<ul>\n<li>1x1x1 mm per pixel.</li>\n<li>1.5x1.5x1.5 mm per pixel.</li>\n<li>2x2x2 mm per pixel.</li>\n</ul>\n\n<p><br>\nI used the same network every time.<br>\nIt was a cheeky fix but somehow it worked. </p>",
          "rawMarkdown": "I was not clear about that.<br>\nI trained the net on 1x1x1 mm per pixel.<br>\nSince the receptive field size was 32x32x32 it sometimes missed larger nodules.<br>\nSo during prediction I predicted on 3 scales<br>\n\n - 1x1x1 mm per pixel.\n - 1.5x1.5x1.5 mm per pixel.\n - 2x2x2 mm per pixel.\n\n\n<br>\nI used the same network every time.<br>\nIt was a cheeky fix but somehow it worked. \n\n\n\n\n\n\n\n\n",
          "votes": 1
        },
        {
          "id": 175256,
          "postDate": "2017-04-14T16:07:02.960Z",
          "content": "<p>I see. You resampled test scans three times, but using the same network instead. Thanks for sharing.</p>",
          "rawMarkdown": "I see. You resampled test scans three times, but using the same network instead. Thanks for sharing."
        }
      ]
    },
    {
      "id": 174974,
      "postDate": "2017-04-13T10:39:01.687Z",
      "content": "<p>Dear all, I was trying to find the malignancy labels for LIDC data, but didn't quite manage to find them. Could you give a hint where those labels are stored?</p>",
      "rawMarkdown": "Dear all, I was trying to find the malignancy labels for LIDC data, but didn't quite manage to find them. Could you give a hint where those labels are stored?",
      "votes": 1,
      "replies": [
        {
          "id": 174976,
          "postDate": "2017-04-13T10:44:38.540Z",
          "content": "<p><a href=\"https://wiki.cancerimagingarchive.net/display/Public/LIDC-IDRI#31cc3a04bc704e7f88d81c8df1a9e662\">This link</a><br>\nThen detailed description.<br>\nThen \"XML File Documentation\"<br></p>",
          "rawMarkdown": "[This link][1]<br>\nThen detailed description.<br>\nThen \"XML File Documentation\"<br>\n\n\n  [1]: https://wiki.cancerimagingarchive.net/display/Public/LIDC-IDRI#31cc3a04bc704e7f88d81c8df1a9e662"
        },
        {
          "id": 174979,
          "postDate": "2017-04-13T10:47:21.260Z",
          "content": "<p>thanks!</p>",
          "rawMarkdown": "thanks!"
        }
      ]
    },
    {
      "id": 174962,
      "postDate": "2017-04-13T10:01:30.800Z",
      "content": "<p>@sh1ng\nLoss for nodule yes/no: binary cross entropy\nLoss for malignancy: Squared Error\nLoss for tissue segmenter: Dice\nPredictions were not per 1mm but I used a stride of 12mm.\nSo a 240x240x240 patient scan gave 20x20x20 predictions.\nYes one for malignancy and one for nodule yes/no..</p>\n\n<p>I will post some screenshots..</p>\n\n<p>@FangzouLiao\nYes.. 32x32x32 was a bit small but combined with different zoom levels it was quite adequate.\nThe 0.429 LB was a result of blending our models. Best single model was 0.441 LB, 0.385 CV.\nSomehow blending Daniel's stuff with mine did good on LB.\nHowever.. I really struggled with LB. Better CV usually gave worse LB and vise versa.\nI looked for directional improvements for both at the same time. Daniel's mantra was \"In CV we trust\" :)</p>",
      "rawMarkdown": "@sh1ng\nLoss for nodule yes/no: binary cross entropy\nLoss for malignancy: Squared Error\nLoss for tissue segmenter: Dice\nPredictions were not per 1mm but I used a stride of 12mm.\nSo a 240x240x240 patient scan gave 20x20x20 predictions.\nYes one for malignancy and one for nodule yes/no..\n\nI will post some screenshots..\n\n@FangzouLiao\nYes.. 32x32x32 was a bit small but combined with different zoom levels it was quite adequate.\nThe 0.429 LB was a result of blending our models. Best single model was 0.441 LB, 0.385 CV.\nSomehow blending Daniel's stuff with mine did good on LB.\nHowever.. I really struggled with LB. Better CV usually gave worse LB and vise versa.\nI looked for directional improvements for both at the same time. Daniel's mantra was \"In CV we trust\" :)\n\n\n\n\n\n\n\n\n\n",
      "votes": 1,
      "replies": [
        {
          "id": 174967,
          "postDate": "2017-04-13T10:21:07.360Z",
          "content": "<p>Yes, I finally realized that the LB is full of outliers and is not trustworthy, so I asked you the question in your last post. Your confirmation gives me the confidence to my CV. Thank you for that</p>",
          "rawMarkdown": "Yes, I finally realized that the LB is full of outliers and is not trustworthy, so I asked you the question in your last post. Your confirmation gives me the confidence to my CV. Thank you for that",
          "votes": 1
        }
      ]
    },
    {
      "id": 174954,
      "postDate": "2017-04-13T09:31:38.700Z",
      "content": "<p>Ok..I noticed the malignancy info but do not have much time to try that - -</p>",
      "rawMarkdown": "Ok..I noticed the malignancy info but do not have much time to try that - -",
      "votes": 1
    },
    {
      "id": 174935,
      "postDate": "2017-04-13T08:43:59.923Z",
      "content": "<p>Cool! 32x32x32? This model architecture is much simpler than mine! Does it work well?</p>\n\n<p>And how do you (and other guys) achieved 0.42 in stage 1? I can not achieve this score even after fine tuning the model on LB dataset.</p>",
      "rawMarkdown": "Cool! 32x32x32? This model architecture is much simpler than mine! Does it work well?\n\nAnd how do you (and other guys) achieved 0.42 in stage 1? I can not achieve this score even after fine tuning the model on LB dataset.\n\n",
      "votes": 1
    },
    {
      "id": 828728,
      "postDate": "2020-05-01T08:46:20.790Z",
      "content": "<p>Hi,</p>\n\n<p>Any links for the final code  ?</p>\n\n<p>Thnx</p>",
      "rawMarkdown": "Hi,\n\nAny links for the final code  ?\n\nThnx"
    },
    {
      "id": 175065,
      "postDate": "2017-04-13T16:51:15.223Z",
      "content": "<p>Thanks very much for the detail</p>",
      "rawMarkdown": "Thanks very much for the detail",
      "votes": 1
    },
    {
      "id": 175061,
      "postDate": "2017-04-13T16:39:51.430Z",
      "content": "<p>Congrats! Thanks for sharing!</p>",
      "rawMarkdown": "Congrats! Thanks for sharing!",
      "votes": 1
    },
    {
      "id": 174928,
      "postDate": "2017-04-13T07:56:04.150Z",
      "content": "<p>Thank you for the walk-through Julian!  </p>",
      "rawMarkdown": "Thank you for the walk-through Julian!  ",
      "votes": 1
    }
  ],
  "complete": true,
  "source": "live",
  "fetched_at": "2026-10-22T09:15:39Z",
  "competition_id": 6004,
  "competition_slug": "data-science-bowl-2017",
  "team_id": 517341,
  "solution_url": "/competitions/data-science-bowl-2017/writeups/julian-de-wit-daniel-hammack-very-quick-1st-summar"
}