{
  "id": 300768,
  "title": "Use timm pretrained backbones for you FasterRCNN!",
  "url": "/competitions/tensorflow-great-barrier-reef/discussion/300768",
  "author_name": "",
  "post_date": "2022-01-14T07:15:43.493821Z",
  "votes": 22,
  "comment_count": 25,
  "views": 0,
  "content": "<p>As I was experimenting with FasterRcnn, I wanted to test with different backbones, and when we think about pretrained backbones, first thing that comes to us is \"timm\"!!<br>\nso why not use it?<br>\nBut since timm was not compatible with PyTorch's fasterrcnn OD model directly. I had to manually add FPN to it to maker the backbone work.<br>\nHere is the code I was working <a href=\"https://github.com/mrinath123/timmFasterRcnn\" target=\"_blank\">https://github.com/mrinath123/timmFasterRcnn</a><br>\nit's only for effb3 and densenet 121 now, we can add any model we want, just add the features we want to extract from in the model_config.py<br>\nAfter declaring the backbone we can just use it in our FasterRcnn, like<br>\n<code>model = FasterRCNN(backbone,**kwargs)</code><br>\nHere is a sample notebook <a href=\"https://www.kaggle.com/mrinath/hacking-fasterrcnn/notebook\" target=\"_blank\">https://www.kaggle.com/mrinath/hacking-fasterrcnn/notebook</a><br>\nDo comment on what you think, and if it improves your results or not.<br>\nThanks</p>",
  "messages": [
    {
      "id": "1649307",
      "postDate": "01/14/2022 07:15:43",
      "content": "<p>As I was experimenting with FasterRcnn, I wanted to test with different backbones, and when we think about pretrained backbones, first thing that comes to us is \"timm\"!!<br>\nso why not use it?<br>\nBut since timm was not compatible with PyTorch's fasterrcnn OD model directly. I had to manually add FPN to it to maker the backbone work.<br>\nHere is the code I was working <a href=\"https://github.com/mrinath123/timmFasterRcnn\" target=\"_blank\">https://github.com/mrinath123/timmFasterRcnn</a><br>\nit's only for effb3 and densenet 121 now, we can add any model we want, just add the features we want to extract from in the model_config.py<br>\nAfter declaring the backbone we can just use it in our FasterRcnn, like<br>\n<code>model = FasterRCNN(backbone,**kwargs)</code><br>\nHere is a sample notebook <a href=\"https://www.kaggle.com/mrinath/hacking-fasterrcnn/notebook\" target=\"_blank\">https://www.kaggle.com/mrinath/hacking-fasterrcnn/notebook</a><br>\nDo comment on what you think, and if it improves your results or not.<br>\nThanks</p>",
      "rawMarkdown": "As I was experimenting with FasterRcnn, I wanted to test with different backbones, and when we think about pretrained backbones, first thing that comes to us is \"timm\"!!\nso why not use it?\nBut since timm was not compatible with PyTorch's fasterrcnn OD model directly. I had to manually add FPN to it to maker the backbone work.\nHere is the code I was working https://github.com/mrinath123/timmFasterRcnn\nit's only for effb3 and densenet 121 now, we can add any model we want, just add the features we want to extract from in the model_config.py\nAfter declaring the backbone we can just use it in our FasterRcnn, like\n`model = FasterRCNN(backbone,**kwargs)`\nHere is a sample notebook https://www.kaggle.com/mrinath/hacking-fasterrcnn/notebook\nDo comment on what you think, and if it improves your results or not.\nThanks",
      "votes": null
    },
    {
      "id": "1649331",
      "postDate": "01/14/2022 07:50:07",
      "content": "<p>Wow, this is a really great solution. Thank you for sharing.<br>\nI was wondering if the pretrained = True also works in your code [I saw you were using pretrained = False].</p>",
      "rawMarkdown": "Wow, this is a really great solution. Thank you for sharing.\nI was wondering if the pretrained = True also works in your code [I saw you were using pretrained = False].",
      "votes": null
    },
    {
      "id": "1649333",
      "postDate": "01/14/2022 07:53:39",
      "content": "<p>I used both true and false in the example<br>\nTrue for effnet<br>\nFalse for densenet </p>",
      "rawMarkdown": "I used both true and false in the example\nTrue for effnet\nFalse for densenet",
      "votes": null
    },
    {
      "id": "1649338",
      "postDate": "01/14/2022 07:59:32",
      "content": "<p>That's great ^_^<br>\nI was seeing the code from the attached NB. there it was <code>\"efficientnet_b3\", pretrained=False</code>. That's why I asked, I'm sorry about that. I also have some other doubts. I may get back to you with those😅. Thank you for tolerating me.</p>",
      "rawMarkdown": "That's great ^_^\nI was seeing the code from the attached NB. there it was `\"efficientnet_b3\", pretrained=False`. That's why I asked, I'm sorry about that. I also have some other doubts. I may get back to you with those😅. Thank you for tolerating me.",
      "votes": null
    },
    {
      "id": "1649346",
      "postDate": "01/14/2022 08:12:40",
      "content": "<p>Cool post! Thank you! </p>",
      "rawMarkdown": "Cool post! Thank you!",
      "votes": null
    },
    {
      "id": "1650160",
      "postDate": "01/14/2022 21:16:00",
      "content": "<p>Hi <a href=\"https://www.kaggle.com/remekkinas\" target=\"_blank\">@remekkinas</a>, Your team was at the top for a while[still inside the money range] and with a good LB score, but the recent high-resolution image NB by sheep GM, makes it seem like the competition has become a hardware war. I just want to ask, were you guys only getting those high LB by building efficient models up till now, or did you guys were also using the high-resolution images to get those high LB scores?</p>\n<p>Listening, that you folks were up there till now, only on the basis of efficiently trained models will give me some hope for this comp[I'm relying only on kaggle].</p>\n<p>Thank you so much.</p>",
      "rawMarkdown": "Hi @remekkinas, Your team was at the top for a while[still inside the money range] and with a good LB score, but the recent high-resolution image NB by sheep GM, makes it seem like the competition has become a hardware war. I just want to ask, were you guys only getting those high LB by building efficient models up till now, or did you guys were also using the high-resolution images to get those high LB scores?\n\nListening, that you folks were up there till now, only on the basis of efficiently trained models will give me some hope for this comp[I'm relying only on kaggle].\n\nThank you so much.",
      "votes": null
    },
    {
      "id": "1650181",
      "postDate": "01/14/2022 21:42:30",
      "content": "<p><a href=\"https://www.kaggle.com/soumya9977\" target=\"_blank\">@soumya9977</a> believe me, I was very surprised by the fact that we were at TOP1 for 15 days. I watched at LB every day and couldn't believe it. The more that we shared (contributed) a lot in this competition (YoloX, YoloR). For me, it is not a problem to fall in the ranking because my motivation is not money but fun and learning (I earn professionally by doing commercial AI projects in computer vision mainly - Kaggle is for relaxation, learning and fun (I spend my free time in places where is fun … no fun … there is no Remek). Kaggle is not a place to earn money for me. And I know that there are many who are much more experienced and better than me, but … I try to compete (this motivate me to look for solutions and ways of problem sovling) and learn from them the best practices. Unfortunately, it's hard because few people want to share … I'm slowly understanding why this is so. 😂</p>\n<p>Our solution does not need high computing power. We work on Colab Pro+ but … you can easily run it on a laptop with GPU (I have Dell Allienware r17 with RTX3080) or regular Colab. Of course, if someone has more computing power (better GPU - a huge difference is even the RTX 3090), it will be much easier (especially with resizing … or faster training - you can experiment more). We had to work hard to get this effect. I am sure … and you can trust me in 100% that you can train model using Colab / Kaggle GPU and jump over our team score. I am sure :)</p>\n<p>BTW:<br>\nyour notebook - learing to see underwater is great …. I have read it many, many times … and learned a lot. Certainly voted because this is really great example of contributing and helping people to grow. Excellent work mate!</p>",
      "rawMarkdown": "soumya9977 believe me, I was very surprised by the fact that we were at TOP1 for 15 days. I watched at LB every day and couldn't believe it. The more that we shared (contributed) a lot in this competition (YoloX, YoloR). For me, it is not a problem to fall in the ranking because my motivation is not money but fun and learning (I earn professionally by doing commercial AI projects in computer vision mainly - Kaggle is for relaxation, learning and fun (I spend my free time in places where is fun ... no fun ... there is no Remek). Kaggle is not a place to earn money for me. And I know that there are many who are much more experienced and better than me, but ... I try to compete (this motivate me to look for solutions and ways of problem sovling) and learn from them the best practices. Unfortunately, it's hard because few people want to share ... I'm slowly understanding why this is so. 😂\n\nOur solution does not need high computing power. We work on Colab Pro+ but ... you can easily run it on a laptop with GPU (I have Dell Allienware r17 with RTX3080) or regular Colab. Of course, if someone has more computing power (better GPU - a huge difference is even the RTX 3090), it will be much easier (especially with resizing ... or faster training - you can experiment more). We had to work hard to get this effect. I am sure ... and you can trust me in 100% that you can train model using Colab / Kaggle GPU and jump over our team score. I am sure :)\n\nBTW:\nyour notebook - learing to see underwater is great .... I have read it many, many times ... and learned a lot. Certainly voted because this is really great example of contributing and helping people to grow. Excellent work mate!",
      "votes": null
    },
    {
      "id": "1650203",
      "postDate": "01/14/2022 22:13:44",
      "content": "<p>I agree with you <a href=\"https://www.kaggle.com/remekkinas\" target=\"_blank\">@remekkinas</a> , many of us are here to learn. Competing for me is a learning experience and in Kaggle my learning curve is exponential. </p>\n<p>It's amazing how much I learn in such a short time. Now I feel like I have superpowers to do a lot of things. Today I no longer see the limit of where I can reach</p>",
      "rawMarkdown": "I agree with you @remekkinas , many of us are here to learn. Competing for me is a learning experience and in Kaggle my learning curve is exponential. \n\nIt's amazing how much I learn in such a short time. Now I feel like I have superpowers to do a lot of things. Today I no longer see the limit of where I can reach",
      "votes": null
    },
    {
      "id": "1650209",
      "postDate": "01/14/2022 22:27:26",
      "content": "<p><a href=\"https://www.kaggle.com/robsonsan\" target=\"_blank\">@robsonsan</a> I am really happy reading such great post! Certainly winning is important :) :) and I am sure somebody,  smart person, will win (no 25 GPU will be required) and show us solution … and this (for somebody who spend time here and was looking for solutions) will be \"aha moment\" … but this is part of learning and growing. </p>\n<p>I keep my finger crossed for your progress!</p>",
      "rawMarkdown": "robsonsan I am really happy reading such great post! Certainly winning is important :) :) and I am sure somebody,  smart person, will win (no 25 GPU will be required) and show us solution ... and this (for somebody who spend time here and was looking for solutions) will be \"aha moment\" ... but this is part of learning and growing. \n\nI keep my finger crossed for your progress!",
      "votes": null
    },
    {
      "id": "1650210",
      "postDate": "01/14/2022 22:27:31",
      "content": "<p>I started doing Kaggle with the sartorius comp, and from there and also in other comps, I did not see anybody but you from the top of the LB is being that much active on the discussion and code section of a comp, on top of that you are always very nice and friendly in the discussions. There is no fun if a person only shows up in the LB and nowhere else [discussion/code]. After all, we come here to learn from each other. It's true that we are also competing against each other but converging on an optimal solution by discussing different approaches with others, will always help to serve the purpose of hosting a comp. And seeing some simple but elegant solutions is always great, rather than some solution with 15 models ensembled and 10 days of training. </p>\n<p>Thank you <a href=\"https://www.kaggle.com/remekkinas\" target=\"_blank\">@remekkinas</a> for clearing that doubt. your answer will surely keep me going with the comp, not really sure about getting as high LB as you folks but I will surely try.</p>\n<p>Thank you so much, for looking into that NB, I learned a lot from your NBs too. Many people asked me if those enhancements from my NB gave any performance boost or not. But It seemed like most of the people who tried that, did not get any improvement, rather their LB score went down. Is this also the same story with you?</p>",
      "rawMarkdown": "I started doing Kaggle with the sartorius comp, and from there and also in other comps, I did not see anybody but you from the top of the LB is being that much active on the discussion and code section of a comp, on top of that you are always very nice and friendly in the discussions. There is no fun if a person only shows up in the LB and nowhere else [discussion/code]. After all, we come here to learn from each other. It's true that we are also competing against each other but converging on an optimal solution by discussing different approaches with others, will always help to serve the purpose of hosting a comp. And seeing some simple but elegant solutions is always great, rather than some solution with 15 models ensembled and 10 days of training. \n\nThank you @remekkinas for clearing that doubt. your answer will surely keep me going with the comp, not really sure about getting as high LB as you folks but I will surely try.\n\nThank you so much, for looking into that NB, I learned a lot from your NBs too. Many people asked me if those enhancements from my NB gave any performance boost or not. But It seemed like most of the people who tried that, did not get any improvement, rather their LB score went down. Is this also the same story with you?",
      "votes": null
    },
    {
      "id": "1650218",
      "postDate": "01/14/2022 22:42:04",
      "content": "<p>Thank you for your words.</p>\n<p>I am sure you are able to jump. </p>\n<p>We have 30 days to finish. You will see how this competition will change soon … :) First LB attack was performed. Was ok …. but … this is only part of puzzle. I am sure everything on LB will change soon (we drop a lot somebody … will go up - this is competition and this is normal … and we should congratulate everybody for progressing ). We (our team) is looking for better solution as well (we have many ideas \"in progress\"). Even more I can see that this strategy (resizing) is often poorly developed :) But I do not tell why …. I will tell this after competition (I thnink that many of us will be suprised). </p>\n<p>Tips presented by you are great. Can be benefitial but …. to boost performance you have to use it in good way. I saw notebook which uses your discovery and unfortunately in way … neural network won't benefit from it.  </p>",
      "rawMarkdown": "Thank you for your words.\n\nI am sure you are able to jump. \n\nWe have 30 days to finish. You will see how this competition will change soon ... :) First LB attack was performed. Was ok .... but ... this is only part of puzzle. I am sure everything on LB will change soon (we drop a lot somebody ... will go up - this is competition and this is normal ... and we should congratulate everybody for progressing ). We (our team) is looking for better solution as well (we have many ideas \"in progress\"). Even more I can see that this strategy (resizing) is often poorly developed :) But I do not tell why .... I will tell this after competition (I thnink that many of us will be suprised). \n\nTips presented by you are great. Can be benefitial but .... to boost performance you have to use it in good way. I saw notebook which uses your discovery and unfortunately in way ... neural network won't benefit from it.",
      "votes": null
    },
    {
      "id": "1650225",
      "postDate": "01/14/2022 23:01:29",
      "content": "<p><code>Tips presented by you are great. Can be benefitial but …. to boost performance you have to use it in good way. I saw notebook which uses your discovery and unfortunately in way … neural network won't benefit from it.</code></p>\n<p>I understand what you are talking about, having preprocessing step is good but making those processed images work with the NN can be difficult. </p>\n<p><code>resizing is often poorly developed</code> the reason might be something to do with a model generalization or the test image is smaller than the images it's trained on. Will be waiting to hear the reason. </p>\n<p>Thank you again for responding.</p>",
      "rawMarkdown": "`Tips presented by you are great. Can be benefitial but …. to boost performance you have to use it in good way. I saw notebook which uses your discovery and unfortunately in way … neural network won't benefit from it.`\n\nI understand what you are talking about, having preprocessing step is good but making those processed images work with the NN can be difficult. \n\n`resizing is often poorly developed` the reason might be something to do with a model generalization or the test image is smaller than the images it's trained on. Will be waiting to hear the reason. \n\nThank you again for responding.",
      "votes": null
    },
    {
      "id": "1650234",
      "postDate": "01/14/2022 23:10:11",
      "content": "<p>Sometimes …. we have to change mindest :) Sometimes photos that are better for humans don't mean they are better for computers … but usually … using augumented data during the training you can push model to generalize better. </p>\n<p>Resizing … :) later … :) I am watching what will happen soon …. :) </p>",
      "rawMarkdown": "Sometimes .... we have to change mindest :) Sometimes photos that are better for humans don't mean they are better for computers ... but usually ... using augumented data during the training you can push model to generalize better. \n\nResizing ... :) later ... :) I am watching what will happen soon .... :)",
      "votes": null
    },
    {
      "id": "1651425",
      "postDate": "01/15/2022 18:31:35",
      "content": "<p>Hi <a href=\"https://www.kaggle.com/mrinath\" target=\"_blank\">@mrinath</a> did you try the code with dataloader?<br>\nIm only using 400 images with 4 batch size for training but its still giving me <code>cuda OOM</code>. <br>\n<code>RuntimeError: CUDA out of memory. Tried to allocate 158.00 MiB (GPU 0; 15.90 GiB total capacity; 14.85 GiB already allocated; 95.75 MiB free; 14.97 GiB reserved in total by PyTorch)</code></p>\n<p>I couldn't find any solution to this problem. please let me know if there is any way out. I don't understand, is that a problem from my side or something is wrong in the code.</p>\n<p>PS: I was using efficientnet_b3 for the model.</p>",
      "rawMarkdown": "Hi @mrinath did you try the code with dataloader?\nIm only using 400 images with 4 batch size for training but its still giving me `cuda OOM`. \n`RuntimeError: CUDA out of memory. Tried to allocate 158.00 MiB (GPU 0; 15.90 GiB total capacity; 14.85 GiB already allocated; 95.75 MiB free; 14.97 GiB reserved in total by PyTorch)`\n\nI couldn't find any solution to this problem. please let me know if there is any way out. I don't understand, is that a problem from my side or something is wrong in the code.\n\nPS: I was using efficientnet_b3 for the model.",
      "votes": null
    },
    {
      "id": "1651439",
      "postDate": "01/15/2022 18:38:37",
      "content": "<p>Have you tried decrease batch size to 2? It looks like magic number 4 for your res is too much for your magic GPU :)</p>",
      "rawMarkdown": "Have you tried decrease batch size to 2? It looks like magic number 4 for your res is too much for your magic GPU :)",
      "votes": null
    },
    {
      "id": "1651450",
      "postDate": "01/15/2022 18:51:40",
      "content": "<p>Nah I was using good old 1280x720 😅, but changing to batch_size to 2 made the code work. I should have tried decreasing the batch size.</p>\n<p>Thank you so much <a href=\"https://www.kaggle.com/remekkinas\" target=\"_blank\">@remekkinas</a> 🤗</p>",
      "rawMarkdown": "Nah I was using good old 1280x720 😅, but changing to batch_size to 2 made the code work. I should have tried decreasing the batch size.\n\nThank you so much @remekkinas 🤗",
      "votes": null
    },
    {
      "id": "1651451",
      "postDate": "01/15/2022 18:54:59",
      "content": "<p>👍👍👍 good! Have a nice model and .. jump!</p>",
      "rawMarkdown": "👍👍👍 good! Have a nice model and .. jump!",
      "votes": null
    },
    {
      "id": "1651461",
      "postDate": "01/15/2022 19:03:58",
      "content": "<p>Yes thats a something related to how much your GPU can handle, I would have given the same suggestion as <a href=\"https://www.kaggle.com/remekkinas\" target=\"_blank\">@remekkinas</a>, to decrease the batch size, or decrease the image size(which will be not good)</p>",
      "rawMarkdown": "Yes thats a something related to how much your GPU can handle, I would have given the same suggestion as @remekkinas, to decrease the batch size, or decrease the image size(which will be not good)",
      "votes": null
    },
    {
      "id": "1653722",
      "postDate": "01/17/2022 20:10:10",
      "content": "<p>UPDATE:<br>\nAdded all the efficientnet family config in the model_config.py file<br>\n(from effnetb3 to effnetb7)<br>\nHope it is helping</p>",
      "rawMarkdown": "UPDATE:\nAdded all the efficientnet family config in the model_config.py file\n(from effnetb3 to effnetb7)\nHope it is helping",
      "votes": null
    },
    {
      "id": "1654061",
      "postDate": "01/18/2022 05:37:08",
      "content": "<p>thanks for sharing</p>",
      "rawMarkdown": "thanks for sharing",
      "votes": null
    },
    {
      "id": "1654065",
      "postDate": "01/18/2022 05:40:55",
      "content": "<p><a href=\"https://www.kaggle.com/remekkinas\" target=\"_blank\">@remekkinas</a> you have been a great support in this competition. We need someone like you in every competition 😅. At some point, I thought you guys would win easily, now it got tricky as it got resource-hungry competition.</p>",
      "rawMarkdown": "remekkinas you have been a great support in this competition. We need someone like you in every competition 😅. At some point, I thought you guys would win easily, now it got tricky as it got resource-hungry competition.",
      "votes": null
    },
    {
      "id": "1654178",
      "postDate": "01/18/2022 08:42:12",
      "content": "<p>Thank you very much for your words. I really like this competition :) </p>\n<p>Unfortunately, the biggest problem currently is validating the model. Certainly, we are still fighting. If it turns out that you really had to have a lot of GPU to win, we had no chance of winning anyway. We look for progress only … not for medals, winning, $$$. Enjoy progress!  </p>",
      "rawMarkdown": "Thank you very much for your words. I really like this competition :) \n\nUnfortunately, the biggest problem currently is validating the model. Certainly, we are still fighting. If it turns out that you really had to have a lot of GPU to win, we had no chance of winning anyway. We look for progress only ... not for medals, winning, $$$. Enjoy progress!",
      "votes": null
    },
    {
      "id": "1654182",
      "postDate": "01/18/2022 08:47:50",
      "content": "<p>My advice would be team up with someone who has access to A100 or 32GB V100s ;)</p>",
      "rawMarkdown": "My advice would be team up with someone who has access to A100 or 32GB V100s ;)",
      "votes": null
    },
    {
      "id": "1654185",
      "postDate": "01/18/2022 08:49:34",
      "content": "<p>You are right …. :)</p>",
      "rawMarkdown": "You are right .... :)",
      "votes": null
    },
    {
      "id": "1657144",
      "postDate": "01/20/2022 00:20:26",
      "content": "<p>I wonder .. What's the benefit of using backbone? I didn't use the backbone yet. Was that improve the lb much?? </p>",
      "rawMarkdown": "I wonder .. What's the benefit of using backbone? I didn't use the backbone yet. Was that improve the lb much??",
      "votes": null
    },
    {
      "id": "1657201",
      "postDate": "01/20/2022 02:40:32",
      "content": "<p>The fasterrcnn uses a CNN network to extract features which then are used further to detect objects in the image.<br>\nThis CNN model can be anything, you can make your own too!<br>\nBut why make something from scratch when we already have pretrained backbones right, this backbones are cnn networks which help us to get features </p>",
      "rawMarkdown": "The fasterrcnn uses a CNN network to extract features which then are used further to detect objects in the image.\nThis CNN model can be anything, you can make your own too!\nBut why make something from scratch when we already have pretrained backbones right, this backbones are cnn networks which help us to get features",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 1649331,
      "author_name": "soumya9977",
      "author_url": "",
      "post_date": "01/14/2022 07:50:07",
      "content": "<p>Wow, this is a really great solution. Thank you for sharing.<br>\nI was wondering if the pretrained = True also works in your code [I saw you were using pretrained = False].</p>",
      "votes": null,
      "replies": [
        {
          "id": 1649333,
          "author_name": "mrinath",
          "author_url": "",
          "post_date": "01/14/2022 07:53:39",
          "content": "<p>I used both true and false in the example<br>\nTrue for effnet<br>\nFalse for densenet </p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1649338,
          "author_name": "soumya9977",
          "author_url": "",
          "post_date": "01/14/2022 07:59:32",
          "content": "<p>That's great ^_^<br>\nI was seeing the code from the attached NB. there it was <code>\"efficientnet_b3\", pretrained=False</code>. That's why I asked, I'm sorry about that. I also have some other doubts. I may get back to you with those😅. Thank you for tolerating me.</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1651425,
          "author_name": "soumya9977",
          "author_url": "",
          "post_date": "01/15/2022 18:31:35",
          "content": "<p>Hi <a href=\"https://www.kaggle.com/mrinath\" target=\"_blank\">@mrinath</a> did you try the code with dataloader?<br>\nIm only using 400 images with 4 batch size for training but its still giving me <code>cuda OOM</code>. <br>\n<code>RuntimeError: CUDA out of memory. Tried to allocate 158.00 MiB (GPU 0; 15.90 GiB total capacity; 14.85 GiB already allocated; 95.75 MiB free; 14.97 GiB reserved in total by PyTorch)</code></p>\n<p>I couldn't find any solution to this problem. please let me know if there is any way out. I don't understand, is that a problem from my side or something is wrong in the code.</p>\n<p>PS: I was using efficientnet_b3 for the model.</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1651439,
          "author_name": "remekkinas",
          "author_url": "",
          "post_date": "01/15/2022 18:38:37",
          "content": "<p>Have you tried decrease batch size to 2? It looks like magic number 4 for your res is too much for your magic GPU :)</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1651450,
          "author_name": "soumya9977",
          "author_url": "",
          "post_date": "01/15/2022 18:51:40",
          "content": "<p>Nah I was using good old 1280x720 😅, but changing to batch_size to 2 made the code work. I should have tried decreasing the batch size.</p>\n<p>Thank you so much <a href=\"https://www.kaggle.com/remekkinas\" target=\"_blank\">@remekkinas</a> 🤗</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1651451,
          "author_name": "remekkinas",
          "author_url": "",
          "post_date": "01/15/2022 18:54:59",
          "content": "<p>👍👍👍 good! Have a nice model and .. jump!</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1651461,
          "author_name": "mrinath",
          "author_url": "",
          "post_date": "01/15/2022 19:03:58",
          "content": "<p>Yes thats a something related to how much your GPU can handle, I would have given the same suggestion as <a href=\"https://www.kaggle.com/remekkinas\" target=\"_blank\">@remekkinas</a>, to decrease the batch size, or decrease the image size(which will be not good)</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1654065,
          "author_name": "awsaf49",
          "author_url": "",
          "post_date": "01/18/2022 05:40:55",
          "content": "<p><a href=\"https://www.kaggle.com/remekkinas\" target=\"_blank\">@remekkinas</a> you have been a great support in this competition. We need someone like you in every competition 😅. At some point, I thought you guys would win easily, now it got tricky as it got resource-hungry competition.</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1654178,
          "author_name": "remekkinas",
          "author_url": "",
          "post_date": "01/18/2022 08:42:12",
          "content": "<p>Thank you very much for your words. I really like this competition :) </p>\n<p>Unfortunately, the biggest problem currently is validating the model. Certainly, we are still fighting. If it turns out that you really had to have a lot of GPU to win, we had no chance of winning anyway. We look for progress only … not for medals, winning, $$$. Enjoy progress!  </p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1654182,
          "author_name": "awsaf49",
          "author_url": "",
          "post_date": "01/18/2022 08:47:50",
          "content": "<p>My advice would be team up with someone who has access to A100 or 32GB V100s ;)</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1654185,
          "author_name": "remekkinas",
          "author_url": "",
          "post_date": "01/18/2022 08:49:34",
          "content": "<p>You are right …. :)</p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 1649346,
      "author_name": "remekkinas",
      "author_url": "",
      "post_date": "01/14/2022 08:12:40",
      "content": "<p>Cool post! Thank you! </p>",
      "votes": null,
      "replies": [
        {
          "id": 1650160,
          "author_name": "soumya9977",
          "author_url": "",
          "post_date": "01/14/2022 21:16:00",
          "content": "<p>Hi <a href=\"https://www.kaggle.com/remekkinas\" target=\"_blank\">@remekkinas</a>, Your team was at the top for a while[still inside the money range] and with a good LB score, but the recent high-resolution image NB by sheep GM, makes it seem like the competition has become a hardware war. I just want to ask, were you guys only getting those high LB by building efficient models up till now, or did you guys were also using the high-resolution images to get those high LB scores?</p>\n<p>Listening, that you folks were up there till now, only on the basis of efficiently trained models will give me some hope for this comp[I'm relying only on kaggle].</p>\n<p>Thank you so much.</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1650181,
          "author_name": "remekkinas",
          "author_url": "",
          "post_date": "01/14/2022 21:42:30",
          "content": "<p><a href=\"https://www.kaggle.com/soumya9977\" target=\"_blank\">@soumya9977</a> believe me, I was very surprised by the fact that we were at TOP1 for 15 days. I watched at LB every day and couldn't believe it. The more that we shared (contributed) a lot in this competition (YoloX, YoloR). For me, it is not a problem to fall in the ranking because my motivation is not money but fun and learning (I earn professionally by doing commercial AI projects in computer vision mainly - Kaggle is for relaxation, learning and fun (I spend my free time in places where is fun … no fun … there is no Remek). Kaggle is not a place to earn money for me. And I know that there are many who are much more experienced and better than me, but … I try to compete (this motivate me to look for solutions and ways of problem sovling) and learn from them the best practices. Unfortunately, it's hard because few people want to share … I'm slowly understanding why this is so. 😂</p>\n<p>Our solution does not need high computing power. We work on Colab Pro+ but … you can easily run it on a laptop with GPU (I have Dell Allienware r17 with RTX3080) or regular Colab. Of course, if someone has more computing power (better GPU - a huge difference is even the RTX 3090), it will be much easier (especially with resizing … or faster training - you can experiment more). We had to work hard to get this effect. I am sure … and you can trust me in 100% that you can train model using Colab / Kaggle GPU and jump over our team score. I am sure :)</p>\n<p>BTW:<br>\nyour notebook - learing to see underwater is great …. I have read it many, many times … and learned a lot. Certainly voted because this is really great example of contributing and helping people to grow. Excellent work mate!</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1650203,
          "author_name": "robsonsan",
          "author_url": "",
          "post_date": "01/14/2022 22:13:44",
          "content": "<p>I agree with you <a href=\"https://www.kaggle.com/remekkinas\" target=\"_blank\">@remekkinas</a> , many of us are here to learn. Competing for me is a learning experience and in Kaggle my learning curve is exponential. </p>\n<p>It's amazing how much I learn in such a short time. Now I feel like I have superpowers to do a lot of things. Today I no longer see the limit of where I can reach</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1650209,
          "author_name": "remekkinas",
          "author_url": "",
          "post_date": "01/14/2022 22:27:26",
          "content": "<p><a href=\"https://www.kaggle.com/robsonsan\" target=\"_blank\">@robsonsan</a> I am really happy reading such great post! Certainly winning is important :) :) and I am sure somebody,  smart person, will win (no 25 GPU will be required) and show us solution … and this (for somebody who spend time here and was looking for solutions) will be \"aha moment\" … but this is part of learning and growing. </p>\n<p>I keep my finger crossed for your progress!</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1650210,
          "author_name": "soumya9977",
          "author_url": "",
          "post_date": "01/14/2022 22:27:31",
          "content": "<p>I started doing Kaggle with the sartorius comp, and from there and also in other comps, I did not see anybody but you from the top of the LB is being that much active on the discussion and code section of a comp, on top of that you are always very nice and friendly in the discussions. There is no fun if a person only shows up in the LB and nowhere else [discussion/code]. After all, we come here to learn from each other. It's true that we are also competing against each other but converging on an optimal solution by discussing different approaches with others, will always help to serve the purpose of hosting a comp. And seeing some simple but elegant solutions is always great, rather than some solution with 15 models ensembled and 10 days of training. </p>\n<p>Thank you <a href=\"https://www.kaggle.com/remekkinas\" target=\"_blank\">@remekkinas</a> for clearing that doubt. your answer will surely keep me going with the comp, not really sure about getting as high LB as you folks but I will surely try.</p>\n<p>Thank you so much, for looking into that NB, I learned a lot from your NBs too. Many people asked me if those enhancements from my NB gave any performance boost or not. But It seemed like most of the people who tried that, did not get any improvement, rather their LB score went down. Is this also the same story with you?</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1650218,
          "author_name": "remekkinas",
          "author_url": "",
          "post_date": "01/14/2022 22:42:04",
          "content": "<p>Thank you for your words.</p>\n<p>I am sure you are able to jump. </p>\n<p>We have 30 days to finish. You will see how this competition will change soon … :) First LB attack was performed. Was ok …. but … this is only part of puzzle. I am sure everything on LB will change soon (we drop a lot somebody … will go up - this is competition and this is normal … and we should congratulate everybody for progressing ). We (our team) is looking for better solution as well (we have many ideas \"in progress\"). Even more I can see that this strategy (resizing) is often poorly developed :) But I do not tell why …. I will tell this after competition (I thnink that many of us will be suprised). </p>\n<p>Tips presented by you are great. Can be benefitial but …. to boost performance you have to use it in good way. I saw notebook which uses your discovery and unfortunately in way … neural network won't benefit from it.  </p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1650225,
          "author_name": "soumya9977",
          "author_url": "",
          "post_date": "01/14/2022 23:01:29",
          "content": "<p><code>Tips presented by you are great. Can be benefitial but …. to boost performance you have to use it in good way. I saw notebook which uses your discovery and unfortunately in way … neural network won't benefit from it.</code></p>\n<p>I understand what you are talking about, having preprocessing step is good but making those processed images work with the NN can be difficult. </p>\n<p><code>resizing is often poorly developed</code> the reason might be something to do with a model generalization or the test image is smaller than the images it's trained on. Will be waiting to hear the reason. </p>\n<p>Thank you again for responding.</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1650234,
          "author_name": "remekkinas",
          "author_url": "",
          "post_date": "01/14/2022 23:10:11",
          "content": "<p>Sometimes …. we have to change mindest :) Sometimes photos that are better for humans don't mean they are better for computers … but usually … using augumented data during the training you can push model to generalize better. </p>\n<p>Resizing … :) later … :) I am watching what will happen soon …. :) </p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 1653722,
      "author_name": "mrinath",
      "author_url": "",
      "post_date": "01/17/2022 20:10:10",
      "content": "<p>UPDATE:<br>\nAdded all the efficientnet family config in the model_config.py file<br>\n(from effnetb3 to effnetb7)<br>\nHope it is helping</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 1654061,
      "author_name": "awsaf49",
      "author_url": "",
      "post_date": "01/18/2022 05:37:08",
      "content": "<p>thanks for sharing</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 1657144,
      "author_name": "eugeneryu",
      "author_url": "",
      "post_date": "01/20/2022 00:20:26",
      "content": "<p>I wonder .. What's the benefit of using backbone? I didn't use the backbone yet. Was that improve the lb much?? </p>",
      "votes": null,
      "replies": [
        {
          "id": 1657201,
          "author_name": "mrinath",
          "author_url": "",
          "post_date": "01/20/2022 02:40:32",
          "content": "<p>The fasterrcnn uses a CNN network to extract features which then are used further to detect objects in the image.<br>\nThis CNN model can be anything, you can make your own too!<br>\nBut why make something from scratch when we already have pretrained backbones right, this backbones are cnn networks which help us to get features </p>",
          "votes": null,
          "replies": []
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "1649307": "As I was experimenting with FasterRcnn, I wanted to test with different backbones, and when we think about pretrained backbones, first thing that comes to us is \"timm\"!!\nso why not use it?\nBut since timm was not compatible with PyTorch's fasterrcnn OD model directly. I had to manually add FPN to it to maker the backbone work.\nHere is the code I was working https://github.com/mrinath123/timmFasterRcnn\nit's only for effb3 and densenet 121 now, we can add any model we want, just add the features we want to extract from in the model_config.py\nAfter declaring the backbone we can just use it in our FasterRcnn, like\n`model = FasterRCNN(backbone,**kwargs)`\nHere is a sample notebook https://www.kaggle.com/mrinath/hacking-fasterrcnn/notebook\nDo comment on what you think, and if it improves your results or not.\nThanks",
    "1649331": "Wow, this is a really great solution. Thank you for sharing.\nI was wondering if the pretrained = True also works in your code [I saw you were using pretrained = False].",
    "1649333": "I used both true and false in the example\nTrue for effnet\nFalse for densenet",
    "1649338": "That's great ^_^\nI was seeing the code from the attached NB. there it was `\"efficientnet_b3\", pretrained=False`. That's why I asked, I'm sorry about that. I also have some other doubts. I may get back to you with those😅. Thank you for tolerating me.",
    "1649346": "Cool post! Thank you!",
    "1650160": "Hi @remekkinas, Your team was at the top for a while[still inside the money range] and with a good LB score, but the recent high-resolution image NB by sheep GM, makes it seem like the competition has become a hardware war. I just want to ask, were you guys only getting those high LB by building efficient models up till now, or did you guys were also using the high-resolution images to get those high LB scores?\n\nListening, that you folks were up there till now, only on the basis of efficiently trained models will give me some hope for this comp[I'm relying only on kaggle].\n\nThank you so much.",
    "1650181": "soumya9977 believe me, I was very surprised by the fact that we were at TOP1 for 15 days. I watched at LB every day and couldn't believe it. The more that we shared (contributed) a lot in this competition (YoloX, YoloR). For me, it is not a problem to fall in the ranking because my motivation is not money but fun and learning (I earn professionally by doing commercial AI projects in computer vision mainly - Kaggle is for relaxation, learning and fun (I spend my free time in places where is fun ... no fun ... there is no Remek). Kaggle is not a place to earn money for me. And I know that there are many who are much more experienced and better than me, but ... I try to compete (this motivate me to look for solutions and ways of problem sovling) and learn from them the best practices. Unfortunately, it's hard because few people want to share ... I'm slowly understanding why this is so. 😂\n\nOur solution does not need high computing power. We work on Colab Pro+ but ... you can easily run it on a laptop with GPU (I have Dell Allienware r17 with RTX3080) or regular Colab. Of course, if someone has more computing power (better GPU - a huge difference is even the RTX 3090), it will be much easier (especially with resizing ... or faster training - you can experiment more). We had to work hard to get this effect. I am sure ... and you can trust me in 100% that you can train model using Colab / Kaggle GPU and jump over our team score. I am sure :)\n\nBTW:\nyour notebook - learing to see underwater is great .... I have read it many, many times ... and learned a lot. Certainly voted because this is really great example of contributing and helping people to grow. Excellent work mate!",
    "1650203": "I agree with you @remekkinas , many of us are here to learn. Competing for me is a learning experience and in Kaggle my learning curve is exponential. \n\nIt's amazing how much I learn in such a short time. Now I feel like I have superpowers to do a lot of things. Today I no longer see the limit of where I can reach",
    "1650209": "robsonsan I am really happy reading such great post! Certainly winning is important :) :) and I am sure somebody,  smart person, will win (no 25 GPU will be required) and show us solution ... and this (for somebody who spend time here and was looking for solutions) will be \"aha moment\" ... but this is part of learning and growing. \n\nI keep my finger crossed for your progress!",
    "1650210": "I started doing Kaggle with the sartorius comp, and from there and also in other comps, I did not see anybody but you from the top of the LB is being that much active on the discussion and code section of a comp, on top of that you are always very nice and friendly in the discussions. There is no fun if a person only shows up in the LB and nowhere else [discussion/code]. After all, we come here to learn from each other. It's true that we are also competing against each other but converging on an optimal solution by discussing different approaches with others, will always help to serve the purpose of hosting a comp. And seeing some simple but elegant solutions is always great, rather than some solution with 15 models ensembled and 10 days of training. \n\nThank you @remekkinas for clearing that doubt. your answer will surely keep me going with the comp, not really sure about getting as high LB as you folks but I will surely try.\n\nThank you so much, for looking into that NB, I learned a lot from your NBs too. Many people asked me if those enhancements from my NB gave any performance boost or not. But It seemed like most of the people who tried that, did not get any improvement, rather their LB score went down. Is this also the same story with you?",
    "1650218": "Thank you for your words.\n\nI am sure you are able to jump. \n\nWe have 30 days to finish. You will see how this competition will change soon ... :) First LB attack was performed. Was ok .... but ... this is only part of puzzle. I am sure everything on LB will change soon (we drop a lot somebody ... will go up - this is competition and this is normal ... and we should congratulate everybody for progressing ). We (our team) is looking for better solution as well (we have many ideas \"in progress\"). Even more I can see that this strategy (resizing) is often poorly developed :) But I do not tell why .... I will tell this after competition (I thnink that many of us will be suprised). \n\nTips presented by you are great. Can be benefitial but .... to boost performance you have to use it in good way. I saw notebook which uses your discovery and unfortunately in way ... neural network won't benefit from it.",
    "1650225": "`Tips presented by you are great. Can be benefitial but …. to boost performance you have to use it in good way. I saw notebook which uses your discovery and unfortunately in way … neural network won't benefit from it.`\n\nI understand what you are talking about, having preprocessing step is good but making those processed images work with the NN can be difficult. \n\n`resizing is often poorly developed` the reason might be something to do with a model generalization or the test image is smaller than the images it's trained on. Will be waiting to hear the reason. \n\nThank you again for responding.",
    "1650234": "Sometimes .... we have to change mindest :) Sometimes photos that are better for humans don't mean they are better for computers ... but usually ... using augumented data during the training you can push model to generalize better. \n\nResizing ... :) later ... :) I am watching what will happen soon .... :)",
    "1651425": "Hi @mrinath did you try the code with dataloader?\nIm only using 400 images with 4 batch size for training but its still giving me `cuda OOM`. \n`RuntimeError: CUDA out of memory. Tried to allocate 158.00 MiB (GPU 0; 15.90 GiB total capacity; 14.85 GiB already allocated; 95.75 MiB free; 14.97 GiB reserved in total by PyTorch)`\n\nI couldn't find any solution to this problem. please let me know if there is any way out. I don't understand, is that a problem from my side or something is wrong in the code.\n\nPS: I was using efficientnet_b3 for the model.",
    "1651439": "Have you tried decrease batch size to 2? It looks like magic number 4 for your res is too much for your magic GPU :)",
    "1651450": "Nah I was using good old 1280x720 😅, but changing to batch_size to 2 made the code work. I should have tried decreasing the batch size.\n\nThank you so much @remekkinas 🤗",
    "1651451": "👍👍👍 good! Have a nice model and .. jump!",
    "1651461": "Yes thats a something related to how much your GPU can handle, I would have given the same suggestion as @remekkinas, to decrease the batch size, or decrease the image size(which will be not good)",
    "1653722": "UPDATE:\nAdded all the efficientnet family config in the model_config.py file\n(from effnetb3 to effnetb7)\nHope it is helping",
    "1654061": "thanks for sharing",
    "1654065": "remekkinas you have been a great support in this competition. We need someone like you in every competition 😅. At some point, I thought you guys would win easily, now it got tricky as it got resource-hungry competition.",
    "1654178": "Thank you very much for your words. I really like this competition :) \n\nUnfortunately, the biggest problem currently is validating the model. Certainly, we are still fighting. If it turns out that you really had to have a lot of GPU to win, we had no chance of winning anyway. We look for progress only ... not for medals, winning, $$$. Enjoy progress!",
    "1654182": "My advice would be team up with someone who has access to A100 or 32GB V100s ;)",
    "1654185": "You are right .... :)",
    "1657144": "I wonder .. What's the benefit of using backbone? I didn't use the backbone yet. Was that improve the lb much??",
    "1657201": "The fasterrcnn uses a CNN network to extract features which then are used further to detect objects in the image.\nThis CNN model can be anything, you can make your own too!\nBut why make something from scratch when we already have pretrained backbones right, this backbones are cnn networks which help us to get features"
  },
  "source": "meta"
}