{
  "id": 160636,
  "title": "How to use yolo?",
  "url": "/competitions/global-wheat-detection/discussion/160636",
  "author_name": "Aishwarya",
  "post_date": "2020-06-22T05:48:24.317000",
  "votes": 0,
  "comment_count": 39,
  "views": 0,
  "content": "<p>How can i get weights and config file of yolo in kaggle?</p>",
  "messages": [
    {
      "id": 904508,
      "postDate": "2020-06-27T17:14:54.387Z",
      "content": "<p>Hi <a href=\"/aishwaryapalit\">@aishwaryapalit</a> \nAs some of the top contenders are using yolov5 you could check out their notebooks. \nSome of them are: \nby <a href=\"/orkatz2\">@orkatz2</a> [https://www.kaggle.com/orkatz2/yolov5-train]\nthis is the training model which you can use and improve on it on colab. In this all the details are given... </p>\n\n<p>for testing there is a great notebook with tta+single flip-ud and combination of scale and flip-ud by <a href=\"/wasupandceacar\">@wasupandceacar</a> [https://www.kaggle.com/wasupandceacar/yolov5-single-model-with-more-tta-lb-0-745]</p>\n\n<p>Hope this helps...</p>",
      "rawMarkdown": "Hi @aishwaryapalit \nAs some of the top contenders are using yolov5 you could check out their notebooks. \nSome of them are: \nby @orkatz2 [https://www.kaggle.com/orkatz2/yolov5-train]\nthis is the training model which you can use and improve on it on colab. In this all the details are given... \n\nfor testing there is a great notebook with tta+single flip-ud and combination of scale and flip-ud by @wasupandceacar [https://www.kaggle.com/wasupandceacar/yolov5-single-model-with-more-tta-lb-0-745]\n\nHope this helps...",
      "votes": 1
    },
    {
      "id": 896372,
      "postDate": "2020-06-22T05:48:24.317Z",
      "content": "<p>How can i get weights and config file of yolo in kaggle?</p>",
      "rawMarkdown": "How can i get weights and config file of yolo in kaggle?"
    },
    {
      "id": 897640,
      "postDate": "2020-06-23T02:23:38.453Z",
      "content": "<p>Yolo Config file : <a href=\"https://github.com/AlexeyAB/darknet/tree/master/cfg\">https://github.com/AlexeyAB/darknet/tree/master/cfg</a>\nYolo Weights : <a href=\"https://github.com/AlexeyAB/darknet#how-to-train-to-detect-your-custom-objects\">https://github.com/AlexeyAB/darknet#how-to-train-to-detect-your-custom-objects</a></p>\n\n<p>Changes need to be done in Yolo config file : <a href=\"https://github.com/AlexeyAB/darknet#how-to-train-to-detect-your-custom-objects\">https://github.com/AlexeyAB/darknet#how-to-train-to-detect-your-custom-objects</a></p>",
      "rawMarkdown": "Yolo Config file : https://github.com/AlexeyAB/darknet/tree/master/cfg\nYolo Weights : https://github.com/AlexeyAB/darknet#how-to-train-to-detect-your-custom-objects\n\nChanges need to be done in Yolo config file : https://github.com/AlexeyAB/darknet#how-to-train-to-detect-your-custom-objects",
      "votes": 1,
      "replies": [
        {
          "id": 902540,
          "postDate": "2020-06-26T07:59:27.227Z",
          "content": "<p>Thank you</p>",
          "rawMarkdown": "Thank you"
        }
      ]
    },
    {
      "id": 916973,
      "postDate": "2020-07-06T06:47:01.933Z",
      "content": "<p>yolov5</p>",
      "rawMarkdown": "yolov5",
      "votes": -4,
      "replies": [
        {
          "id": 917004,
          "postDate": "2020-07-06T07:04:52.903Z",
          "rawMarkdown": "",
          "isDeleted": true
        }
      ]
    },
    {
      "id": 903920,
      "postDate": "2020-06-27T08:04:01.933Z",
      "content": "<p>Hi <a href=\"/aishwaryapalit\">@aishwaryapalit</a>  I've trained a yolo model, but I can't use it to inference on Kaggle kernel, did you succeed?</p>",
      "rawMarkdown": "Hi @aishwaryapalit  I've trained a yolo model, but I can't use it to inference on Kaggle kernel, did you succeed?",
      "replies": [
        {
          "id": 905389,
          "postDate": "2020-06-28T14:09:07.233Z",
          "content": "<p>No</p>",
          "rawMarkdown": "No"
        },
        {
          "id": 905393,
          "postDate": "2020-06-28T14:16:12.153Z",
          "content": "<p>well, it seems that we have to use other model then...</p>",
          "rawMarkdown": "well, it seems that we have to use other model then..."
        },
        {
          "id": 905396,
          "postDate": "2020-06-28T14:19:23.217Z",
          "content": "<p>Did you succeed? </p>",
          "rawMarkdown": "Did you succeed? "
        },
        {
          "id": 905424,
          "postDate": "2020-06-28T14:39:12.710Z",
          "content": "<p>I trained a model in my local machine, but can't upload it to kagge to use...</p>",
          "rawMarkdown": "I trained a model in my local machine, but can't upload it to kagge to use..."
        },
        {
          "id": 905428,
          "postDate": "2020-06-28T14:42:25.040Z",
          "content": "<p>Same things happen with me also.. I did it in my local machine but not able to replicate over here</p>",
          "rawMarkdown": "Same things happen with me also.. I did it in my local machine but not able to replicate over here"
        },
        {
          "id": 905492,
          "postDate": "2020-06-28T15:37:42.437Z",
          "content": "<p>Okay so you both are a bit new to YOLO i guess, \nso here is a pipeline...\nyou will have to do everything on google drive and google colab as models might run out of memory on local....\nThese are some rough steps you can follow for a successful pipeline...\n1. Put your data on drive  (train_images and train.csv)\n2. Use this train notebook as base on colab and build over it =&gt; credit to <a href=\"/orkatz2\">@orkatz2</a> \n<a href=\"https://www.kaggle.com/orkatz2/yolov5-train\">LINK</a>\n3. To train successfully you might have to change paths in config files and clone the yolov5 repository (which you will figure out I guess)\n4. If you want to improve training speed install NVIDIA apex..\n5. Before training you can make small changes in <code>yolov5/train.py</code> for saving the <code>results.txt</code>, <code>last_ckpt</code> and <code>best_ckpt</code> in your drive so that you can use later.\n6. After the model trains use the <code>best.pt</code> file in your kaggle for inference. (a shortcut for this is to use <code>gdown</code> instead of downloading on local and uploading again on kaggle)...\n7.  One of the best inference file for yolov5 is by <a href=\"/wasupandceacar\">@wasupandceacar</a> <a href=\"https://www.kaggle.com/wasupandceacar/yolov5-single-model-with-more-tta-lb-0-745\">LINK</a>\nYou can just fork it and make your own changes if you wish to...\n8. Finally submit your predictions.. </p>\n\n<p>I guess it was too detailed... But hope this helps..</p>",
          "rawMarkdown": "Okay so you both are a bit new to YOLO i guess, \nso here is a pipeline...\nyou will have to do everything on google drive and google colab as models might run out of memory on local....\nThese are some rough steps you can follow for a successful pipeline...\n1. Put your data on drive  (train_images and train.csv)\n2. Use this train notebook as base on colab and build over it =&gt; credit to @orkatz2 \n[LINK](https://www.kaggle.com/orkatz2/yolov5-train)\n3. To train successfully you might have to change paths in config files and clone the yolov5 repository (which you will figure out I guess)\n4. If you want to improve training speed install NVIDIA apex..\n5. Before training you can make small changes in `yolov5/train.py` for saving the `results.txt`, `last_ckpt` and `best_ckpt` in your drive so that you can use later.\n6. After the model trains use the `best.pt` file in your kaggle for inference. (a shortcut for this is to use `gdown` instead of downloading on local and uploading again on kaggle)...\n7.  One of the best inference file for yolov5 is by @wasupandceacar [LINK](https://www.kaggle.com/wasupandceacar/yolov5-single-model-with-more-tta-lb-0-745)\nYou can just fork it and make your own changes if you wish to...\n8. Finally submit your predictions.. \n\nI guess it was too detailed... But hope this helps..",
          "votes": 12
        },
        {
          "id": 906111,
          "postDate": "2020-06-29T04:33:28.287Z",
          "content": "<p>Thank you <a href=\"/nitindatta\">@nitindatta</a>!</p>",
          "rawMarkdown": "Thank you @nitindatta!",
          "votes": 2
        },
        {
          "id": 906399,
          "postDate": "2020-06-29T09:05:54.220Z",
          "content": "<p>Thx for the sharing. I have a question about training the YoloV5. I follow orkatz2's notebook. However, when I include --weights ../yolov5x.pt in the command, the performance went down. Does it mean we should not load the pretrained weights and start from scratch in this competition? And, when I tried to train the Yolo on the other day, the result is different from last time without any change of the config. The mAP.5 decrease from 0.3 to 0.003 in the 1st epoch. Is it normal? Thank you.</p>",
          "rawMarkdown": "Thx for the sharing. I have a question about training the YoloV5. I follow orkatz2's notebook. However, when I include --weights ../yolov5x.pt in the command, the performance went down. Does it mean we should not load the pretrained weights and start from scratch in this competition? And, when I tried to train the Yolo on the other day, the result is different from last time without any change of the config. The mAP.5 decrease from 0.3 to 0.003 in the 1st epoch. Is it normal? Thank you.",
          "votes": 1
        },
        {
          "id": 906427,
          "postDate": "2020-06-29T09:35:59.477Z",
          "content": "<p>Hi <a href=\"/ljjsfe\">@ljjsfe</a> , \nI have tried both the yolov5 (with pretrained weights and without)....\nHowever, I saw a jump in 0.2x jump in LB by using pretrained weights..\nPlease try using these weights <a href=\"https://drive.google.com/drive/folders/1Drs_Aiu7xx6S-ix95f9kNsA6ueKRpN2J\">LINK</a> and the mAP falls too low when you dont use pretrained weights for first few epochs and then picks up...\nBut for the best results pretrained weights is the one</p>",
          "rawMarkdown": "Hi @ljjsfe , \nI have tried both the yolov5 (with pretrained weights and without)....\nHowever, I saw a jump in 0.2x jump in LB by using pretrained weights..\nPlease try using these weights [LINK](https://drive.google.com/drive/folders/1Drs_Aiu7xx6S-ix95f9kNsA6ueKRpN2J) and the mAP falls too low when you dont use pretrained weights for first few epochs and then picks up...\nBut for the best results pretrained weights is the one"
        },
        {
          "id": 906771,
          "postDate": "2020-06-29T14:28:15.463Z",
          "content": "<p>Thx for the reply. I noticed that my training process keep decreasing the mAP to unbelievable low like 0.0003 in the first 5 epochs. Does it mean I make some error in the training pipeline? Thx.</p>",
          "rawMarkdown": "Thx for the reply. I noticed that my training process keep decreasing the mAP to unbelievable low like 0.0003 in the first 5 epochs. Does it mean I make some error in the training pipeline? Thx."
        },
        {
          "id": 906831,
          "postDate": "2020-06-29T14:58:36.177Z",
          "content": "<p>I guess something is wrong with your training pipeline...\nI faced the same issue during my first training...\nThen I updated all the yaml files, pretrained weights file and tried... \nPlease try to use pretrained weights it will improve your mAP</p>",
          "rawMarkdown": "I guess something is wrong with your training pipeline...\nI faced the same issue during my first training...\nThen I updated all the yaml files, pretrained weights file and tried... \nPlease try to use pretrained weights it will improve your mAP\n"
        },
        {
          "id": 906884,
          "postDate": "2020-06-29T15:28:44.513Z",
          "content": "<p>Thank you so much. One more question, using YoloV3, I know we need to freeze some layers first. But according to the YoloV5 tutorial, looks like it does not require the user to freeze any layers. Does it automated freeze the layers for us?</p>",
          "rawMarkdown": "Thank you so much. One more question, using YoloV3, I know we need to freeze some layers first. But according to the YoloV5 tutorial, looks like it does not require the user to freeze any layers. Does it automated freeze the layers for us?"
        },
        {
          "id": 907774,
          "postDate": "2020-06-30T06:51:42.453Z",
          "content": "<p>Hi, <a href=\"/stevenyin\">@stevenyin</a>  if you trained yolo model on local machine you can submit your prediction using weights and cfg file.Here is the link of my kaggle kernel where i have done the same </p>\n\n<p><a href=\"https://www.kaggle.com/ravi02516/visualize-yolov3-darknet-prediction-on-test-images?scriptVersionId=37760994\">https://www.kaggle.com/ravi02516/visualize-yolov3-darknet-prediction-on-test-images?scriptVersionId=37760994</a></p>",
          "rawMarkdown": "Hi, @stevenyin  if you trained yolo model on local machine you can submit your prediction using weights and cfg file.Here is the link of my kaggle kernel where i have done the same \n\nhttps://www.kaggle.com/ravi02516/visualize-yolov3-darknet-prediction-on-test-images?scriptVersionId=37760994\n\n"
        },
        {
          "id": 908195,
          "postDate": "2020-06-30T12:43:17.147Z",
          "content": "<p>Hi <a href=\"/nitindatta\">@nitindatta</a> thanks for your detailed explanation! I've already successfully trainined a yolov5 model, what I confronted with is submission error, which stops me from submitting... I'm still trying out.... But I really appreaciate your kindness!</p>",
          "rawMarkdown": "Hi @nitindatta thanks for your detailed explanation! I've already successfully trainined a yolov5 model, what I confronted with is submission error, which stops me from submitting... I'm still trying out.... But I really appreaciate your kindness!",
          "votes": 1
        },
        {
          "id": 908202,
          "postDate": "2020-06-30T12:45:44.553Z",
          "content": "<p><a href=\"/ravi02516\">@ravi02516</a> you name is cool, haha.</p>\n\n<p>Thanks for your help. I've implemented my own prediction script that can be committed. But I can't submit it successfully for a LB score... it says submission error...which is pretty wired..</p>",
          "rawMarkdown": "@ravi02516 you name is cool, haha.\n\nThanks for your help. I've implemented my own prediction script that can be committed. But I can't submit it successfully for a LB score... it says submission error...which is pretty wired.."
        },
        {
          "id": 908219,
          "postDate": "2020-06-30T12:57:06.337Z",
          "content": "<p>Hi <a href=\"/stevenyin\">@stevenyin</a> , \nSome of the reasons why submission error comes is because:\n- Internet is turned on for inference code\n- There is no model in the inference code and only a submission csv file\n- the dataframe being submitted is in wrong format...\nThese are the main reasons which I know of..... could be more</p>",
          "rawMarkdown": "Hi @stevenyin , \nSome of the reasons why submission error comes is because:\n- Internet is turned on for inference code\n- There is no model in the inference code and only a submission csv file\n- the dataframe being submitted is in wrong format...\nThese are the main reasons which I know of..... could be more\n"
        },
        {
          "id": 908259,
          "postDate": "2020-06-30T13:25:48.397Z",
          "content": "<p>Hi <a href=\"/nitindatta\">@nitindatta</a> thanks for your help! Yeah, I can confirm that internet access is closed. I folked another submission kernel and uploaded my local model. It works. I think my original inference kernel is somehow wrong....</p>",
          "rawMarkdown": "Hi @nitindatta thanks for your help! Yeah, I can confirm that internet access is closed. I folked another submission kernel and uploaded my local model. It works. I think my original inference kernel is somehow wrong....",
          "votes": 1
        },
        {
          "id": 908315,
          "postDate": "2020-06-30T14:04:16.860Z",
          "content": "<p>Hi <a href=\"/nitindatta\">@nitindatta</a>, could you please provide some further information about step five? I can't figure out what modifications I need to make for my training outputs to save to Google Drive. Many thanks.</p>",
          "rawMarkdown": "Hi @nitindatta, could you please provide some further information about step five? I can't figure out what modifications I need to make for my training outputs to save to Google Drive. Many thanks."
        },
        {
          "id": 908328,
          "postDate": "2020-06-30T14:09:25.267Z",
          "content": "<p>Hi <a href=\"/drjoeroberts\">@drjoeroberts</a> , \nBy modifying the train.py I mean you need to change the path and give the path to your drive where you want to store the files...\nFor instance I created a new directory in my drive called <code>Results</code> and copied its path and placed it\nhere =&gt; <code>wdir = 'weights' + os.sep  # weights dir</code> \nIf you want some more changes you can make....\nHope this helps</p>",
          "rawMarkdown": "Hi @drjoeroberts , \nBy modifying the train.py I mean you need to change the path and give the path to your drive where you want to store the files...\nFor instance I created a new directory in my drive called `Results` and copied its path and placed it\nhere =&gt; `wdir = 'weights' + os.sep  # weights dir` \nIf you want some more changes you can make....\nHope this helps",
          "votes": 1
        },
        {
          "id": 909460,
          "postDate": "2020-06-30T15:54:37.260Z",
          "content": "<p>Thanks <a href=\"/nitindatta\">@nitindatta</a> - this extra information was very useful. One final question, for your example could I just add this line to the train.py file: <code>wdir = '../content/drive/My Drive/results/'</code> or do I have the wrong idea. Many thanks.</p>",
          "rawMarkdown": "Thanks @nitindatta - this extra information was very useful. One final question, for your example could I just add this line to the train.py file: `wdir = '../content/drive/My Drive/results/'` or do I have the wrong idea. Many thanks."
        },
        {
          "id": 909510,
          "postDate": "2020-06-30T16:16:01.273Z",
          "content": "<p>No you have to make some changes for results.txt too</p>",
          "rawMarkdown": "No you have to make some changes for results.txt too"
        },
        {
          "id": 909536,
          "postDate": "2020-06-30T16:28:48.673Z",
          "content": "<p>results.ext? you mean the submission csv file?</p>",
          "rawMarkdown": "results.ext? you mean the submission csv file?"
        },
        {
          "id": 909541,
          "postDate": "2020-06-30T16:36:44.323Z",
          "content": "<p>Okay, I am still not sure what changes are needed in train.py to write the model training results to my Google Drive. Thanks for your advice, I appreciate you taking the time to answer my question and that you may not want to give detailed information at this point of the competition.</p>",
          "rawMarkdown": "Okay, I am still not sure what changes are needed in train.py to write the model training results to my Google Drive. Thanks for your advice, I appreciate you taking the time to answer my question and that you may not want to give detailed information at this point of the competition."
        },
        {
          "id": 910018,
          "postDate": "2020-07-01T01:14:05.667Z",
          "content": "<p><code>wdir = # Path to your drive</code>\n<code>last = wdir + 'last.pt'</code>\n<code>best = wdir + 'best.pt'</code>\n<code>results_file =  wdir + 'results.txt'</code>\nThats it <a href=\"/drjoeroberts\">@drjoeroberts</a>  and <a href=\"/stevenyin\">@stevenyin</a> </p>",
          "rawMarkdown": "`wdir = # Path to your drive`\n`last = wdir + 'last.pt'`\n`best = wdir + 'best.pt'`\n`results_file =  wdir + 'results.txt'`\nThats it @drjoeroberts  and @stevenyin ",
          "votes": 1
        },
        {
          "id": 910024,
          "postDate": "2020-07-01T01:19:13.827Z",
          "content": "<p>Hi <a href=\"/ljjsfe\">@ljjsfe</a>, According to my knowledge we do not have to bother about freezing in yolov5...\nSorry for the late reply :)</p>",
          "rawMarkdown": "Hi @ljjsfe, According to my knowledge we do not have to bother about freezing in yolov5...\nSorry for the late reply :)"
        },
        {
          "id": 910487,
          "postDate": "2020-07-01T07:08:48.353Z",
          "content": "<p>Hi <a href=\"/nitindatta\">@nitindatta</a> - this was very useful, many thanks. I was basically there but had missed <code>results_file = wdir + 'results.txt'</code>. I appreciate your help!</p>",
          "rawMarkdown": "Hi @nitindatta - this was very useful, many thanks. I was basically there but had missed `results_file = wdir + 'results.txt'`. I appreciate your help!",
          "votes": 1
        },
        {
          "id": 910502,
          "postDate": "2020-07-01T07:18:51.157Z",
          "content": "<p>Hi <a href=\"/nitindatta\">@nitindatta</a>, Thanks for the detailed information, useful for beginners.</p>",
          "rawMarkdown": "Hi @nitindatta, Thanks for the detailed information, useful for beginners.",
          "votes": 1
        },
        {
          "id": 910545,
          "postDate": "2020-07-01T07:51:46.327Z",
          "rawMarkdown": "",
          "isDeleted": true
        },
        {
          "id": 910577,
          "postDate": "2020-07-01T08:18:00.700Z",
          "content": "<p>Yeah. Thank you. I came across the source code of it and feel really surprised. Maybe it hides some trick in some parts. :)</p>",
          "rawMarkdown": "Yeah. Thank you. I came across the source code of it and feel really surprised. Maybe it hides some trick in some parts. :)"
        },
        {
          "id": 911291,
          "postDate": "2020-07-01T16:39:23.600Z",
          "content": "<p>Thank you <a href=\"/sebastianji\">@sebastianji</a> \nHappy to help</p>",
          "rawMarkdown": "Thank you @sebastianji \nHappy to help\n"
        }
      ]
    },
    {
      "id": 897337,
      "postDate": "2020-06-22T19:34:40.767Z",
      "rawMarkdown": "",
      "votes": -1,
      "isDeleted": true,
      "replies": [
        {
          "id": 897363,
          "postDate": "2020-06-22T19:57:15.480Z",
          "content": "<p>Copy-pasting a generic summary of YOLO isn't a great way to answer a genuine question..</p>\n\n<p>Edit: Thanks for realizing your mistake and editing your response but it still never answered her question. Sorry bud, no free karma today 😆 </p>",
          "rawMarkdown": "Copy-pasting a generic summary of YOLO isn't a great way to answer a genuine question..\n\nEdit: Thanks for realizing your mistake and editing your response but it still never answered her question. Sorry bud, no free karma today 😆 ",
          "votes": 1
        },
        {
          "id": 897504,
          "postDate": "2020-06-22T23:02:52.797Z",
          "rawMarkdown": "",
          "votes": -2,
          "isDeleted": true
        }
      ]
    }
  ],
  "comments": [
    {
      "id": 904508,
      "author_name": "Nitin Datta",
      "author_url": "",
      "post_date": "2020-06-27T17:14:54.387000",
      "content": "<p>Hi <a href=\"/aishwaryapalit\">@aishwaryapalit</a> \nAs some of the top contenders are using yolov5 you could check out their notebooks. \nSome of them are: \nby <a href=\"/orkatz2\">@orkatz2</a> [https://www.kaggle.com/orkatz2/yolov5-train]\nthis is the training model which you can use and improve on it on colab. In this all the details are given... </p>\n\n<p>for testing there is a great notebook with tta+single flip-ud and combination of scale and flip-ud by <a href=\"/wasupandceacar\">@wasupandceacar</a> [https://www.kaggle.com/wasupandceacar/yolov5-single-model-with-more-tta-lb-0-745]</p>\n\n<p>Hope this helps...</p>",
      "votes": 1,
      "replies": []
    },
    {
      "id": 897640,
      "author_name": "Bala Murugan N G",
      "author_url": "",
      "post_date": "2020-06-23T02:23:38.453000",
      "content": "<p>Yolo Config file : <a href=\"https://github.com/AlexeyAB/darknet/tree/master/cfg\">https://github.com/AlexeyAB/darknet/tree/master/cfg</a>\nYolo Weights : <a href=\"https://github.com/AlexeyAB/darknet#how-to-train-to-detect-your-custom-objects\">https://github.com/AlexeyAB/darknet#how-to-train-to-detect-your-custom-objects</a></p>\n\n<p>Changes need to be done in Yolo config file : <a href=\"https://github.com/AlexeyAB/darknet#how-to-train-to-detect-your-custom-objects\">https://github.com/AlexeyAB/darknet#how-to-train-to-detect-your-custom-objects</a></p>",
      "votes": 1,
      "replies": [
        {
          "id": 902540,
          "author_name": "Aishwarya",
          "author_url": "",
          "post_date": "2020-06-26T07:59:27.227000",
          "content": "<p>Thank you</p>",
          "votes": 0,
          "replies": []
        }
      ]
    },
    {
      "id": 916973,
      "author_name": "momomo",
      "author_url": "",
      "post_date": "2020-07-06T06:47:01.933000",
      "content": "<p>yolov5</p>",
      "votes": -4,
      "replies": [
        {
          "id": 917004,
          "author_name": "",
          "author_url": "",
          "post_date": "2020-07-06T07:04:52.903000",
          "content": "",
          "votes": 0,
          "replies": []
        }
      ]
    },
    {
      "id": 903920,
      "author_name": "",
      "author_url": "",
      "post_date": "2020-06-27T08:04:01.933000",
      "content": "<p>Hi <a href=\"/aishwaryapalit\">@aishwaryapalit</a>  I've trained a yolo model, but I can't use it to inference on Kaggle kernel, did you succeed?</p>",
      "votes": 0,
      "replies": [
        {
          "id": 905389,
          "author_name": "Aishwarya",
          "author_url": "",
          "post_date": "2020-06-28T14:09:07.233000",
          "content": "<p>No</p>",
          "votes": 0,
          "replies": []
        },
        {
          "id": 905393,
          "author_name": "",
          "author_url": "",
          "post_date": "2020-06-28T14:16:12.153000",
          "content": "<p>well, it seems that we have to use other model then...</p>",
          "votes": 0,
          "replies": []
        },
        {
          "id": 905396,
          "author_name": "Aishwarya",
          "author_url": "",
          "post_date": "2020-06-28T14:19:23.217000",
          "content": "<p>Did you succeed? </p>",
          "votes": 0,
          "replies": []
        },
        {
          "id": 905424,
          "author_name": "",
          "author_url": "",
          "post_date": "2020-06-28T14:39:12.710000",
          "content": "<p>I trained a model in my local machine, but can't upload it to kagge to use...</p>",
          "votes": 0,
          "replies": []
        },
        {
          "id": 905428,
          "author_name": "Aishwarya",
          "author_url": "",
          "post_date": "2020-06-28T14:42:25.040000",
          "content": "<p>Same things happen with me also.. I did it in my local machine but not able to replicate over here</p>",
          "votes": 0,
          "replies": []
        },
        {
          "id": 905492,
          "author_name": "Nitin Datta",
          "author_url": "",
          "post_date": "2020-06-28T15:37:42.437000",
          "content": "<p>Okay so you both are a bit new to YOLO i guess, \nso here is a pipeline...\nyou will have to do everything on google drive and google colab as models might run out of memory on local....\nThese are some rough steps you can follow for a successful pipeline...\n1. Put your data on drive  (train_images and train.csv)\n2. Use this train notebook as base on colab and build over it =&gt; credit to <a href=\"/orkatz2\">@orkatz2</a> \n<a href=\"https://www.kaggle.com/orkatz2/yolov5-train\">LINK</a>\n3. To train successfully you might have to change paths in config files and clone the yolov5 repository (which you will figure out I guess)\n4. If you want to improve training speed install NVIDIA apex..\n5. Before training you can make small changes in <code>yolov5/train.py</code> for saving the <code>results.txt</code>, <code>last_ckpt</code> and <code>best_ckpt</code> in your drive so that you can use later.\n6. After the model trains use the <code>best.pt</code> file in your kaggle for inference. (a shortcut for this is to use <code>gdown</code> instead of downloading on local and uploading again on kaggle)...\n7.  One of the best inference file for yolov5 is by <a href=\"/wasupandceacar\">@wasupandceacar</a> <a href=\"https://www.kaggle.com/wasupandceacar/yolov5-single-model-with-more-tta-lb-0-745\">LINK</a>\nYou can just fork it and make your own changes if you wish to...\n8. Finally submit your predictions.. </p>\n\n<p>I guess it was too detailed... But hope this helps..</p>",
          "votes": 12,
          "replies": []
        },
        {
          "id": 906111,
          "author_name": "Abu Noman Md. Sakib",
          "author_url": "",
          "post_date": "2020-06-29T04:33:28.287000",
          "content": "<p>Thank you <a href=\"/nitindatta\">@nitindatta</a>!</p>",
          "votes": 2,
          "replies": []
        },
        {
          "id": 906399,
          "author_name": "Yang Lin",
          "author_url": "",
          "post_date": "2020-06-29T09:05:54.220000",
          "content": "<p>Thx for the sharing. I have a question about training the YoloV5. I follow orkatz2's notebook. However, when I include --weights ../yolov5x.pt in the command, the performance went down. Does it mean we should not load the pretrained weights and start from scratch in this competition? And, when I tried to train the Yolo on the other day, the result is different from last time without any change of the config. The mAP.5 decrease from 0.3 to 0.003 in the 1st epoch. Is it normal? Thank you.</p>",
          "votes": 1,
          "replies": []
        },
        {
          "id": 906427,
          "author_name": "Nitin Datta",
          "author_url": "",
          "post_date": "2020-06-29T09:35:59.477000",
          "content": "<p>Hi <a href=\"/ljjsfe\">@ljjsfe</a> , \nI have tried both the yolov5 (with pretrained weights and without)....\nHowever, I saw a jump in 0.2x jump in LB by using pretrained weights..\nPlease try using these weights <a href=\"https://drive.google.com/drive/folders/1Drs_Aiu7xx6S-ix95f9kNsA6ueKRpN2J\">LINK</a> and the mAP falls too low when you dont use pretrained weights for first few epochs and then picks up...\nBut for the best results pretrained weights is the one</p>",
          "votes": 0,
          "replies": []
        },
        {
          "id": 906771,
          "author_name": "Yang Lin",
          "author_url": "",
          "post_date": "2020-06-29T14:28:15.463000",
          "content": "<p>Thx for the reply. I noticed that my training process keep decreasing the mAP to unbelievable low like 0.0003 in the first 5 epochs. Does it mean I make some error in the training pipeline? Thx.</p>",
          "votes": 0,
          "replies": []
        },
        {
          "id": 906831,
          "author_name": "Nitin Datta",
          "author_url": "",
          "post_date": "2020-06-29T14:58:36.177000",
          "content": "<p>I guess something is wrong with your training pipeline...\nI faced the same issue during my first training...\nThen I updated all the yaml files, pretrained weights file and tried... \nPlease try to use pretrained weights it will improve your mAP</p>",
          "votes": 0,
          "replies": []
        },
        {
          "id": 906884,
          "author_name": "Yang Lin",
          "author_url": "",
          "post_date": "2020-06-29T15:28:44.513000",
          "content": "<p>Thank you so much. One more question, using YoloV3, I know we need to freeze some layers first. But according to the YoloV5 tutorial, looks like it does not require the user to freeze any layers. Does it automated freeze the layers for us?</p>",
          "votes": 0,
          "replies": []
        },
        {
          "id": 907774,
          "author_name": "IRONSIGHT",
          "author_url": "",
          "post_date": "2020-06-30T06:51:42.453000",
          "content": "<p>Hi, <a href=\"/stevenyin\">@stevenyin</a>  if you trained yolo model on local machine you can submit your prediction using weights and cfg file.Here is the link of my kaggle kernel where i have done the same </p>\n\n<p><a href=\"https://www.kaggle.com/ravi02516/visualize-yolov3-darknet-prediction-on-test-images?scriptVersionId=37760994\">https://www.kaggle.com/ravi02516/visualize-yolov3-darknet-prediction-on-test-images?scriptVersionId=37760994</a></p>",
          "votes": 0,
          "replies": []
        },
        {
          "id": 908195,
          "author_name": "",
          "author_url": "",
          "post_date": "2020-06-30T12:43:17.147000",
          "content": "<p>Hi <a href=\"/nitindatta\">@nitindatta</a> thanks for your detailed explanation! I've already successfully trainined a yolov5 model, what I confronted with is submission error, which stops me from submitting... I'm still trying out.... But I really appreaciate your kindness!</p>",
          "votes": 1,
          "replies": []
        },
        {
          "id": 908202,
          "author_name": "",
          "author_url": "",
          "post_date": "2020-06-30T12:45:44.553000",
          "content": "<p><a href=\"/ravi02516\">@ravi02516</a> you name is cool, haha.</p>\n\n<p>Thanks for your help. I've implemented my own prediction script that can be committed. But I can't submit it successfully for a LB score... it says submission error...which is pretty wired..</p>",
          "votes": 0,
          "replies": []
        },
        {
          "id": 908219,
          "author_name": "Nitin Datta",
          "author_url": "",
          "post_date": "2020-06-30T12:57:06.337000",
          "content": "<p>Hi <a href=\"/stevenyin\">@stevenyin</a> , \nSome of the reasons why submission error comes is because:\n- Internet is turned on for inference code\n- There is no model in the inference code and only a submission csv file\n- the dataframe being submitted is in wrong format...\nThese are the main reasons which I know of..... could be more</p>",
          "votes": 0,
          "replies": []
        },
        {
          "id": 908259,
          "author_name": "",
          "author_url": "",
          "post_date": "2020-06-30T13:25:48.397000",
          "content": "<p>Hi <a href=\"/nitindatta\">@nitindatta</a> thanks for your help! Yeah, I can confirm that internet access is closed. I folked another submission kernel and uploaded my local model. It works. I think my original inference kernel is somehow wrong....</p>",
          "votes": 1,
          "replies": []
        },
        {
          "id": 908315,
          "author_name": "Joe Roberts",
          "author_url": "",
          "post_date": "2020-06-30T14:04:16.860000",
          "content": "<p>Hi <a href=\"/nitindatta\">@nitindatta</a>, could you please provide some further information about step five? I can't figure out what modifications I need to make for my training outputs to save to Google Drive. Many thanks.</p>",
          "votes": 0,
          "replies": []
        },
        {
          "id": 908328,
          "author_name": "Nitin Datta",
          "author_url": "",
          "post_date": "2020-06-30T14:09:25.267000",
          "content": "<p>Hi <a href=\"/drjoeroberts\">@drjoeroberts</a> , \nBy modifying the train.py I mean you need to change the path and give the path to your drive where you want to store the files...\nFor instance I created a new directory in my drive called <code>Results</code> and copied its path and placed it\nhere =&gt; <code>wdir = 'weights' + os.sep  # weights dir</code> \nIf you want some more changes you can make....\nHope this helps</p>",
          "votes": 1,
          "replies": []
        },
        {
          "id": 909460,
          "author_name": "Joe Roberts",
          "author_url": "",
          "post_date": "2020-06-30T15:54:37.260000",
          "content": "<p>Thanks <a href=\"/nitindatta\">@nitindatta</a> - this extra information was very useful. One final question, for your example could I just add this line to the train.py file: <code>wdir = '../content/drive/My Drive/results/'</code> or do I have the wrong idea. Many thanks.</p>",
          "votes": 0,
          "replies": []
        },
        {
          "id": 909510,
          "author_name": "Nitin Datta",
          "author_url": "",
          "post_date": "2020-06-30T16:16:01.273000",
          "content": "<p>No you have to make some changes for results.txt too</p>",
          "votes": 0,
          "replies": []
        },
        {
          "id": 909536,
          "author_name": "",
          "author_url": "",
          "post_date": "2020-06-30T16:28:48.673000",
          "content": "<p>results.ext? you mean the submission csv file?</p>",
          "votes": 0,
          "replies": []
        },
        {
          "id": 909541,
          "author_name": "Joe Roberts",
          "author_url": "",
          "post_date": "2020-06-30T16:36:44.323000",
          "content": "<p>Okay, I am still not sure what changes are needed in train.py to write the model training results to my Google Drive. Thanks for your advice, I appreciate you taking the time to answer my question and that you may not want to give detailed information at this point of the competition.</p>",
          "votes": 0,
          "replies": []
        },
        {
          "id": 910018,
          "author_name": "Nitin Datta",
          "author_url": "",
          "post_date": "2020-07-01T01:14:05.667000",
          "content": "<p><code>wdir = # Path to your drive</code>\n<code>last = wdir + 'last.pt'</code>\n<code>best = wdir + 'best.pt'</code>\n<code>results_file =  wdir + 'results.txt'</code>\nThats it <a href=\"/drjoeroberts\">@drjoeroberts</a>  and <a href=\"/stevenyin\">@stevenyin</a> </p>",
          "votes": 1,
          "replies": []
        },
        {
          "id": 910024,
          "author_name": "Nitin Datta",
          "author_url": "",
          "post_date": "2020-07-01T01:19:13.827000",
          "content": "<p>Hi <a href=\"/ljjsfe\">@ljjsfe</a>, According to my knowledge we do not have to bother about freezing in yolov5...\nSorry for the late reply :)</p>",
          "votes": 0,
          "replies": []
        },
        {
          "id": 910487,
          "author_name": "Joe Roberts",
          "author_url": "",
          "post_date": "2020-07-01T07:08:48.353000",
          "content": "<p>Hi <a href=\"/nitindatta\">@nitindatta</a> - this was very useful, many thanks. I was basically there but had missed <code>results_file = wdir + 'results.txt'</code>. I appreciate your help!</p>",
          "votes": 1,
          "replies": []
        },
        {
          "id": 910502,
          "author_name": "J Seb",
          "author_url": "",
          "post_date": "2020-07-01T07:18:51.157000",
          "content": "<p>Hi <a href=\"/nitindatta\">@nitindatta</a>, Thanks for the detailed information, useful for beginners.</p>",
          "votes": 1,
          "replies": []
        },
        {
          "id": 910545,
          "author_name": "",
          "author_url": "",
          "post_date": "2020-07-01T07:51:46.327000",
          "content": "",
          "votes": 0,
          "replies": []
        },
        {
          "id": 910577,
          "author_name": "Yang Lin",
          "author_url": "",
          "post_date": "2020-07-01T08:18:00.700000",
          "content": "<p>Yeah. Thank you. I came across the source code of it and feel really surprised. Maybe it hides some trick in some parts. :)</p>",
          "votes": 0,
          "replies": []
        },
        {
          "id": 911291,
          "author_name": "Nitin Datta",
          "author_url": "",
          "post_date": "2020-07-01T16:39:23.600000",
          "content": "<p>Thank you <a href=\"/sebastianji\">@sebastianji</a> \nHappy to help</p>",
          "votes": 0,
          "replies": []
        }
      ]
    },
    {
      "id": 897337,
      "author_name": "",
      "author_url": "",
      "post_date": "2020-06-22T19:34:40.767000",
      "content": "",
      "votes": -1,
      "replies": [
        {
          "id": 897363,
          "author_name": "Matt",
          "author_url": "",
          "post_date": "2020-06-22T19:57:15.480000",
          "content": "<p>Copy-pasting a generic summary of YOLO isn't a great way to answer a genuine question..</p>\n\n<p>Edit: Thanks for realizing your mistake and editing your response but it still never answered her question. Sorry bud, no free karma today 😆 </p>",
          "votes": 1,
          "replies": []
        },
        {
          "id": 897504,
          "author_name": "",
          "author_url": "",
          "post_date": "2020-06-22T23:02:52.797000",
          "content": "",
          "votes": -2,
          "replies": []
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "904508": "Hi @aishwaryapalit \nAs some of the top contenders are using yolov5 you could check out their notebooks. \nSome of them are: \nby @orkatz2 [https://www.kaggle.com/orkatz2/yolov5-train]\nthis is the training model which you can use and improve on it on colab. In this all the details are given... \n\nfor testing there is a great notebook with tta+single flip-ud and combination of scale and flip-ud by @wasupandceacar [https://www.kaggle.com/wasupandceacar/yolov5-single-model-with-more-tta-lb-0-745]\n\nHope this helps...",
    "896372": "How can i get weights and config file of yolo in kaggle?",
    "897640": "Yolo Config file : https://github.com/AlexeyAB/darknet/tree/master/cfg\nYolo Weights : https://github.com/AlexeyAB/darknet#how-to-train-to-detect-your-custom-objects\n\nChanges need to be done in Yolo config file : https://github.com/AlexeyAB/darknet#how-to-train-to-detect-your-custom-objects",
    "916973": "yolov5",
    "903920": "Hi @aishwaryapalit  I've trained a yolo model, but I can't use it to inference on Kaggle kernel, did you succeed?",
    "897337": ""
  }
}