{
  "id": 172523,
  "title": "[129th place Solution] Rare method used with Yolov4",
  "url": "/competitions/global-wheat-detection/discussion/172523",
  "author_name": "",
  "post_date": "2020-08-05T11:27:01.860001700Z",
  "votes": 10,
  "comment_count": 6,
  "views": 0,
  "content": "<p>This is the first time that I participate in this contest, and thank you for all the notes you guys shared. Since there's not a lot of contestants using yolov4, I'd like to share the method I used with yolov4, and hope other yolov4 user could join the discussion and share your opinions.</p>\n<h3>[1]Ground truth</h3>\n<p>At first, by slightly adjusting the incorrect and missing parts in Ground Truth, I've found a problem that the score from yolov4 couldn’t reach the score from yolov5 at the same ground truth. So I use the predicted results of the high score from yolov5 and the original score from yolov4 to analyze the distributing differences of both, and use yolov5 as standard to improve the Ground Truth to make their distributions relevant.</p>\n<h3>[2]Baseline</h3>\n<p>Improve the distribution and experiment the yolo4-training one by one.<br>\nTrain the fundamental parameters of yolov4:</p>\n<ol>\n<li>SGD 0.01 </li>\n<li>Epoch 80 </li>\n<li>Image size 1024</li>\n<li>Batchsize 2</li>\n<li>Mosaic</li>\n<li>Hue</li>\n<li>Randomly crop the wheat bbox and randomly paste them into an image(more successful when using better Ground Truth)</li>\n<li>Ciou loss</li>\n<li>TTA 0°、90°、180° 、270°</li>\n</ol>\n<h4>At last, yolov4 basemodel got the results of <strong>Public</strong> 0.7380 / <strong>Private</strong> 0.6589.</h4>\n<p>On the other hand, the result produced by EfficientDet with train.csv is the best.<br>\nTrain the fundamental parameters of EfficientDet D7:<br>\nadd Mixed Precision Training<br>\nadd Gradient Accumulation with 64</p>\n<ol>\n<li>AdamW 0.0002</li>\n<li>Epoch 100</li>\n<li>Image size 1024</li>\n<li>Batchsize 2</li>\n<li>Mosaic</li>\n<li>Randomly crop the wheat bbox and randomly paste them into an image(more successful when using better Ground Truth)</li>\n<li>TTA lr、ud</li>\n</ol>\n<h4>At last, EfficientDet D7 basemodel got the results of <strong>Public</strong> 0.7438 / <strong>Private</strong> 0.6679.</h4>\n<h3>[3]Ensemble</h3>\n<p>Yolov4 + EfficientDet D7 (not pseudo labeling) </p>\n<h4><strong>Public</strong> 0.7589 / <strong>Private</strong> 0.6805</h4>\n<p>Finding that Private Data might come with different image sizes, so I adjusted the submission.csv of the images of different image sizes.<br>\nAfter adjustion: Yolov4 + EfficientDet D7 (not pseudo labeling) </p>\n<h4><strong>Public</strong> 0.7589 / <strong>Private</strong> 0.6918</h4>\n<h3>[4]Psuedo Labeling</h3>\n<p>In the last step, I used ensemble Yolov4 + EfficientDet D7 as pseudo labeling to train yolov4.<br>\nUse pseudo labeling to train the fundamental parameters of yolov4:</p>\n<ol>\n<li>Radam 0.0004</li>\n<li>Epoch 8</li>\n<li>Image size 1024</li>\n<li>Batchsize 2</li>\n<li>Mosaic</li>\n<li>Hue</li>\n<li>Ciou loss</li>\n<li>TTA 0°、90°、180° 、270°</li>\n</ol>\n<p>Finally ensemble new yolov4 and pseudo labeling:<br>\n<strong>Public</strong> 0.7594 / <strong>Private</strong> 0.6989</p>\n<p>2022/11/12 Updated the final score received from the official fix annotations.<br>\n<strong>Public</strong> 0.7589 (rank 46) / <strong>Private</strong> 0.6574 (rank 61)</p>",
  "messages": [
    {
      "id": "959139",
      "postDate": "08/05/2020 11:27:01",
      "content": "<p>This is the first time that I participate in this contest, and thank you for all the notes you guys shared. Since there's not a lot of contestants using yolov4, I'd like to share the method I used with yolov4, and hope other yolov4 user could join the discussion and share your opinions.</p>\n<h3>[1]Ground truth</h3>\n<p>At first, by slightly adjusting the incorrect and missing parts in Ground Truth, I've found a problem that the score from yolov4 couldn’t reach the score from yolov5 at the same ground truth. So I use the predicted results of the high score from yolov5 and the original score from yolov4 to analyze the distributing differences of both, and use yolov5 as standard to improve the Ground Truth to make their distributions relevant.</p>\n<h3>[2]Baseline</h3>\n<p>Improve the distribution and experiment the yolo4-training one by one.<br>\nTrain the fundamental parameters of yolov4:</p>\n<ol>\n<li>SGD 0.01 </li>\n<li>Epoch 80 </li>\n<li>Image size 1024</li>\n<li>Batchsize 2</li>\n<li>Mosaic</li>\n<li>Hue</li>\n<li>Randomly crop the wheat bbox and randomly paste them into an image(more successful when using better Ground Truth)</li>\n<li>Ciou loss</li>\n<li>TTA 0°、90°、180° 、270°</li>\n</ol>\n<h4>At last, yolov4 basemodel got the results of <strong>Public</strong> 0.7380 / <strong>Private</strong> 0.6589.</h4>\n<p>On the other hand, the result produced by EfficientDet with train.csv is the best.<br>\nTrain the fundamental parameters of EfficientDet D7:<br>\nadd Mixed Precision Training<br>\nadd Gradient Accumulation with 64</p>\n<ol>\n<li>AdamW 0.0002</li>\n<li>Epoch 100</li>\n<li>Image size 1024</li>\n<li>Batchsize 2</li>\n<li>Mosaic</li>\n<li>Randomly crop the wheat bbox and randomly paste them into an image(more successful when using better Ground Truth)</li>\n<li>TTA lr、ud</li>\n</ol>\n<h4>At last, EfficientDet D7 basemodel got the results of <strong>Public</strong> 0.7438 / <strong>Private</strong> 0.6679.</h4>\n<h3>[3]Ensemble</h3>\n<p>Yolov4 + EfficientDet D7 (not pseudo labeling) </p>\n<h4><strong>Public</strong> 0.7589 / <strong>Private</strong> 0.6805</h4>\n<p>Finding that Private Data might come with different image sizes, so I adjusted the submission.csv of the images of different image sizes.<br>\nAfter adjustion: Yolov4 + EfficientDet D7 (not pseudo labeling) </p>\n<h4><strong>Public</strong> 0.7589 / <strong>Private</strong> 0.6918</h4>\n<h3>[4]Psuedo Labeling</h3>\n<p>In the last step, I used ensemble Yolov4 + EfficientDet D7 as pseudo labeling to train yolov4.<br>\nUse pseudo labeling to train the fundamental parameters of yolov4:</p>\n<ol>\n<li>Radam 0.0004</li>\n<li>Epoch 8</li>\n<li>Image size 1024</li>\n<li>Batchsize 2</li>\n<li>Mosaic</li>\n<li>Hue</li>\n<li>Ciou loss</li>\n<li>TTA 0°、90°、180° 、270°</li>\n</ol>\n<p>Finally ensemble new yolov4 and pseudo labeling:<br>\n<strong>Public</strong> 0.7594 / <strong>Private</strong> 0.6989</p>\n<p>2022/11/12 Updated the final score received from the official fix annotations.<br>\n<strong>Public</strong> 0.7589 (rank 46) / <strong>Private</strong> 0.6574 (rank 61)</p>",
      "rawMarkdown": "This is the first time that I participate in this contest, and thank you for all the notes you guys shared. Since there's not a lot of contestants using yolov4, I'd like to share the method I used with yolov4, and hope other yolov4 user could join the discussion and share your opinions.\n\n###[1]Ground truth\n\nAt first, by slightly adjusting the incorrect and missing parts in Ground Truth, I've found a problem that the score from yolov4 couldn’t reach the score from yolov5 at the same ground truth. So I use the predicted results of the high score from yolov5 and the original score from yolov4 to analyze the distributing differences of both, and use yolov5 as standard to improve the Ground Truth to make their distributions relevant.\n\n###[2]Baseline\n\nImprove the distribution and experiment the yolo4-training one by one.\nTrain the fundamental parameters of yolov4:\n1. SGD 0.01 \n2. Epoch 80 \n3. Image size 1024\n3. Batchsize 2\n4. Mosaic\n5. Hue\n6. Randomly crop the wheat bbox and randomly paste them into an image(more successful when using better Ground Truth)\n7. Ciou loss\n8. TTA 0°、90°、180° 、270°\n\n#### At last, yolov4 basemodel got the results of **Public** 0.7380 / **Private** 0.6589.\n\nOn the other hand, the result produced by EfficientDet with train.csv is the best.\nTrain the fundamental parameters of EfficientDet D7:\nadd Mixed Precision Training\nadd Gradient Accumulation with 64\n1. AdamW 0.0002\n2. Epoch 100\n3. Image size 1024\n3. Batchsize 2\n4. Mosaic\n6. Randomly crop the wheat bbox and randomly paste them into an image(more successful when using better Ground Truth)\n7. TTA lr、ud\n\n#### At last, EfficientDet D7 basemodel got the results of **Public** 0.7438 / **Private** 0.6679.\n\n###[3]Ensemble\n\nYolov4 + EfficientDet D7 (not pseudo labeling) \n\n#### **Public** 0.7589 / **Private** 0.6805\n\nFinding that Private Data might come with different image sizes, so I adjusted the submission.csv of the images of different image sizes.\nAfter adjustion: Yolov4 + EfficientDet D7 (not pseudo labeling) \n\n#### **Public** 0.7589 / **Private** 0.6918\n\n###[4]Psuedo Labeling\n\nIn the last step, I used ensemble Yolov4 + EfficientDet D7 as pseudo labeling to train yolov4.\nUse pseudo labeling to train the fundamental parameters of yolov4:\n1. Radam 0.0004\n2. Epoch 8\n3. Image size 1024\n3. Batchsize 2\n4. Mosaic\n5. Hue\n7. Ciou loss\n8. TTA 0°、90°、180° 、270°\n\nFinally ensemble new yolov4 and pseudo labeling:\n**Public** 0.7594 / **Private** 0.6989\n\n2022/11/12 Updated the final score received from the official fix annotations.\n**Public** 0.7589 (rank 46) / **Private** 0.6574 (rank 61)",
      "votes": null
    },
    {
      "id": "959290",
      "postDate": "08/05/2020 13:25:50",
      "content": "<p><a href=\"/marcowu\">@marcowu</a>  Thanks for sharing your experiment steps. I used Darknet's YOLOv4 for training and then converted weights to keras format for further processing. My notebook is <a href=\"https://www.kaggle.com/iamprateek/wheat-head-detection-yolov4\">here</a> </p>\n\n<p>My baseline model with wbf has Private 0.6160/ Public 0.6788 score.  I could not able to successfully add TTA with my model as my public score was decreasing to 0.6352 with TTA.</p>\n\n<p>I am eagerly waiting to see your notebook with complete solution and learn from it .</p>",
      "rawMarkdown": "marcowu  Thanks for sharing your experiment steps. I used Darknet's YOLOv4 for training and then converted weights to keras format for further processing. My notebook is [here](https://www.kaggle.com/iamprateek/wheat-head-detection-yolov4) \n\nMy baseline model with wbf has Private 0.6160/ Public 0.6788 score.  I could not able to successfully add TTA with my model as my public score was decreasing to 0.6352 with TTA.\n\nI am eagerly waiting to see your notebook with complete solution and learn from it .",
      "votes": null
    },
    {
      "id": "960213",
      "postDate": "08/06/2020 08:25:25",
      "content": "<p>I think first you need to have a good baseline model , which will let your TTA work properly. About the notebook, I'll sort it out then share it publicly.</p>",
      "rawMarkdown": "I think first you need to have a good baseline model , which will let your TTA work properly. About the notebook, I'll sort it out then share it publicly.",
      "votes": null
    },
    {
      "id": "960922",
      "postDate": "08/06/2020 19:41:36",
      "content": "<ol>\n<li>How did you train YOLOv4? I found that it took around 50 minutes to train 1 epoch and so even colab pro was not enough. </li>\n<li>Did you use the <a href=\"https://github.com/AlexeyAB/darknet\">Darknet</a> version or the <a href=\"https://github.com/Tianxiaomo/pytorch-YOLOv4\">Pytorch</a> one? I went with the Pytorch version as I couldn't compile Darknet on kaggle at that time.</li>\n<li>Did you try changing the LR_scheduler? Pytorch version really messes up with LR.</li>\n</ol>",
      "rawMarkdown": "1. How did you train YOLOv4? I found that it took around 50 minutes to train 1 epoch and so even colab pro was not enough. \n2. Did you use the [Darknet](https://github.com/AlexeyAB/darknet) version or the [Pytorch](https://github.com/Tianxiaomo/pytorch-YOLOv4) one? I went with the Pytorch version as I couldn't compile Darknet on kaggle at that time.\n3. Did you try changing the LR_scheduler? Pytorch version really messes up with LR.",
      "votes": null
    },
    {
      "id": "961708",
      "postDate": "08/07/2020 12:40:13",
      "content": "<p>The yolov4 I trained was using <a href=\"https://github.com/Tianxiaomo/pytorch-YOLOv4\" target=\"_blank\">Pytorch</a> code on the V100 of my school. I tried changing LR_scheduler, like yolov3 pytorch version. However, I think the most efficient way to raise my score is to change the loss function according to the author of yolov4.</p>",
      "rawMarkdown": "The yolov4 I trained was using [Pytorch](https://github.com/Tianxiaomo/pytorch-YOLOv4) code on the V100 of my school. I tried changing LR_scheduler, like yolov3 pytorch version. However, I think the most efficient way to raise my score is to change the loss function according to the author of yolov4.",
      "votes": null
    },
    {
      "id": "961872",
      "postDate": "08/07/2020 15:18:10",
      "content": "<p>Will you open source your modified repo+ training + inference notebook? I think it would help a lot of peeps like me who couldn't get v4 to work</p>",
      "rawMarkdown": "Will you open source your modified repo+ training + inference notebook? I think it would help a lot of peeps like me who couldn't get v4 to work",
      "votes": null
    },
    {
      "id": "962509",
      "postDate": "08/08/2020 07:19:19",
      "content": "<p>There is my <a href=\"https://www.kaggle.com/marcowu/ap2-0effd-yolov4-pseudo-labeling-oof-evalu/notebook?scriptVersionId=40362830\" target=\"_blank\">notebook</a>. And about training code, I have another object detection competition now, so I already changed a lot in my training code. I think I’ll sort it out then share it in github after my another competition finish.</p>",
      "rawMarkdown": "There is my [notebook](https://www.kaggle.com/marcowu/ap2-0effd-yolov4-pseudo-labeling-oof-evalu/notebook?scriptVersionId=40362830). And about training code, I have another object detection competition now, so I already changed a lot in my training code. I think I’ll sort it out then share it in github after my another competition finish.",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 959290,
      "author_name": "iamprateek",
      "author_url": "",
      "post_date": "08/05/2020 13:25:50",
      "content": "<p><a href=\"/marcowu\">@marcowu</a>  Thanks for sharing your experiment steps. I used Darknet's YOLOv4 for training and then converted weights to keras format for further processing. My notebook is <a href=\"https://www.kaggle.com/iamprateek/wheat-head-detection-yolov4\">here</a> </p>\n\n<p>My baseline model with wbf has Private 0.6160/ Public 0.6788 score.  I could not able to successfully add TTA with my model as my public score was decreasing to 0.6352 with TTA.</p>\n\n<p>I am eagerly waiting to see your notebook with complete solution and learn from it .</p>",
      "votes": null,
      "replies": [
        {
          "id": 960213,
          "author_name": "marcowu",
          "author_url": "",
          "post_date": "08/06/2020 08:25:25",
          "content": "<p>I think first you need to have a good baseline model , which will let your TTA work properly. About the notebook, I'll sort it out then share it publicly.</p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 960922,
      "author_name": "tanmaypandey",
      "author_url": "",
      "post_date": "08/06/2020 19:41:36",
      "content": "<ol>\n<li>How did you train YOLOv4? I found that it took around 50 minutes to train 1 epoch and so even colab pro was not enough. </li>\n<li>Did you use the <a href=\"https://github.com/AlexeyAB/darknet\">Darknet</a> version or the <a href=\"https://github.com/Tianxiaomo/pytorch-YOLOv4\">Pytorch</a> one? I went with the Pytorch version as I couldn't compile Darknet on kaggle at that time.</li>\n<li>Did you try changing the LR_scheduler? Pytorch version really messes up with LR.</li>\n</ol>",
      "votes": null,
      "replies": [
        {
          "id": 961708,
          "author_name": "marcowu",
          "author_url": "",
          "post_date": "08/07/2020 12:40:13",
          "content": "<p>The yolov4 I trained was using <a href=\"https://github.com/Tianxiaomo/pytorch-YOLOv4\" target=\"_blank\">Pytorch</a> code on the V100 of my school. I tried changing LR_scheduler, like yolov3 pytorch version. However, I think the most efficient way to raise my score is to change the loss function according to the author of yolov4.</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 961872,
          "author_name": "tanmaypandey",
          "author_url": "",
          "post_date": "08/07/2020 15:18:10",
          "content": "<p>Will you open source your modified repo+ training + inference notebook? I think it would help a lot of peeps like me who couldn't get v4 to work</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 962509,
          "author_name": "marcowu",
          "author_url": "",
          "post_date": "08/08/2020 07:19:19",
          "content": "<p>There is my <a href=\"https://www.kaggle.com/marcowu/ap2-0effd-yolov4-pseudo-labeling-oof-evalu/notebook?scriptVersionId=40362830\" target=\"_blank\">notebook</a>. And about training code, I have another object detection competition now, so I already changed a lot in my training code. I think I’ll sort it out then share it in github after my another competition finish.</p>",
          "votes": null,
          "replies": []
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "959139": "This is the first time that I participate in this contest, and thank you for all the notes you guys shared. Since there's not a lot of contestants using yolov4, I'd like to share the method I used with yolov4, and hope other yolov4 user could join the discussion and share your opinions.\n\n###[1]Ground truth\n\nAt first, by slightly adjusting the incorrect and missing parts in Ground Truth, I've found a problem that the score from yolov4 couldn’t reach the score from yolov5 at the same ground truth. So I use the predicted results of the high score from yolov5 and the original score from yolov4 to analyze the distributing differences of both, and use yolov5 as standard to improve the Ground Truth to make their distributions relevant.\n\n###[2]Baseline\n\nImprove the distribution and experiment the yolo4-training one by one.\nTrain the fundamental parameters of yolov4:\n1. SGD 0.01 \n2. Epoch 80 \n3. Image size 1024\n3. Batchsize 2\n4. Mosaic\n5. Hue\n6. Randomly crop the wheat bbox and randomly paste them into an image(more successful when using better Ground Truth)\n7. Ciou loss\n8. TTA 0°、90°、180° 、270°\n\n#### At last, yolov4 basemodel got the results of **Public** 0.7380 / **Private** 0.6589.\n\nOn the other hand, the result produced by EfficientDet with train.csv is the best.\nTrain the fundamental parameters of EfficientDet D7:\nadd Mixed Precision Training\nadd Gradient Accumulation with 64\n1. AdamW 0.0002\n2. Epoch 100\n3. Image size 1024\n3. Batchsize 2\n4. Mosaic\n6. Randomly crop the wheat bbox and randomly paste them into an image(more successful when using better Ground Truth)\n7. TTA lr、ud\n\n#### At last, EfficientDet D7 basemodel got the results of **Public** 0.7438 / **Private** 0.6679.\n\n###[3]Ensemble\n\nYolov4 + EfficientDet D7 (not pseudo labeling) \n\n#### **Public** 0.7589 / **Private** 0.6805\n\nFinding that Private Data might come with different image sizes, so I adjusted the submission.csv of the images of different image sizes.\nAfter adjustion: Yolov4 + EfficientDet D7 (not pseudo labeling) \n\n#### **Public** 0.7589 / **Private** 0.6918\n\n###[4]Psuedo Labeling\n\nIn the last step, I used ensemble Yolov4 + EfficientDet D7 as pseudo labeling to train yolov4.\nUse pseudo labeling to train the fundamental parameters of yolov4:\n1. Radam 0.0004\n2. Epoch 8\n3. Image size 1024\n3. Batchsize 2\n4. Mosaic\n5. Hue\n7. Ciou loss\n8. TTA 0°、90°、180° 、270°\n\nFinally ensemble new yolov4 and pseudo labeling:\n**Public** 0.7594 / **Private** 0.6989\n\n2022/11/12 Updated the final score received from the official fix annotations.\n**Public** 0.7589 (rank 46) / **Private** 0.6574 (rank 61)",
    "959290": "marcowu  Thanks for sharing your experiment steps. I used Darknet's YOLOv4 for training and then converted weights to keras format for further processing. My notebook is [here](https://www.kaggle.com/iamprateek/wheat-head-detection-yolov4) \n\nMy baseline model with wbf has Private 0.6160/ Public 0.6788 score.  I could not able to successfully add TTA with my model as my public score was decreasing to 0.6352 with TTA.\n\nI am eagerly waiting to see your notebook with complete solution and learn from it .",
    "960213": "I think first you need to have a good baseline model , which will let your TTA work properly. About the notebook, I'll sort it out then share it publicly.",
    "960922": "1. How did you train YOLOv4? I found that it took around 50 minutes to train 1 epoch and so even colab pro was not enough. \n2. Did you use the [Darknet](https://github.com/AlexeyAB/darknet) version or the [Pytorch](https://github.com/Tianxiaomo/pytorch-YOLOv4) one? I went with the Pytorch version as I couldn't compile Darknet on kaggle at that time.\n3. Did you try changing the LR_scheduler? Pytorch version really messes up with LR.",
    "961708": "The yolov4 I trained was using [Pytorch](https://github.com/Tianxiaomo/pytorch-YOLOv4) code on the V100 of my school. I tried changing LR_scheduler, like yolov3 pytorch version. However, I think the most efficient way to raise my score is to change the loss function according to the author of yolov4.",
    "961872": "Will you open source your modified repo+ training + inference notebook? I think it would help a lot of peeps like me who couldn't get v4 to work",
    "962509": "There is my [notebook](https://www.kaggle.com/marcowu/ap2-0effd-yolov4-pseudo-labeling-oof-evalu/notebook?scriptVersionId=40362830). And about training code, I have another object detection competition now, so I already changed a lot in my training code. I think I’ll sort it out then share it in github after my another competition finish."
  },
  "source": "meta"
}