{
  "id": 293026,
  "title": "How to do transfer learning and get 0.3 score",
  "url": "/competitions/sartorius-cell-instance-segmentation/discussion/293026",
  "author_name": "odede",
  "post_date": "2021-12-04T07:29:31.067000",
  "votes": 46,
  "comment_count": 24,
  "views": 0,
  "content": "<p>I created notebooks which explained how to do transfer learning and got 0.3 score.<br>\nPlease check it out, and if it helps you, please upvote.  (These notebooks are my first notebooks of my kaggle life)<br>\n<a href=\"https://www.kaggle.com/markunys/sartorius-transfer-learning-train-with-livecell\" target=\"_blank\">train with livecell</a><br>\n<a href=\"https://www.kaggle.com/markunys/sartorius-transfer-learning-train\" target=\"_blank\">train</a><br>\n<a href=\"https://www.kaggle.com/markunys/sartorius-transfer-learning-inference\" target=\"_blank\">inference</a></p>",
  "messages": [
    {
      "id": 1605397,
      "postDate": "2021-12-04T07:29:31.067Z",
      "content": "<p>I created notebooks which explained how to do transfer learning and got 0.3 score.<br>\nPlease check it out, and if it helps you, please upvote.  (These notebooks are my first notebooks of my kaggle life)<br>\n<a href=\"https://www.kaggle.com/markunys/sartorius-transfer-learning-train-with-livecell\" target=\"_blank\">train with livecell</a><br>\n<a href=\"https://www.kaggle.com/markunys/sartorius-transfer-learning-train\" target=\"_blank\">train</a><br>\n<a href=\"https://www.kaggle.com/markunys/sartorius-transfer-learning-inference\" target=\"_blank\">inference</a></p>",
      "rawMarkdown": "I created notebooks which explained how to do transfer learning and got 0.3 score.\nPlease check it out, and if it helps you, please upvote.  (These notebooks are my first notebooks of my kaggle life)\n[train with livecell](https://www.kaggle.com/markunys/sartorius-transfer-learning-train-with-livecell)\n[train](https://www.kaggle.com/markunys/sartorius-transfer-learning-train)\n[inference](https://www.kaggle.com/markunys/sartorius-transfer-learning-inference)",
      "votes": 46
    },
    {
      "id": 1614669,
      "postDate": "2021-12-11T11:33:36.527Z",
      "content": "<p>Hi, <br>\nThanks !<br>\nFor me I was able to improve from 0.308 to 0.311 with livecell transfer.</p>",
      "rawMarkdown": "Hi, \nThanks !\nFor me I was able to improve from 0.308 to 0.311 with livecell transfer.",
      "votes": 1
    },
    {
      "id": 1610710,
      "postDate": "2021-12-07T13:10:53.543Z",
      "content": "<p>could someone tell me how to clear colab cache? note I'm talking about normal CPU cache and not GPU cache. I found that GPU cache is cleared after a soft restart but the same is not true for CPU cache which remains preserved for some reason.</p>\n<p>I ask this because the notebook and data helpfully provided by odede cannot run for 100k iters on Kaggle for even a single \"epoch\" (~2400 iters) and usually give OOM restart on Colab Pro High Ram VM after ~2 epochs.</p>\n<p>tl;dr : It would really help if someone could tell me how to clear Colab CPU RAM Cache😅</p>\n<p>UPD: <a href=\"https://www.kaggle.com/c/sartorius-cell-instance-segmentation/discussion/293894\" target=\"_blank\">Solution</a> - just don't do inference every epoch :)<br>\nUPD2: I couldn't get the postvalidation script to work for models other than ones trained on 3 classes and succumbed to subscribing to colab pro+ after a tedious 30k iters which easily did the rest of my work in a matter of hours using ~1/2 - 1/3 the time pro would have taken. I used the normal save best model and inference per epoch setting. (if you already have pro and some time has passed since your monthly deduction you should consider subscribing too since you get discounts accordingly) </p>",
      "rawMarkdown": "could someone tell me how to clear colab cache? note I'm talking about normal CPU cache and not GPU cache. I found that GPU cache is cleared after a soft restart but the same is not true for CPU cache which remains preserved for some reason.\n\nI ask this because the notebook and data helpfully provided by odede cannot run for 100k iters on Kaggle for even a single \"epoch\" (~2400 iters) and usually give OOM restart on Colab Pro High Ram VM after ~2 epochs.\n\ntl;dr : It would really help if someone could tell me how to clear Colab CPU RAM Cache😅\n\nUPD: [Solution](https://www.kaggle.com/c/sartorius-cell-instance-segmentation/discussion/293894) - just don't do inference every epoch :)\nUPD2: I couldn't get the postvalidation script to work for models other than ones trained on 3 classes and succumbed to subscribing to colab pro+ after a tedious 30k iters which easily did the rest of my work in a matter of hours using ~1/2 - 1/3 the time pro would have taken. I used the normal save best model and inference per epoch setting. (if you already have pro and some time has passed since your monthly deduction you should consider subscribing too since you get discounts accordingly) ",
      "votes": 2
    },
    {
      "id": 1638513,
      "postDate": "2022-01-04T19:31:45.257Z",
      "content": "<p>Thanks for sharing! Very helpful notebooks</p>",
      "rawMarkdown": "Thanks for sharing! Very helpful notebooks"
    },
    {
      "id": 1613517,
      "postDate": "2021-12-10T04:05:16.887Z",
      "content": "<p>I tried transfer learning, but not work. Maybe ~0.001 improved, but may due to the random influences.</p>",
      "rawMarkdown": "I tried transfer learning, but not work. Maybe ~0.001 improved, but may due to the random influences.",
      "replies": [
        {
          "id": 1613523,
          "postDate": "2021-12-10T04:20:04.077Z",
          "content": "<p>What is mAP of your livecell model</p>",
          "rawMarkdown": "What is mAP of your livecell model"
        },
        {
          "id": 1613527,
          "postDate": "2021-12-10T04:28:09.453Z",
          "content": "<p>You mean COCO mAP? I don't know, the competition metric (CV) of livecell model is ~ 0.3. By the way, my CV is always lower than LB about 0.03~0.04.</p>",
          "rawMarkdown": "You mean COCO mAP? I don't know, the competition metric (CV) of livecell model is ~ 0.3. By the way, my CV is always lower than LB about 0.03~0.04.",
          "votes": 1
        },
        {
          "id": 1613603,
          "postDate": "2021-12-10T06:08:49.950Z",
          "content": "<p>Yes my CV is lower than LB too.</p>",
          "rawMarkdown": "Yes my CV is lower than LB too."
        },
        {
          "id": 1613604,
          "postDate": "2021-12-10T06:10:19.643Z",
          "content": "<p>They report all 8 classes up to 47.89 mask ap</p>",
          "rawMarkdown": "They report all 8 classes up to 47.89 mask ap"
        },
        {
          "id": 1614706,
          "postDate": "2021-12-11T12:11:45.833Z",
          "content": "<p>But they have only 23.91/24.92 mAP on shsy5y class.</p>",
          "rawMarkdown": "But they have only 23.91/24.92 mAP on shsy5y class.",
          "votes": 1
        }
      ]
    },
    {
      "id": 1610802,
      "postDate": "2021-12-07T14:37:38.977Z",
      "content": "<p>Hi,Why does \"Your notebook tried to allocate more memory than is available.0\" appear when I run \"train with livecell\" notebook?</p>",
      "rawMarkdown": "Hi,Why does \"Your notebook tried to allocate more memory than is available.0\" appear when I run \"train with livecell\" notebook?",
      "replies": [
        {
          "id": 1610809,
          "postDate": "2021-12-07T14:43:20.567Z",
          "content": "<p>Not doing inference every epoch works in my experience :)<br>\nI.e. comment 'cfg.TEST.EVAL_PERIOD=…' out and then evaluate CV for all your model files using a validation script after training is complete. I've posted one <a href=\"https://www.kaggle.com/ferlockx/validation-score-for-multiple-files\" target=\"_blank\">here</a> to simplify this<br>\nI'm using Colab pro not Kaggle though </p>",
          "rawMarkdown": "Not doing inference every epoch works in my experience :)\nI.e. comment 'cfg.TEST.EVAL_PERIOD=...' out and then evaluate CV for all your model files using a validation script after training is complete. I've posted one [here](https://www.kaggle.com/ferlockx/validation-score-for-multiple-files) to simplify this\nI'm using Colab pro not Kaggle though ",
          "votes": 2
        },
        {
          "id": 1610913,
          "postDate": "2021-12-07T15:42:13.463Z",
          "content": "<p>Thank you！I'm trying.</p>",
          "rawMarkdown": "Thank you！I'm trying."
        }
      ]
    },
    {
      "id": 1610443,
      "postDate": "2021-12-07T08:12:52.987Z",
      "content": "<p>There is a livecell paper has shown the result that wide trainning gain a little MAP.However the pre-condition is that most of the live-cells are those lovely ones like cort in this challenge.</p>",
      "rawMarkdown": "There is a livecell paper has shown the result that wide trainning gain a little MAP.However the pre-condition is that most of the live-cells are those lovely ones like cort in this challenge."
    },
    {
      "id": 1606708,
      "postDate": "2021-12-05T07:38:12.767Z",
      "content": "<p>Is it possible combine livecell and train dataset to one   dataset?  instead of two training stage?</p>",
      "rawMarkdown": "Is it possible combine livecell and train dataset to one   dataset?  instead of two training stage?",
      "replies": [
        {
          "id": 1606730,
          "postDate": "2021-12-05T08:03:01.780Z",
          "content": "<p>I tried training them together with 10 classes but it didn't work as good as transfer learning.</p>",
          "rawMarkdown": "I tried training them together with 10 classes but it didn't work as good as transfer learning.",
          "votes": 2
        },
        {
          "id": 1606739,
          "postDate": "2021-12-05T08:12:16.943Z",
          "content": "<p>It didn't work for me too.</p>",
          "rawMarkdown": "It didn't work for me too.",
          "votes": 1
        },
        {
          "id": 1606757,
          "postDate": "2021-12-05T08:28:07.020Z",
          "content": "<p>thx for reply. just curious.<br>\nactually just 0.04 better with livecell transfer.</p>\n<p>I just trained with train and almost same pipeline, got 0.296</p>\n<p>metric and test label problem.</p>\n<p>post posting would pump LB.</p>\n<p>It also happens in  starfish competition.</p>\n<p>Well trained model will recognize more target than test data labelled.</p>",
          "rawMarkdown": "thx for reply. just curious.\nactually just 0.04 better with livecell transfer.\n\n\n\nI just trained with train and almost same pipeline, got 0.296\n\nmetric and test label problem.\n\n post posting would pump LB.\n\nIt also happens in  starfish competition.\n\nWell trained model will recognize more target than test data labelled.\n\n"
        },
        {
          "id": 1606800,
          "postDate": "2021-12-05T09:12:59.130Z",
          "content": "<blockquote>\n  <p>actually just 0.04 better with livecell transfer.</p>\n</blockquote>\n<p>0.04? Really? Is that a typo?</p>",
          "rawMarkdown": "> actually just 0.04 better with livecell transfer.\n\n0.04? Really? Is that a typo?"
        },
        {
          "id": 1606869,
          "postDate": "2021-12-05T10:49:03.360Z",
          "content": "<p>That's what we are doing, probably we should try transfer learning as we stuck around 0.327</p>",
          "rawMarkdown": "That's what we are doing, probably we should try transfer learning as we stuck around 0.327",
          "votes": 1
        },
        {
          "id": 1607121,
          "postDate": "2021-12-05T15:55:47.113Z",
          "content": "<p>I think it should be 0.004</p>",
          "rawMarkdown": "I think it should be 0.004"
        },
        {
          "id": 1607124,
          "postDate": "2021-12-05T16:00:46.437Z",
          "content": "<p>I haven't tried transfer learning yet, but i think you are right.</p>",
          "rawMarkdown": "I haven't tried transfer learning yet, but i think you are right.",
          "votes": 1
        },
        {
          "id": 1613504,
          "postDate": "2021-12-10T03:43:19.220Z",
          "content": "<p>Does transfer learning improve? I also use <a href=\"https://www.kaggle.com/odede\" target=\"_blank\">@odede</a> and it doesn't seem to improve.</p>",
          "rawMarkdown": "Does transfer learning improve? I also use @odede and it doesn't seem to improve."
        }
      ]
    },
    {
      "id": 1615360,
      "postDate": "2021-12-12T07:21:37.030Z",
      "rawMarkdown": "",
      "votes": 2,
      "isDeleted": true
    },
    {
      "id": 1614342,
      "postDate": "2021-12-11T00:25:21.180Z",
      "rawMarkdown": "",
      "isDeleted": true
    }
  ],
  "comments": [
    {
      "id": 1614669,
      "author_name": "Ali",
      "author_url": "",
      "post_date": "2021-12-11T11:33:36.527000",
      "content": "<p>Hi, <br>\nThanks !<br>\nFor me I was able to improve from 0.308 to 0.311 with livecell transfer.</p>",
      "votes": 1,
      "replies": []
    },
    {
      "id": 1610710,
      "author_name": "Hannah B",
      "author_url": "",
      "post_date": "2021-12-07T13:10:53.543000",
      "content": "<p>could someone tell me how to clear colab cache? note I'm talking about normal CPU cache and not GPU cache. I found that GPU cache is cleared after a soft restart but the same is not true for CPU cache which remains preserved for some reason.</p>\n<p>I ask this because the notebook and data helpfully provided by odede cannot run for 100k iters on Kaggle for even a single \"epoch\" (~2400 iters) and usually give OOM restart on Colab Pro High Ram VM after ~2 epochs.</p>\n<p>tl;dr : It would really help if someone could tell me how to clear Colab CPU RAM Cache😅</p>\n<p>UPD: <a href=\"https://www.kaggle.com/c/sartorius-cell-instance-segmentation/discussion/293894\" target=\"_blank\">Solution</a> - just don't do inference every epoch :)<br>\nUPD2: I couldn't get the postvalidation script to work for models other than ones trained on 3 classes and succumbed to subscribing to colab pro+ after a tedious 30k iters which easily did the rest of my work in a matter of hours using ~1/2 - 1/3 the time pro would have taken. I used the normal save best model and inference per epoch setting. (if you already have pro and some time has passed since your monthly deduction you should consider subscribing too since you get discounts accordingly) </p>",
      "votes": 2,
      "replies": []
    },
    {
      "id": 1638513,
      "author_name": "Hamdi",
      "author_url": "",
      "post_date": "2022-01-04T19:31:45.257000",
      "content": "<p>Thanks for sharing! Very helpful notebooks</p>",
      "votes": 0,
      "replies": []
    },
    {
      "id": 1613517,
      "author_name": "blueboy-97",
      "author_url": "",
      "post_date": "2021-12-10T04:05:16.887000",
      "content": "<p>I tried transfer learning, but not work. Maybe ~0.001 improved, but may due to the random influences.</p>",
      "votes": 0,
      "replies": [
        {
          "id": 1613523,
          "author_name": "Phat Tran",
          "author_url": "",
          "post_date": "2021-12-10T04:20:04.077000",
          "content": "<p>What is mAP of your livecell model</p>",
          "votes": 0,
          "replies": []
        },
        {
          "id": 1613527,
          "author_name": "blueboy-97",
          "author_url": "",
          "post_date": "2021-12-10T04:28:09.453000",
          "content": "<p>You mean COCO mAP? I don't know, the competition metric (CV) of livecell model is ~ 0.3. By the way, my CV is always lower than LB about 0.03~0.04.</p>",
          "votes": 1,
          "replies": []
        },
        {
          "id": 1613603,
          "author_name": "Phat Tran",
          "author_url": "",
          "post_date": "2021-12-10T06:08:49.950000",
          "content": "<p>Yes my CV is lower than LB too.</p>",
          "votes": 0,
          "replies": []
        },
        {
          "id": 1613604,
          "author_name": "Phat Tran",
          "author_url": "",
          "post_date": "2021-12-10T06:10:19.643000",
          "content": "<p>They report all 8 classes up to 47.89 mask ap</p>",
          "votes": 0,
          "replies": []
        },
        {
          "id": 1614706,
          "author_name": "blueboy-97",
          "author_url": "",
          "post_date": "2021-12-11T12:11:45.833000",
          "content": "<p>But they have only 23.91/24.92 mAP on shsy5y class.</p>",
          "votes": 1,
          "replies": []
        }
      ]
    },
    {
      "id": 1610802,
      "author_name": "Liuxwww",
      "author_url": "",
      "post_date": "2021-12-07T14:37:38.977000",
      "content": "<p>Hi,Why does \"Your notebook tried to allocate more memory than is available.0\" appear when I run \"train with livecell\" notebook?</p>",
      "votes": 0,
      "replies": [
        {
          "id": 1610809,
          "author_name": "Hannah B",
          "author_url": "",
          "post_date": "2021-12-07T14:43:20.567000",
          "content": "<p>Not doing inference every epoch works in my experience :)<br>\nI.e. comment 'cfg.TEST.EVAL_PERIOD=…' out and then evaluate CV for all your model files using a validation script after training is complete. I've posted one <a href=\"https://www.kaggle.com/ferlockx/validation-score-for-multiple-files\" target=\"_blank\">here</a> to simplify this<br>\nI'm using Colab pro not Kaggle though </p>",
          "votes": 2,
          "replies": []
        },
        {
          "id": 1610913,
          "author_name": "Liuxwww",
          "author_url": "",
          "post_date": "2021-12-07T15:42:13.463000",
          "content": "<p>Thank you！I'm trying.</p>",
          "votes": 0,
          "replies": []
        }
      ]
    },
    {
      "id": 1610443,
      "author_name": "Lupin",
      "author_url": "",
      "post_date": "2021-12-07T08:12:52.987000",
      "content": "<p>There is a livecell paper has shown the result that wide trainning gain a little MAP.However the pre-condition is that most of the live-cells are those lovely ones like cort in this challenge.</p>",
      "votes": 0,
      "replies": []
    },
    {
      "id": 1606708,
      "author_name": "dragon zhang",
      "author_url": "",
      "post_date": "2021-12-05T07:38:12.767000",
      "content": "<p>Is it possible combine livecell and train dataset to one   dataset?  instead of two training stage?</p>",
      "votes": 0,
      "replies": [
        {
          "id": 1606730,
          "author_name": "Gunes Evitan",
          "author_url": "",
          "post_date": "2021-12-05T08:03:01.780000",
          "content": "<p>I tried training them together with 10 classes but it didn't work as good as transfer learning.</p>",
          "votes": 2,
          "replies": []
        },
        {
          "id": 1606739,
          "author_name": "odede",
          "author_url": "",
          "post_date": "2021-12-05T08:12:16.943000",
          "content": "<p>It didn't work for me too.</p>",
          "votes": 1,
          "replies": []
        },
        {
          "id": 1606757,
          "author_name": "dragon zhang",
          "author_url": "",
          "post_date": "2021-12-05T08:28:07.020000",
          "content": "<p>thx for reply. just curious.<br>\nactually just 0.04 better with livecell transfer.</p>\n<p>I just trained with train and almost same pipeline, got 0.296</p>\n<p>metric and test label problem.</p>\n<p>post posting would pump LB.</p>\n<p>It also happens in  starfish competition.</p>\n<p>Well trained model will recognize more target than test data labelled.</p>",
          "votes": 0,
          "replies": []
        },
        {
          "id": 1606800,
          "author_name": "blueboy-97",
          "author_url": "",
          "post_date": "2021-12-05T09:12:59.130000",
          "content": "<blockquote>\n  <p>actually just 0.04 better with livecell transfer.</p>\n</blockquote>\n<p>0.04? Really? Is that a typo?</p>",
          "votes": 0,
          "replies": []
        },
        {
          "id": 1606869,
          "author_name": "Valentin Nikotin",
          "author_url": "",
          "post_date": "2021-12-05T10:49:03.360000",
          "content": "<p>That's what we are doing, probably we should try transfer learning as we stuck around 0.327</p>",
          "votes": 1,
          "replies": []
        },
        {
          "id": 1607121,
          "author_name": "Phat Tran",
          "author_url": "",
          "post_date": "2021-12-05T15:55:47.113000",
          "content": "<p>I think it should be 0.004</p>",
          "votes": 0,
          "replies": []
        },
        {
          "id": 1607124,
          "author_name": "blueboy-97",
          "author_url": "",
          "post_date": "2021-12-05T16:00:46.437000",
          "content": "<p>I haven't tried transfer learning yet, but i think you are right.</p>",
          "votes": 1,
          "replies": []
        },
        {
          "id": 1613504,
          "author_name": "yerongg",
          "author_url": "",
          "post_date": "2021-12-10T03:43:19.220000",
          "content": "<p>Does transfer learning improve? I also use <a href=\"https://www.kaggle.com/odede\" target=\"_blank\">@odede</a> and it doesn't seem to improve.</p>",
          "votes": 0,
          "replies": []
        }
      ]
    },
    {
      "id": 1615360,
      "author_name": "",
      "author_url": "",
      "post_date": "2021-12-12T07:21:37.030000",
      "content": "",
      "votes": 2,
      "replies": []
    },
    {
      "id": 1614342,
      "author_name": "",
      "author_url": "",
      "post_date": "2021-12-11T00:25:21.180000",
      "content": "",
      "votes": 0,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "1605397": "I created notebooks which explained how to do transfer learning and got 0.3 score.\nPlease check it out, and if it helps you, please upvote.  (These notebooks are my first notebooks of my kaggle life)\n[train with livecell](https://www.kaggle.com/markunys/sartorius-transfer-learning-train-with-livecell)\n[train](https://www.kaggle.com/markunys/sartorius-transfer-learning-train)\n[inference](https://www.kaggle.com/markunys/sartorius-transfer-learning-inference)",
    "1614669": "Hi, \nThanks !\nFor me I was able to improve from 0.308 to 0.311 with livecell transfer.",
    "1610710": "could someone tell me how to clear colab cache? note I'm talking about normal CPU cache and not GPU cache. I found that GPU cache is cleared after a soft restart but the same is not true for CPU cache which remains preserved for some reason.\n\nI ask this because the notebook and data helpfully provided by odede cannot run for 100k iters on Kaggle for even a single \"epoch\" (~2400 iters) and usually give OOM restart on Colab Pro High Ram VM after ~2 epochs.\n\ntl;dr : It would really help if someone could tell me how to clear Colab CPU RAM Cache😅\n\nUPD: [Solution](https://www.kaggle.com/c/sartorius-cell-instance-segmentation/discussion/293894) - just don't do inference every epoch :)\nUPD2: I couldn't get the postvalidation script to work for models other than ones trained on 3 classes and succumbed to subscribing to colab pro+ after a tedious 30k iters which easily did the rest of my work in a matter of hours using ~1/2 - 1/3 the time pro would have taken. I used the normal save best model and inference per epoch setting. (if you already have pro and some time has passed since your monthly deduction you should consider subscribing too since you get discounts accordingly) ",
    "1638513": "Thanks for sharing! Very helpful notebooks",
    "1613517": "I tried transfer learning, but not work. Maybe ~0.001 improved, but may due to the random influences.",
    "1610802": "Hi,Why does \"Your notebook tried to allocate more memory than is available.0\" appear when I run \"train with livecell\" notebook?",
    "1610443": "There is a livecell paper has shown the result that wide trainning gain a little MAP.However the pre-condition is that most of the live-cells are those lovely ones like cort in this challenge.",
    "1606708": "Is it possible combine livecell and train dataset to one   dataset?  instead of two training stage?",
    "1615360": "",
    "1614342": ""
  }
}