{
  "id": 249085,
  "title": "[completed] Easier yolov5 train/inference interface",
  "url": "/competitions/siim-covid19-detection/discussion/249085",
  "author_name": "",
  "post_date": "2021-06-26T14:00:18.165118500Z",
  "votes": 57,
  "comment_count": 24,
  "views": 0,
  "content": "<p>I rewrite the yolov5 train/inference interface for easier customization. You can then easily add a new task, change loss, do novel data augmentation, etc</p>\n<p>If you have been using my starter kit in past competitions (e.g. image classification, sequence generation, etc), you should find this familiar and easy to use. This detection starter kit follows the same software structure.</p>\n<p>code and intermediate model:<br>\n<a href=\"https://drive.google.com/drive/folders/1oXfTayH6eRG36DAKmvwVyFE5cmPR6K6W?usp=sharing\" target=\"_blank\">https://drive.google.com/drive/folders/1oXfTayH6eRG36DAKmvwVyFE5cmPR6K6W?usp=sharing</a><br>\n(see folder 2021-06-25-yolo, 2021-06-25-yolo-readme.pptx)</p>\n<p><img src=\"https://i.ibb.co/z7h15kz/Selection-388.png\" alt=\"https://i.ibb.co/z7h15kz/Selection-388.png\"></p>",
  "messages": [
    {
      "id": "1366157",
      "postDate": "06/26/2021 14:00:18",
      "content": "<p>I rewrite the yolov5 train/inference interface for easier customization. You can then easily add a new task, change loss, do novel data augmentation, etc</p>\n<p>If you have been using my starter kit in past competitions (e.g. image classification, sequence generation, etc), you should find this familiar and easy to use. This detection starter kit follows the same software structure.</p>\n<p>code and intermediate model:<br>\n<a href=\"https://drive.google.com/drive/folders/1oXfTayH6eRG36DAKmvwVyFE5cmPR6K6W?usp=sharing\" target=\"_blank\">https://drive.google.com/drive/folders/1oXfTayH6eRG36DAKmvwVyFE5cmPR6K6W?usp=sharing</a><br>\n(see folder 2021-06-25-yolo, 2021-06-25-yolo-readme.pptx)</p>\n<p><img src=\"https://i.ibb.co/z7h15kz/Selection-388.png\" alt=\"https://i.ibb.co/z7h15kz/Selection-388.png\"></p>",
      "rawMarkdown": "I rewrite the yolov5 train/inference interface for easier customization. You can then easily add a new task, change loss, do novel data augmentation, etc\n\nIf you have been using my starter kit in past competitions (e.g. image classification, sequence generation, etc), you should find this familiar and easy to use. This detection starter kit follows the same software structure.\n\ncode and intermediate model:\nhttps://drive.google.com/drive/folders/1oXfTayH6eRG36DAKmvwVyFE5cmPR6K6W?usp=sharing\n(see folder 2021-06-25-yolo, 2021-06-25-yolo-readme.pptx)\n\n![https://i.ibb.co/z7h15kz/Selection-388.png](https://i.ibb.co/z7h15kz/Selection-388.png)",
      "votes": null
    },
    {
      "id": "1366159",
      "postDate": "06/26/2021 14:01:10",
      "content": "<p><img src=\"https://i.ibb.co/TwRfMh9/Selection-387.png\" alt=\"https://i.ibb.co/TwRfMh9/Selection-387.png\"><br>\n<img src=\"https://i.ibb.co/BnB8d54/Selection-386.png\" alt=\"https://i.ibb.co/BnB8d54/Selection-386.png\"><br>\n<img src=\"https://i.ibb.co/Nsx5jK1/Selection-385.png\" alt=\"https://i.ibb.co/Nsx5jK1/Selection-385.png\"></p>",
      "rawMarkdown": "![https://i.ibb.co/TwRfMh9/Selection-387.png](https://i.ibb.co/TwRfMh9/Selection-387.png)\n![https://i.ibb.co/BnB8d54/Selection-386.png](https://i.ibb.co/BnB8d54/Selection-386.png)\n![https://i.ibb.co/Nsx5jK1/Selection-385.png](https://i.ibb.co/Nsx5jK1/Selection-385.png)",
      "votes": null
    },
    {
      "id": "1366161",
      "postDate": "06/26/2021 14:03:05",
      "content": "<p><img src=\"https://i.ibb.co/ygNmZ51/Selection-384.png\" alt=\"https://i.ibb.co/ygNmZ51/Selection-384.png\"></p>",
      "rawMarkdown": "![https://i.ibb.co/ygNmZ51/Selection-384.png](https://i.ibb.co/ygNmZ51/Selection-384.png)",
      "votes": null
    },
    {
      "id": "1366166",
      "postDate": "06/26/2021 14:08:22",
      "content": "<p>won't we lose <strong>coco</strong> weights if we use <code>our own backbones</code>?</p>",
      "rawMarkdown": "won't we lose **coco** weights if we use `our own backbones`?",
      "votes": null
    },
    {
      "id": "1366167",
      "postDate": "06/26/2021 14:11:03",
      "content": "<p>we just need imagenet backbone</p>",
      "rawMarkdown": "we just need imagenet backbone",
      "votes": null
    },
    {
      "id": "1366172",
      "postDate": "06/26/2021 14:15:31",
      "content": "<p>I think weights like <code>yolov5x.pt</code> are trained on the <strong>COCO</strong> dataset including its backbone. Now if we remove it and add a new backbone I think we'll lose its weight from the <strong>COCO</strong> dataset. It would be interesting to see if <strong>ImageNet</strong> weight is as good as <strong>COCO</strong> weight.</p>",
      "rawMarkdown": "I think weights like `yolov5x.pt` are trained on the **COCO** dataset including its backbone. Now if we remove it and add a new backbone I think we'll lose its weight from the **COCO** dataset. It would be interesting to see if **ImageNet** weight is as good as **COCO** weight.",
      "votes": null
    },
    {
      "id": "1367397",
      "postDate": "06/27/2021 17:10:57",
      "content": "<p><img src=\"https://i.ibb.co/bWmg980/Selection-432.png\" alt=\"https://i.ibb.co/bWmg980/Selection-432.png\"></p>\n<p>i added a classification head. here are the steps that one can take:</p>\n<ol>\n<li>trained only the object detection part</li>\n<li>trained only the image classification part.</li>\n<li>step 1 and 2 set up the baseline scores</li>\n<li>now train as multi-task. if the results for multi-task is worse than single task baseline (1,2), the possible reasons are:</li>\n</ol>\n<ul>\n<li>loss are not balanced well (you can google for auto-balance papers or just try some weights by hand adjustment)</li>\n<li>network is not complex enough, try larger network for backbone</li>\n<li>try to adjust where you want to share or unshare features, i.e. which layer of the backbone you want to branch out the image classification head</li>\n<li>increase the complexity of the head</li>\n<li>design better pooling head (for classification head)</li>\n</ul>\n<p>the last three points are just about late or early fusions.</p>\n<p>if things doesn't work, then just use separate network for different task.</p>\n<p>typical results of joint classification and detection task (classification weight is less than as objectness weight):</p>\n<pre><code>local CV:\nmap(opacity) : 0.512360\nmap*0.16     : 0.085393\nmap(none)    : 0.785205\nmap*0.16     : 0.130868\n</code></pre>",
      "rawMarkdown": "![https://i.ibb.co/bWmg980/Selection-432.png](https://i.ibb.co/bWmg980/Selection-432.png)\n\ni added a classification head. here are the steps that one can take:\n1. trained only the object detection part\n2. trained only the image classification part.\n3. step 1 and 2 set up the baseline scores\n4. now train as multi-task. if the results for multi-task is worse than single task baseline (1,2), the possible reasons are:\n- loss are not balanced well (you can google for auto-balance papers or just try some weights by hand adjustment)\n- network is not complex enough, try larger network for backbone\n- try to adjust where you want to share or unshare features, i.e. which layer of the backbone you want to branch out the image classification head\n- increase the complexity of the head\n- design better pooling head (for classification head)\n\nthe last three points are just about late or early fusions.\n\nif things doesn't work, then just use separate network for different task.\n\ntypical results of joint classification and detection task (classification weight is less than as objectness weight):\n\n```\nlocal CV:\nmap(opacity) : 0.512360\nmap*0.16     : 0.085393\nmap(none)    : 0.785205\nmap*0.16     : 0.130868\n\n```",
      "votes": null
    },
    {
      "id": "1367437",
      "postDate": "06/27/2021 17:57:50",
      "content": "<p>i am thinking of trying this external data <a href=\"https://www.kaggle.com/c/rsna-pneumonia-detection-challenge\" target=\"_blank\">https://www.kaggle.com/c/rsna-pneumonia-detection-challenge</a><br>\nit has lung opacity box label.</p>\n<p>first thing i need to do is to find out is how much domain shift.hence</p>\n<ol>\n<li>with the current trained covid19 detector, do an evaluation on pneumonia data. </li>\n<li>download some opensource trained pneumonia and do an evaluation on covid19 data. </li>\n<li>if there is good results for step 1,2, then i can add pneumonia to covid19 data and do final experiment  to verify addition data indeed is helpful here</li>\n<li>if unfortunately, results are bad for step 1,2, i can still do experiment as in 3. But maybe i need to do something more … like relabel/modify pneumonia … (pseudo label the box only(?), i expect image level to be unchanged)</li>\n</ol>",
      "rawMarkdown": "i am thinking of trying this external data https://www.kaggle.com/c/rsna-pneumonia-detection-challenge\nit has lung opacity box label.\n\nfirst thing i need to do is to find out is how much domain shift.hence\n1. with the current trained covid19 detector, do an evaluation on pneumonia data. \n2. download some opensource trained pneumonia and do an evaluation on covid19 data. \n3. if there is good results for step 1,2, then i can add pneumonia to covid19 data and do final experiment  to verify addition data indeed is helpful here\n4. if unfortunately, results are bad for step 1,2, i can still do experiment as in 3. But maybe i need to do something more ... like relabel/modify pneumonia ... (pseudo label the box only(?), i expect image level to be unchanged)",
      "votes": null
    },
    {
      "id": "1367933",
      "postDate": "06/28/2021 07:19:16",
      "content": "<p>maybe not a big deal,covid19 is not a small target</p>",
      "rawMarkdown": "maybe not a big deal,covid19 is not a small target",
      "votes": null
    },
    {
      "id": "1368132",
      "postDate": "06/28/2021 10:46:36",
      "content": "<p>thanks good advice.I didn't know that challenge. </p>",
      "rawMarkdown": "thanks good advice.I didn't know that challenge.",
      "votes": null
    },
    {
      "id": "1370015",
      "postDate": "06/29/2021 20:33:05",
      "content": "<p>hI <a href=\"https://www.kaggle.com/hengck23\" target=\"_blank\">@hengck23</a>  me and my team are working on SIIM-COV detection competition. And I saw your implementation, we tried to implemented it to our own project but in run_train py your code reads a csv called \"df_fold_rand830.csv\" Are you using another dataset or ? </p>",
      "rawMarkdown": "hI @hengck23  me and my team are working on SIIM-COV detection competition. And I saw your implementation, we tried to implemented it to our own project but in run_train py your code reads a csv called \"df_fold_rand830.csv\" Are you using another dataset or ?",
      "votes": null
    },
    {
      "id": "1370192",
      "postDate": "06/30/2021 02:03:11",
      "content": "<p>this is  train-validation split. you can create one yourself.</p>\n<p>THe file is found in the data folder<br>\nthe csv format is:</p>\n<pre><code>study_id,fold\n00086460a852,1\n000c9c05fd14,2\n00292f8c37bd,0\n005057b3f880,1\n0051d9b12e72,3\n00792b5c8852,3\n00908ffd2d08,4\n009bc005edaa,3\n00a76543ed93,2\n00a87235ca36,2\n</code></pre>",
      "rawMarkdown": "this is  train-validation split. you can create one yourself.\n\nTHe file is found in the data folder\nthe csv format is:\n\n```\n\nstudy_id,fold\n00086460a852,1\n000c9c05fd14,2\n00292f8c37bd,0\n005057b3f880,1\n0051d9b12e72,3\n00792b5c8852,3\n00908ffd2d08,4\n009bc005edaa,3\n00a76543ed93,2\n00a87235ca36,2\n```",
      "votes": null
    },
    {
      "id": "1374516",
      "postDate": "07/03/2021 11:39:36",
      "content": "<p>Thank you for response <a href=\"https://www.kaggle.com/hengck23\" target=\"_blank\">@hengck23</a> . I changed the paths to train on Kaggle Kernels. But the dataset you used to train the yolo part, is it open source dataset? Because it's format is PNG.</p>",
      "rawMarkdown": "Thank you for response @hengck23 . I changed the paths to train on Kaggle Kernels. But the dataset you used to train the yolo part, is it open source dataset? Because it's format is PNG.",
      "votes": null
    },
    {
      "id": "1374572",
      "postDate": "07/03/2021 12:21:09",
      "content": "<p>you can use jpg that can be found in the forum or code section by other kagglers</p>",
      "rawMarkdown": "you can use jpg that can be found in the forum or code section by other kagglers",
      "votes": null
    },
    {
      "id": "1374601",
      "postDate": "07/03/2021 12:50:49",
      "content": "<p>okay but is there a way to not use masked images? Because I couldn't find any masked image dataset.</p>",
      "rawMarkdown": "okay but is there a way to not use masked images? Because I couldn't find any masked image dataset.",
      "votes": null
    },
    {
      "id": "1374605",
      "postDate": "07/03/2021 12:55:32",
      "content": "<p>yolo5 don't use the mask. you can remove the code  on that</p>",
      "rawMarkdown": "yolo5 don't use the mask. you can remove the code  on that",
      "votes": null
    },
    {
      "id": "1374615",
      "postDate": "07/03/2021 13:00:28",
      "content": "<p>Oh it was throwing exception.  Will remove it 👍</p>",
      "rawMarkdown": "Oh it was throwing exception.  Will remove it 👍",
      "votes": null
    },
    {
      "id": "1375927",
      "postDate": "07/04/2021 15:01:06",
      "content": "<p><a href=\"https://www.kaggle.com/hengck23\" target=\"_blank\">@hengck23</a>  So I cleaned the code. Training on jpg files with 512x512 size using kaggle provided GPU.<br>\nBut it throwes error:<br>\n.<br>\n.<br>\n.<br>\n/opt/conda/conda-bld/pytorch_1603729047590/work/aten/src/ATen/native/cuda/IndexKernel.cu:84: operator(): block: [0,0,0], thread: [31,0,0] Assertion <code>index &gt;= -sizes[i] &amp;&amp; index &lt; sizes[i] &amp;&amp; \"index out of bounds\"</code> failed.<br>\nTraceback (most recent call last):<br>\n  File \"run_train_lookahead4.py\", line 565, in <br>\n    run_train()<br>\n  File \"run_train_lookahead4.py\", line 295, in run_train<br>\n    loss_cls, loss_box, loss_obj = modified_yolo_loss(predict, truth)<br>\n  File \"/kaggle/working/yolo-imp/model.py\", line 273, in modified_yolo_loss<br>\n    pxy = (p[:, [0,1]].sigmoid() * 2) - 0.5<br>\nRuntimeError: CUDA error: device-side assert triggered</p>",
      "rawMarkdown": "hengck23  So I cleaned the code. Training on jpg files with 512x512 size using kaggle provided GPU.\nBut it throwes error:\n.\n.\n.\n/opt/conda/conda-bld/pytorch_1603729047590/work/aten/src/ATen/native/cuda/IndexKernel.cu:84: operator(): block: [0,0,0], thread: [31,0,0] Assertion `index >= -sizes[i] && index < sizes[i] && \"index out of bounds\"` failed.\nTraceback (most recent call last):\n  File \"run_train_lookahead4.py\", line 565, in <module>\n    run_train()\n  File \"run_train_lookahead4.py\", line 295, in run_train\n    loss_cls, loss_box, loss_obj = modified_yolo_loss(predict, truth)\n  File \"/kaggle/working/yolo-imp/model.py\", line 273, in modified_yolo_loss\n    pxy = (p[:, [0,1]].sigmoid() * 2) - 0.5\nRuntimeError: CUDA error: device-side assert triggered",
      "votes": null
    },
    {
      "id": "1377231",
      "postDate": "07/05/2021 17:11:43",
      "content": "<p>Thank you for sharing.<br>\nCould you explain the meaning for below code?</p>\n<p><code>x = 2*image-1</code></p>",
      "rawMarkdown": "Thank you for sharing.\nCould you explain the meaning for below code?\n\n`x = 2*image-1`",
      "votes": null
    },
    {
      "id": "1377330",
      "postDate": "07/05/2021 18:45:55",
      "content": "<p><a href=\"https://www.kaggle.com/hengck23\" target=\"_blank\">@hengck23</a> <a href=\"https://www.kaggle.com/kfk42kfk\" target=\"_blank\">@kfk42kfk</a> I am facing the same issue. Any update on this? </p>",
      "rawMarkdown": "hengck23 @kfk42kfk I am facing the same issue. Any update on this?",
      "votes": null
    },
    {
      "id": "1377333",
      "postDate": "07/05/2021 18:49:13",
      "content": "<p>No currently not. It would be good if code owner cleanup the errors and put it on githubç</p>",
      "rawMarkdown": "No currently not. It would be good if code owner cleanup the errors and put it on githubç",
      "votes": null
    },
    {
      "id": "1378806",
      "postDate": "07/06/2021 20:33:01",
      "content": "<p>how to use mmdetection framework: cvpr 2021 tutorial<br>\n<a href=\"https://www.youtube.com/watch?v=oV9cw8fKQAs\" target=\"_blank\">https://www.youtube.com/watch?v=oV9cw8fKQAs</a></p>",
      "rawMarkdown": "how to use mmdetection framework: cvpr 2021 tutorial\nhttps://www.youtube.com/watch?v=oV9cw8fKQAs",
      "votes": null
    },
    {
      "id": "1378807",
      "postDate": "07/06/2021 20:33:19",
      "content": "<p>normalise image to -1,1 range</p>",
      "rawMarkdown": "normalise image to -1,1 range",
      "votes": null
    },
    {
      "id": "1385744",
      "postDate": "07/13/2021 02:25:06",
      "content": "<p>because the image size in the code is 640, so you need to modify feature_size in  configure.py。</p>",
      "rawMarkdown": "because the image size in the code is 640, so you need to modify feature_size in  configure.py。",
      "votes": null
    },
    {
      "id": "1389545",
      "postDate": "07/15/2021 20:02:25",
      "content": "<p>Hey, I'm not sure if this is a stupid question or not but could you upload a sample notebook or explain how you would use the uploaded code in a kaggle notebook? I'm pretty new to kaggle notebooks and competitions so I'm not sure how you would turn this into a way to submit.</p>",
      "rawMarkdown": "Hey, I'm not sure if this is a stupid question or not but could you upload a sample notebook or explain how you would use the uploaded code in a kaggle notebook? I'm pretty new to kaggle notebooks and competitions so I'm not sure how you would turn this into a way to submit.",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 1366159,
      "author_name": "hengck23",
      "author_url": "",
      "post_date": "06/26/2021 14:01:10",
      "content": "<p><img src=\"https://i.ibb.co/TwRfMh9/Selection-387.png\" alt=\"https://i.ibb.co/TwRfMh9/Selection-387.png\"><br>\n<img src=\"https://i.ibb.co/BnB8d54/Selection-386.png\" alt=\"https://i.ibb.co/BnB8d54/Selection-386.png\"><br>\n<img src=\"https://i.ibb.co/Nsx5jK1/Selection-385.png\" alt=\"https://i.ibb.co/Nsx5jK1/Selection-385.png\"></p>",
      "votes": null,
      "replies": [
        {
          "id": 1366161,
          "author_name": "hengck23",
          "author_url": "",
          "post_date": "06/26/2021 14:03:05",
          "content": "<p><img src=\"https://i.ibb.co/ygNmZ51/Selection-384.png\" alt=\"https://i.ibb.co/ygNmZ51/Selection-384.png\"></p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 1366166,
      "author_name": "awsaf49",
      "author_url": "",
      "post_date": "06/26/2021 14:08:22",
      "content": "<p>won't we lose <strong>coco</strong> weights if we use <code>our own backbones</code>?</p>",
      "votes": null,
      "replies": [
        {
          "id": 1366167,
          "author_name": "hengck23",
          "author_url": "",
          "post_date": "06/26/2021 14:11:03",
          "content": "<p>we just need imagenet backbone</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1366172,
          "author_name": "awsaf49",
          "author_url": "",
          "post_date": "06/26/2021 14:15:31",
          "content": "<p>I think weights like <code>yolov5x.pt</code> are trained on the <strong>COCO</strong> dataset including its backbone. Now if we remove it and add a new backbone I think we'll lose its weight from the <strong>COCO</strong> dataset. It would be interesting to see if <strong>ImageNet</strong> weight is as good as <strong>COCO</strong> weight.</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1367933,
          "author_name": "jsrdcht",
          "author_url": "",
          "post_date": "06/28/2021 07:19:16",
          "content": "<p>maybe not a big deal,covid19 is not a small target</p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 1367397,
      "author_name": "hengck23",
      "author_url": "",
      "post_date": "06/27/2021 17:10:57",
      "content": "<p><img src=\"https://i.ibb.co/bWmg980/Selection-432.png\" alt=\"https://i.ibb.co/bWmg980/Selection-432.png\"></p>\n<p>i added a classification head. here are the steps that one can take:</p>\n<ol>\n<li>trained only the object detection part</li>\n<li>trained only the image classification part.</li>\n<li>step 1 and 2 set up the baseline scores</li>\n<li>now train as multi-task. if the results for multi-task is worse than single task baseline (1,2), the possible reasons are:</li>\n</ol>\n<ul>\n<li>loss are not balanced well (you can google for auto-balance papers or just try some weights by hand adjustment)</li>\n<li>network is not complex enough, try larger network for backbone</li>\n<li>try to adjust where you want to share or unshare features, i.e. which layer of the backbone you want to branch out the image classification head</li>\n<li>increase the complexity of the head</li>\n<li>design better pooling head (for classification head)</li>\n</ul>\n<p>the last three points are just about late or early fusions.</p>\n<p>if things doesn't work, then just use separate network for different task.</p>\n<p>typical results of joint classification and detection task (classification weight is less than as objectness weight):</p>\n<pre><code>local CV:\nmap(opacity) : 0.512360\nmap*0.16     : 0.085393\nmap(none)    : 0.785205\nmap*0.16     : 0.130868\n</code></pre>",
      "votes": null,
      "replies": []
    },
    {
      "id": 1367437,
      "author_name": "hengck23",
      "author_url": "",
      "post_date": "06/27/2021 17:57:50",
      "content": "<p>i am thinking of trying this external data <a href=\"https://www.kaggle.com/c/rsna-pneumonia-detection-challenge\" target=\"_blank\">https://www.kaggle.com/c/rsna-pneumonia-detection-challenge</a><br>\nit has lung opacity box label.</p>\n<p>first thing i need to do is to find out is how much domain shift.hence</p>\n<ol>\n<li>with the current trained covid19 detector, do an evaluation on pneumonia data. </li>\n<li>download some opensource trained pneumonia and do an evaluation on covid19 data. </li>\n<li>if there is good results for step 1,2, then i can add pneumonia to covid19 data and do final experiment  to verify addition data indeed is helpful here</li>\n<li>if unfortunately, results are bad for step 1,2, i can still do experiment as in 3. But maybe i need to do something more … like relabel/modify pneumonia … (pseudo label the box only(?), i expect image level to be unchanged)</li>\n</ol>",
      "votes": null,
      "replies": [
        {
          "id": 1368132,
          "author_name": "tensorchoko",
          "author_url": "",
          "post_date": "06/28/2021 10:46:36",
          "content": "<p>thanks good advice.I didn't know that challenge. </p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 1370015,
      "author_name": "kfk42kfk",
      "author_url": "",
      "post_date": "06/29/2021 20:33:05",
      "content": "<p>hI <a href=\"https://www.kaggle.com/hengck23\" target=\"_blank\">@hengck23</a>  me and my team are working on SIIM-COV detection competition. And I saw your implementation, we tried to implemented it to our own project but in run_train py your code reads a csv called \"df_fold_rand830.csv\" Are you using another dataset or ? </p>",
      "votes": null,
      "replies": [
        {
          "id": 1370192,
          "author_name": "hengck23",
          "author_url": "",
          "post_date": "06/30/2021 02:03:11",
          "content": "<p>this is  train-validation split. you can create one yourself.</p>\n<p>THe file is found in the data folder<br>\nthe csv format is:</p>\n<pre><code>study_id,fold\n00086460a852,1\n000c9c05fd14,2\n00292f8c37bd,0\n005057b3f880,1\n0051d9b12e72,3\n00792b5c8852,3\n00908ffd2d08,4\n009bc005edaa,3\n00a76543ed93,2\n00a87235ca36,2\n</code></pre>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 1374516,
      "author_name": "kfk42kfk",
      "author_url": "",
      "post_date": "07/03/2021 11:39:36",
      "content": "<p>Thank you for response <a href=\"https://www.kaggle.com/hengck23\" target=\"_blank\">@hengck23</a> . I changed the paths to train on Kaggle Kernels. But the dataset you used to train the yolo part, is it open source dataset? Because it's format is PNG.</p>",
      "votes": null,
      "replies": [
        {
          "id": 1374572,
          "author_name": "hengck23",
          "author_url": "",
          "post_date": "07/03/2021 12:21:09",
          "content": "<p>you can use jpg that can be found in the forum or code section by other kagglers</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1374601,
          "author_name": "kfk42kfk",
          "author_url": "",
          "post_date": "07/03/2021 12:50:49",
          "content": "<p>okay but is there a way to not use masked images? Because I couldn't find any masked image dataset.</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1374605,
          "author_name": "hengck23",
          "author_url": "",
          "post_date": "07/03/2021 12:55:32",
          "content": "<p>yolo5 don't use the mask. you can remove the code  on that</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1374615,
          "author_name": "kfk42kfk",
          "author_url": "",
          "post_date": "07/03/2021 13:00:28",
          "content": "<p>Oh it was throwing exception.  Will remove it 👍</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1375927,
          "author_name": "kfk42kfk",
          "author_url": "",
          "post_date": "07/04/2021 15:01:06",
          "content": "<p><a href=\"https://www.kaggle.com/hengck23\" target=\"_blank\">@hengck23</a>  So I cleaned the code. Training on jpg files with 512x512 size using kaggle provided GPU.<br>\nBut it throwes error:<br>\n.<br>\n.<br>\n.<br>\n/opt/conda/conda-bld/pytorch_1603729047590/work/aten/src/ATen/native/cuda/IndexKernel.cu:84: operator(): block: [0,0,0], thread: [31,0,0] Assertion <code>index &gt;= -sizes[i] &amp;&amp; index &lt; sizes[i] &amp;&amp; \"index out of bounds\"</code> failed.<br>\nTraceback (most recent call last):<br>\n  File \"run_train_lookahead4.py\", line 565, in <br>\n    run_train()<br>\n  File \"run_train_lookahead4.py\", line 295, in run_train<br>\n    loss_cls, loss_box, loss_obj = modified_yolo_loss(predict, truth)<br>\n  File \"/kaggle/working/yolo-imp/model.py\", line 273, in modified_yolo_loss<br>\n    pxy = (p[:, [0,1]].sigmoid() * 2) - 0.5<br>\nRuntimeError: CUDA error: device-side assert triggered</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1377330,
          "author_name": "selfdriving",
          "author_url": "",
          "post_date": "07/05/2021 18:45:55",
          "content": "<p><a href=\"https://www.kaggle.com/hengck23\" target=\"_blank\">@hengck23</a> <a href=\"https://www.kaggle.com/kfk42kfk\" target=\"_blank\">@kfk42kfk</a> I am facing the same issue. Any update on this? </p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1377333,
          "author_name": "kfk42kfk",
          "author_url": "",
          "post_date": "07/05/2021 18:49:13",
          "content": "<p>No currently not. It would be good if code owner cleanup the errors and put it on githubç</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1385744,
          "author_name": "ultrazhl",
          "author_url": "",
          "post_date": "07/13/2021 02:25:06",
          "content": "<p>because the image size in the code is 640, so you need to modify feature_size in  configure.py。</p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 1377231,
      "author_name": "aljjy13",
      "author_url": "",
      "post_date": "07/05/2021 17:11:43",
      "content": "<p>Thank you for sharing.<br>\nCould you explain the meaning for below code?</p>\n<p><code>x = 2*image-1</code></p>",
      "votes": null,
      "replies": [
        {
          "id": 1378807,
          "author_name": "hengck23",
          "author_url": "",
          "post_date": "07/06/2021 20:33:19",
          "content": "<p>normalise image to -1,1 range</p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 1378806,
      "author_name": "hengck23",
      "author_url": "",
      "post_date": "07/06/2021 20:33:01",
      "content": "<p>how to use mmdetection framework: cvpr 2021 tutorial<br>\n<a href=\"https://www.youtube.com/watch?v=oV9cw8fKQAs\" target=\"_blank\">https://www.youtube.com/watch?v=oV9cw8fKQAs</a></p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 1389545,
      "author_name": "dyllanhofflich",
      "author_url": "",
      "post_date": "07/15/2021 20:02:25",
      "content": "<p>Hey, I'm not sure if this is a stupid question or not but could you upload a sample notebook or explain how you would use the uploaded code in a kaggle notebook? I'm pretty new to kaggle notebooks and competitions so I'm not sure how you would turn this into a way to submit.</p>",
      "votes": null,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "1366157": "I rewrite the yolov5 train/inference interface for easier customization. You can then easily add a new task, change loss, do novel data augmentation, etc\n\nIf you have been using my starter kit in past competitions (e.g. image classification, sequence generation, etc), you should find this familiar and easy to use. This detection starter kit follows the same software structure.\n\ncode and intermediate model:\nhttps://drive.google.com/drive/folders/1oXfTayH6eRG36DAKmvwVyFE5cmPR6K6W?usp=sharing\n(see folder 2021-06-25-yolo, 2021-06-25-yolo-readme.pptx)\n\n![https://i.ibb.co/z7h15kz/Selection-388.png](https://i.ibb.co/z7h15kz/Selection-388.png)",
    "1366159": "![https://i.ibb.co/TwRfMh9/Selection-387.png](https://i.ibb.co/TwRfMh9/Selection-387.png)\n![https://i.ibb.co/BnB8d54/Selection-386.png](https://i.ibb.co/BnB8d54/Selection-386.png)\n![https://i.ibb.co/Nsx5jK1/Selection-385.png](https://i.ibb.co/Nsx5jK1/Selection-385.png)",
    "1366161": "![https://i.ibb.co/ygNmZ51/Selection-384.png](https://i.ibb.co/ygNmZ51/Selection-384.png)",
    "1366166": "won't we lose **coco** weights if we use `our own backbones`?",
    "1366167": "we just need imagenet backbone",
    "1366172": "I think weights like `yolov5x.pt` are trained on the **COCO** dataset including its backbone. Now if we remove it and add a new backbone I think we'll lose its weight from the **COCO** dataset. It would be interesting to see if **ImageNet** weight is as good as **COCO** weight.",
    "1367397": "![https://i.ibb.co/bWmg980/Selection-432.png](https://i.ibb.co/bWmg980/Selection-432.png)\n\ni added a classification head. here are the steps that one can take:\n1. trained only the object detection part\n2. trained only the image classification part.\n3. step 1 and 2 set up the baseline scores\n4. now train as multi-task. if the results for multi-task is worse than single task baseline (1,2), the possible reasons are:\n- loss are not balanced well (you can google for auto-balance papers or just try some weights by hand adjustment)\n- network is not complex enough, try larger network for backbone\n- try to adjust where you want to share or unshare features, i.e. which layer of the backbone you want to branch out the image classification head\n- increase the complexity of the head\n- design better pooling head (for classification head)\n\nthe last three points are just about late or early fusions.\n\nif things doesn't work, then just use separate network for different task.\n\ntypical results of joint classification and detection task (classification weight is less than as objectness weight):\n\n```\nlocal CV:\nmap(opacity) : 0.512360\nmap*0.16     : 0.085393\nmap(none)    : 0.785205\nmap*0.16     : 0.130868\n\n```",
    "1367437": "i am thinking of trying this external data https://www.kaggle.com/c/rsna-pneumonia-detection-challenge\nit has lung opacity box label.\n\nfirst thing i need to do is to find out is how much domain shift.hence\n1. with the current trained covid19 detector, do an evaluation on pneumonia data. \n2. download some opensource trained pneumonia and do an evaluation on covid19 data. \n3. if there is good results for step 1,2, then i can add pneumonia to covid19 data and do final experiment  to verify addition data indeed is helpful here\n4. if unfortunately, results are bad for step 1,2, i can still do experiment as in 3. But maybe i need to do something more ... like relabel/modify pneumonia ... (pseudo label the box only(?), i expect image level to be unchanged)",
    "1367933": "maybe not a big deal,covid19 is not a small target",
    "1368132": "thanks good advice.I didn't know that challenge.",
    "1370015": "hI @hengck23  me and my team are working on SIIM-COV detection competition. And I saw your implementation, we tried to implemented it to our own project but in run_train py your code reads a csv called \"df_fold_rand830.csv\" Are you using another dataset or ?",
    "1370192": "this is  train-validation split. you can create one yourself.\n\nTHe file is found in the data folder\nthe csv format is:\n\n```\n\nstudy_id,fold\n00086460a852,1\n000c9c05fd14,2\n00292f8c37bd,0\n005057b3f880,1\n0051d9b12e72,3\n00792b5c8852,3\n00908ffd2d08,4\n009bc005edaa,3\n00a76543ed93,2\n00a87235ca36,2\n```",
    "1374516": "Thank you for response @hengck23 . I changed the paths to train on Kaggle Kernels. But the dataset you used to train the yolo part, is it open source dataset? Because it's format is PNG.",
    "1374572": "you can use jpg that can be found in the forum or code section by other kagglers",
    "1374601": "okay but is there a way to not use masked images? Because I couldn't find any masked image dataset.",
    "1374605": "yolo5 don't use the mask. you can remove the code  on that",
    "1374615": "Oh it was throwing exception.  Will remove it 👍",
    "1375927": "hengck23  So I cleaned the code. Training on jpg files with 512x512 size using kaggle provided GPU.\nBut it throwes error:\n.\n.\n.\n/opt/conda/conda-bld/pytorch_1603729047590/work/aten/src/ATen/native/cuda/IndexKernel.cu:84: operator(): block: [0,0,0], thread: [31,0,0] Assertion `index >= -sizes[i] && index < sizes[i] && \"index out of bounds\"` failed.\nTraceback (most recent call last):\n  File \"run_train_lookahead4.py\", line 565, in <module>\n    run_train()\n  File \"run_train_lookahead4.py\", line 295, in run_train\n    loss_cls, loss_box, loss_obj = modified_yolo_loss(predict, truth)\n  File \"/kaggle/working/yolo-imp/model.py\", line 273, in modified_yolo_loss\n    pxy = (p[:, [0,1]].sigmoid() * 2) - 0.5\nRuntimeError: CUDA error: device-side assert triggered",
    "1377231": "Thank you for sharing.\nCould you explain the meaning for below code?\n\n`x = 2*image-1`",
    "1377330": "hengck23 @kfk42kfk I am facing the same issue. Any update on this?",
    "1377333": "No currently not. It would be good if code owner cleanup the errors and put it on githubç",
    "1378806": "how to use mmdetection framework: cvpr 2021 tutorial\nhttps://www.youtube.com/watch?v=oV9cw8fKQAs",
    "1378807": "normalise image to -1,1 range",
    "1385744": "because the image size in the code is 640, so you need to modify feature_size in  configure.py。",
    "1389545": "Hey, I'm not sure if this is a stupid question or not but could you upload a sample notebook or explain how you would use the uploaded code in a kaggle notebook? I'm pretty new to kaggle notebooks and competitions so I'm not sure how you would turn this into a way to submit."
  },
  "source": "meta"
}