{
  "id": 173180,
  "title": "Sharing yolov5 codes",
  "url": "/competitions/global-wheat-detection/discussion/173180",
  "author_name": "arutema47",
  "post_date": "2020-08-08T07:48:30.029000",
  "votes": 4,
  "comment_count": 7,
  "views": 0,
  "content": "<p>I never had success training yolov5 and would like to dig further for future researches.<br>\nCan someone share training codes of yolov5 which can get good LB(my best was like 0.73 without PL.)<br>\nThanks in advance ;)</p>",
  "messages": [
    {
      "id": 965262,
      "postDate": "2020-08-10T13:58:11.707Z",
      "content": "<p>Ours best Single model YoloV5 submission was: 0.7621 Public (Just TTA, No PL or model ensemble)</p>\n\n<p>We didn't change much from the original Y5 github repo, just added Mixup#1 augmentation (as in shonenkov's notebook), which mixes 2 images completely and stacks boxes.\nTrained with 50% Mixup and 50% Mosaic for 50 epochs at batch size 4 on a 10 Fold split stratified by source. (the rumor of batch size 2 outperforming 4 didn't work for us)</p>\n\n<p>For submission we didn't make any changes to default TTAs unlike some famous public kernels which promised higher scores altering those. For us adding any other TTA just reduced the local CV and public score (possibly some fault in deciding thresholds from our side).\nThough we did rotate the image 4 times and ensembled the final boxes as done <a href=\"https://www.kaggle.com/nvnnghia/yolov5-pseudo-labeling\">here</a> with the default Y5 TTAs </p>\n\n<p>There was a huge scope of improvement still left but we shifted to work on our compliant models after the announcement.\nUpon PL we achieved 0.7769 Public score with it, thresholds weren't optimum in this though. Optimum threshold which gave us base model score of 0.7621 timed out in PL in the same notebook (OOF score calculations became heavy as we lowered WBF's skip_thr).\nDidn't try multi fold model ensemble on Y5.</p>",
      "rawMarkdown": "Ours best Single model YoloV5 submission was: 0.7621 Public (Just TTA, No PL or model ensemble)\n\nWe didn't change much from the original Y5 github repo, just added Mixup#1 augmentation (as in shonenkov's notebook), which mixes 2 images completely and stacks boxes.\nTrained with 50% Mixup and 50% Mosaic for 50 epochs at batch size 4 on a 10 Fold split stratified by source. (the rumor of batch size 2 outperforming 4 didn't work for us)\n\nFor submission we didn't make any changes to default TTAs unlike some famous public kernels which promised higher scores altering those. For us adding any other TTA just reduced the local CV and public score (possibly some fault in deciding thresholds from our side).\nThough we did rotate the image 4 times and ensembled the final boxes as done [here](https://www.kaggle.com/nvnnghia/yolov5-pseudo-labeling) with the default Y5 TTAs \n\nThere was a huge scope of improvement still left but we shifted to work on our compliant models after the announcement.\nUpon PL we achieved 0.7769 Public score with it, thresholds weren't optimum in this though. Optimum threshold which gave us base model score of 0.7621 timed out in PL in the same notebook (OOF score calculations became heavy as we lowered WBF's skip_thr).\nDidn't try multi fold model ensemble on Y5.",
      "votes": 3
    },
    {
      "id": 962526,
      "postDate": "2020-08-08T07:48:30.030Z",
      "content": "<p>I never had success training yolov5 and would like to dig further for future researches.<br>\nCan someone share training codes of yolov5 which can get good LB(my best was like 0.73 without PL.)<br>\nThanks in advance ;)</p>",
      "rawMarkdown": "I never had success training yolov5 and would like to dig further for future researches.\nCan someone share training codes of yolov5 which can get good LB(my best was like 0.73 without PL.)\nThanks in advance ;)",
      "votes": 4
    },
    {
      "id": 962530,
      "postDate": "2020-08-08T07:56:58.090Z",
      "content": "<p>I used public kernels as a training pipeline. I decided not to copy it one more time. </p>\n\n<p>However, I spent a lot of time working on fine-tuning and shared my results in the following post: <a href=\"https://www.kaggle.com/c/global-wheat-detection/discussion/172753\">https://www.kaggle.com/c/global-wheat-detection/discussion/172753</a>\nIt should be useful for you.</p>\n\n<p>My best scores are:\nWith my own submit-notebook (without PL):  0.7296 (Public), 0.6526 (Private);\nWith PL (<a href=\"https://www.kaggle.com/nvnnghia/yolov5-pseudo-labeling\">https://www.kaggle.com/nvnnghia/yolov5-pseudo-labeling</a>): 0.7372 (Public), 0.6747 (Private);\nWith the PL + OOF (<a href=\"https://www.kaggle.com/hawkey/yolov5-pseudo-labeling-oof-evaluation\">https://www.kaggle.com/hawkey/yolov5-pseudo-labeling-oof-evaluation</a>): 0.7680 (Public), 0.7711 (Private, even better than my selected final submit).</p>",
      "rawMarkdown": "I used public kernels as a training pipeline. I decided not to copy it one more time. \n\nHowever, I spent a lot of time working on fine-tuning and shared my results in the following post: https://www.kaggle.com/c/global-wheat-detection/discussion/172753\nIt should be useful for you.\n\nMy best scores are:\nWith my own submit-notebook (without PL):  0.7296 (Public), 0.6526 (Private);\nWith PL (https://www.kaggle.com/nvnnghia/yolov5-pseudo-labeling): 0.7372 (Public), 0.6747 (Private);\nWith the PL + OOF (https://www.kaggle.com/hawkey/yolov5-pseudo-labeling-oof-evaluation): 0.7680 (Public), 0.7711 (Private, even better than my selected final submit).",
      "votes": 1,
      "replies": [
        {
          "id": 963378,
          "postDate": "2020-08-09T01:22:17.373Z",
          "content": "<p>Thanks! Let me look at your posts.<br>\nThe original notebook says you can achieve LB 0.745 but I was able to reproduce only LB 0.74 with several seeds, which was worse than my EffDet. <br>\n<img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F3508221%2Fd4b63408225e4a6de7b431214c5e5026%2F2020-08-09%20102146.png?generation=1596936130411150&amp;alt=media\" alt=\"\">I guess I should try k-fold ensemble?</p>",
          "rawMarkdown": "Thanks! Let me look at your posts.\nThe original notebook says you can achieve LB 0.745 but I was able to reproduce only LB 0.74 with several seeds, which was worse than my EffDet. \n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F3508221%2Fd4b63408225e4a6de7b431214c5e5026%2F2020-08-09%20102146.png?generation=1596936130411150&amp;alt=media)I guess I should try k-fold ensemble?\n\n"
        },
        {
          "id": 963579,
          "postDate": "2020-08-09T06:33:55.973Z",
          "content": "<p>If we're talking about <a href=\"https://www.kaggle.com/nvnnghia/yolov5-pseudo-labeling\">this notebook</a>, I with my team achieved 0.7372 with this one. We didn't use any K-folds or ensembles, except for augmentation. We tried to do PL during our training but something went wrong and we did PL only already during submit with this notebook. </p>\n\n<p>By that time we got the info that the Yolov5 will be apparently banned and we've gave up improving Yolo and started working on EffDet. If the Yolov'5 hadn't been removed we would spend the rest of our time on the K-fold training of the Yolov5 cause this method usually boosts your score.</p>\n\n<p>If we're talking about <a href=\"https://www.kaggle.com/hawkey/yolov5-pseudo-labeling-oof-evaluation\">this notebook</a>, we used the same parameters using this one. It's just a really strong notebook (and maybe a little bit overfitted).</p>\n\n<p>P.S. Can you open my links from my previous comment? It seems that I've stated them right but I noticed it by accident that I can't open them. Can you?</p>\n\n<p>P.S.2. We usually trained Yolov5 for 100 epochs. However, the weights usually didn't become better since 50-70 epochs so you can consider that we trained the Yolov5 only for this number of epochs.</p>",
          "rawMarkdown": "If we're talking about [this notebook](https://www.kaggle.com/nvnnghia/yolov5-pseudo-labeling), I with my team achieved 0.7372 with this one. We didn't use any K-folds or ensembles, except for augmentation. We tried to do PL during our training but something went wrong and we did PL only already during submit with this notebook. \n\nBy that time we got the info that the Yolov5 will be apparently banned and we've gave up improving Yolo and started working on EffDet. If the Yolov'5 hadn't been removed we would spend the rest of our time on the K-fold training of the Yolov5 cause this method usually boosts your score.\n\nIf we're talking about [this notebook](https://www.kaggle.com/hawkey/yolov5-pseudo-labeling-oof-evaluation), we used the same parameters using this one. It's just a really strong notebook (and maybe a little bit overfitted).\n\nP.S. Can you open my links from my previous comment? It seems that I've stated them right but I noticed it by accident that I can't open them. Can you?\n\nP.S.2. We usually trained Yolov5 for 100 epochs. However, the weights usually didn't become better since 50-70 epochs so you can consider that we trained the Yolov5 only for this number of epochs."
        },
        {
          "id": 981062,
          "postDate": "2020-08-22T06:26:25.550Z",
          "content": "<p>How long did you train 100 epochs?Is that different from 50 epoch twice?</p>",
          "rawMarkdown": "How long did you train 100 epochs?Is that different from 50 epoch twice?"
        }
      ]
    },
    {
      "id": 966185,
      "postDate": "2020-08-11T08:12:44.960Z",
      "content": "<p>I got 0.7622 using Yolov5 + TTA + PL + Ensemble (2 models): <a href=\"https://www.kaggle.com/kaushal2896/yolov5x-pseudo-labeling-tta-ensemble\" target=\"_blank\">https://www.kaggle.com/kaushal2896/yolov5x-pseudo-labeling-tta-ensemble</a></p>",
      "rawMarkdown": "I got 0.7622 using Yolov5 + TTA + PL + Ensemble (2 models): https://www.kaggle.com/kaushal2896/yolov5x-pseudo-labeling-tta-ensemble"
    },
    {
      "id": 962699,
      "postDate": "2020-08-08T11:06:32.927Z",
      "rawMarkdown": "",
      "isDeleted": true
    }
  ],
  "comments": [
    {
      "id": 965262,
      "author_name": "Sumukh",
      "author_url": "",
      "post_date": "2020-08-10T13:58:11.707000",
      "content": "<p>Ours best Single model YoloV5 submission was: 0.7621 Public (Just TTA, No PL or model ensemble)</p>\n\n<p>We didn't change much from the original Y5 github repo, just added Mixup#1 augmentation (as in shonenkov's notebook), which mixes 2 images completely and stacks boxes.\nTrained with 50% Mixup and 50% Mosaic for 50 epochs at batch size 4 on a 10 Fold split stratified by source. (the rumor of batch size 2 outperforming 4 didn't work for us)</p>\n\n<p>For submission we didn't make any changes to default TTAs unlike some famous public kernels which promised higher scores altering those. For us adding any other TTA just reduced the local CV and public score (possibly some fault in deciding thresholds from our side).\nThough we did rotate the image 4 times and ensembled the final boxes as done <a href=\"https://www.kaggle.com/nvnnghia/yolov5-pseudo-labeling\">here</a> with the default Y5 TTAs </p>\n\n<p>There was a huge scope of improvement still left but we shifted to work on our compliant models after the announcement.\nUpon PL we achieved 0.7769 Public score with it, thresholds weren't optimum in this though. Optimum threshold which gave us base model score of 0.7621 timed out in PL in the same notebook (OOF score calculations became heavy as we lowered WBF's skip_thr).\nDidn't try multi fold model ensemble on Y5.</p>",
      "votes": 3,
      "replies": []
    },
    {
      "id": 962530,
      "author_name": "Vadim Timakin",
      "author_url": "",
      "post_date": "2020-08-08T07:56:58.090000",
      "content": "<p>I used public kernels as a training pipeline. I decided not to copy it one more time. </p>\n\n<p>However, I spent a lot of time working on fine-tuning and shared my results in the following post: <a href=\"https://www.kaggle.com/c/global-wheat-detection/discussion/172753\">https://www.kaggle.com/c/global-wheat-detection/discussion/172753</a>\nIt should be useful for you.</p>\n\n<p>My best scores are:\nWith my own submit-notebook (without PL):  0.7296 (Public), 0.6526 (Private);\nWith PL (<a href=\"https://www.kaggle.com/nvnnghia/yolov5-pseudo-labeling\">https://www.kaggle.com/nvnnghia/yolov5-pseudo-labeling</a>): 0.7372 (Public), 0.6747 (Private);\nWith the PL + OOF (<a href=\"https://www.kaggle.com/hawkey/yolov5-pseudo-labeling-oof-evaluation\">https://www.kaggle.com/hawkey/yolov5-pseudo-labeling-oof-evaluation</a>): 0.7680 (Public), 0.7711 (Private, even better than my selected final submit).</p>",
      "votes": 1,
      "replies": [
        {
          "id": 963378,
          "author_name": "arutema47",
          "author_url": "",
          "post_date": "2020-08-09T01:22:17.373000",
          "content": "<p>Thanks! Let me look at your posts.<br>\nThe original notebook says you can achieve LB 0.745 but I was able to reproduce only LB 0.74 with several seeds, which was worse than my EffDet. <br>\n<img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F3508221%2Fd4b63408225e4a6de7b431214c5e5026%2F2020-08-09%20102146.png?generation=1596936130411150&amp;alt=media\" alt=\"\">I guess I should try k-fold ensemble?</p>",
          "votes": 0,
          "replies": []
        },
        {
          "id": 963579,
          "author_name": "Vadim Timakin",
          "author_url": "",
          "post_date": "2020-08-09T06:33:55.973000",
          "content": "<p>If we're talking about <a href=\"https://www.kaggle.com/nvnnghia/yolov5-pseudo-labeling\">this notebook</a>, I with my team achieved 0.7372 with this one. We didn't use any K-folds or ensembles, except for augmentation. We tried to do PL during our training but something went wrong and we did PL only already during submit with this notebook. </p>\n\n<p>By that time we got the info that the Yolov5 will be apparently banned and we've gave up improving Yolo and started working on EffDet. If the Yolov'5 hadn't been removed we would spend the rest of our time on the K-fold training of the Yolov5 cause this method usually boosts your score.</p>\n\n<p>If we're talking about <a href=\"https://www.kaggle.com/hawkey/yolov5-pseudo-labeling-oof-evaluation\">this notebook</a>, we used the same parameters using this one. It's just a really strong notebook (and maybe a little bit overfitted).</p>\n\n<p>P.S. Can you open my links from my previous comment? It seems that I've stated them right but I noticed it by accident that I can't open them. Can you?</p>\n\n<p>P.S.2. We usually trained Yolov5 for 100 epochs. However, the weights usually didn't become better since 50-70 epochs so you can consider that we trained the Yolov5 only for this number of epochs.</p>",
          "votes": 0,
          "replies": []
        },
        {
          "id": 981062,
          "author_name": "Zekun",
          "author_url": "",
          "post_date": "2020-08-22T06:26:25.550000",
          "content": "<p>How long did you train 100 epochs?Is that different from 50 epoch twice?</p>",
          "votes": 0,
          "replies": []
        }
      ]
    },
    {
      "id": 966185,
      "author_name": "Kaushal Shah",
      "author_url": "",
      "post_date": "2020-08-11T08:12:44.960000",
      "content": "<p>I got 0.7622 using Yolov5 + TTA + PL + Ensemble (2 models): <a href=\"https://www.kaggle.com/kaushal2896/yolov5x-pseudo-labeling-tta-ensemble\" target=\"_blank\">https://www.kaggle.com/kaushal2896/yolov5x-pseudo-labeling-tta-ensemble</a></p>",
      "votes": 0,
      "replies": []
    },
    {
      "id": 962699,
      "author_name": "",
      "author_url": "",
      "post_date": "2020-08-08T11:06:32.927000",
      "content": "",
      "votes": 0,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "965262": "Ours best Single model YoloV5 submission was: 0.7621 Public (Just TTA, No PL or model ensemble)\n\nWe didn't change much from the original Y5 github repo, just added Mixup#1 augmentation (as in shonenkov's notebook), which mixes 2 images completely and stacks boxes.\nTrained with 50% Mixup and 50% Mosaic for 50 epochs at batch size 4 on a 10 Fold split stratified by source. (the rumor of batch size 2 outperforming 4 didn't work for us)\n\nFor submission we didn't make any changes to default TTAs unlike some famous public kernels which promised higher scores altering those. For us adding any other TTA just reduced the local CV and public score (possibly some fault in deciding thresholds from our side).\nThough we did rotate the image 4 times and ensembled the final boxes as done [here](https://www.kaggle.com/nvnnghia/yolov5-pseudo-labeling) with the default Y5 TTAs \n\nThere was a huge scope of improvement still left but we shifted to work on our compliant models after the announcement.\nUpon PL we achieved 0.7769 Public score with it, thresholds weren't optimum in this though. Optimum threshold which gave us base model score of 0.7621 timed out in PL in the same notebook (OOF score calculations became heavy as we lowered WBF's skip_thr).\nDidn't try multi fold model ensemble on Y5.",
    "962526": "I never had success training yolov5 and would like to dig further for future researches.\nCan someone share training codes of yolov5 which can get good LB(my best was like 0.73 without PL.)\nThanks in advance ;)",
    "962530": "I used public kernels as a training pipeline. I decided not to copy it one more time. \n\nHowever, I spent a lot of time working on fine-tuning and shared my results in the following post: https://www.kaggle.com/c/global-wheat-detection/discussion/172753\nIt should be useful for you.\n\nMy best scores are:\nWith my own submit-notebook (without PL):  0.7296 (Public), 0.6526 (Private);\nWith PL (https://www.kaggle.com/nvnnghia/yolov5-pseudo-labeling): 0.7372 (Public), 0.6747 (Private);\nWith the PL + OOF (https://www.kaggle.com/hawkey/yolov5-pseudo-labeling-oof-evaluation): 0.7680 (Public), 0.7711 (Private, even better than my selected final submit).",
    "966185": "I got 0.7622 using Yolov5 + TTA + PL + Ensemble (2 models): https://www.kaggle.com/kaushal2896/yolov5x-pseudo-labeling-tta-ensemble",
    "962699": ""
  }
}