{
  "id": 209325,
  "title": "TF Object Detection API for Faster RCNN ",
  "url": "/competitions/vinbigdata-chest-xray-abnormalities-detection/discussion/209325",
  "author_name": "Zain Ahmed",
  "post_date": "2021-01-07T06:27:01.260000",
  "votes": 4,
  "comment_count": 7,
  "views": 0,
  "content": "<p>Hello everyone, <br>\nI want to try Faster RCNN on the dataset.  Is there a reliable guide to use TF Object Detection API with kaggle. I could not install the API on kaggle kernel despite following the instructions. Have any of you tried it? </p>\n<p>Has anyone use this API on kaggle recently? <br>\nWhat are some other reliable ways for using object detection algorithms in TF 2.0. </p>",
  "messages": [
    {
      "id": 1142276,
      "postDate": "2021-01-07T09:19:18.713Z",
      "content": "<p>Hi <a href=\"https://www.kaggle.com/zainahmedsharif\" target=\"_blank\">@zainahmedsharif</a> , I'm trying to use TF 2.0 Object Detection API for this competition too. Following the <a href=\"https://tensorflow-object-detection-api-tutorial.readthedocs.io/en/latest/training.html\" target=\"_blank\">tutorial</a> on the docs is enough to setup a training/evaluation pipeline.  I'm actually diving deep into it in order to understand how to customize my detector.</p>\n<p>In my experiments I've found that in order to install object detection api on kaggle kernels and use it on GPU, you should point out to a version that does not requires tf 2.4.0, as this would cause tensorflow to not detect the GPU at all because of CUDA version mismatch. FYI I'm using <a href=\"https://github.com/tensorflow/models/tree/3f6fe2aa410d901aae8829597a65d084bffc20d3\" target=\"_blank\">this version</a> (i.e. commit 3f6fe2aa410d901aae8829597a65d084bffc20d3, dated 13 Aug 2020), but you can select any version from the tree.</p>\n<p>You can install api with the following code snippet:</p>\n<pre><code>git clone https://github.com/tensorflow/models.git\n\ncd models/research/\n\n# Reset git head to the sha-1 of the version you want to install\ngit reset --hard 3f6fe2aa410d901aae8829597a65d084bffc20d3\n\nprotoc object_detection/protos/*.proto --python_out=.\n\ncp object_detection/packages/tf2/setup.py .\npython -m pip install . \n</code></pre>\n<p>In order to use OD Api, you should:</p>\n<ul>\n<li>Install OD API (with the code snippet provided above)</li>\n<li><a href=\"https://www.kaggle.com/doanquanvietnamca/tfrecords-create-from-dicom-to-image\" target=\"_blank\">Genrerate TFRecords</a></li>\n<li><a href=\"https://tensorflow-object-detection-api-tutorial.readthedocs.io/en/latest/training.html#preparing-the-workspace\" target=\"_blank\">Prepare the workspace</a></li>\n<li>Select your pre-trained model (e.g. faster-rcnn)</li>\n<li>Write config file for your model (hyperparameters, loss functions etc..)</li>\n<li>Train and Evaluate the model</li>\n</ul>",
      "rawMarkdown": "Hi @zainahmedsharif , I'm trying to use TF 2.0 Object Detection API for this competition too. Following the [tutorial](https://tensorflow-object-detection-api-tutorial.readthedocs.io/en/latest/training.html) on the docs is enough to setup a training/evaluation pipeline.  I'm actually diving deep into it in order to understand how to customize my detector.\n\nIn my experiments I've found that in order to install object detection api on kaggle kernels and use it on GPU, you should point out to a version that does not requires tf 2.4.0, as this would cause tensorflow to not detect the GPU at all because of CUDA version mismatch. FYI I'm using [this version](https://github.com/tensorflow/models/tree/3f6fe2aa410d901aae8829597a65d084bffc20d3) (i.e. commit 3f6fe2aa410d901aae8829597a65d084bffc20d3, dated 13 Aug 2020), but you can select any version from the tree.\n\nYou can install api with the following code snippet:\n\n```\ngit clone https://github.com/tensorflow/models.git\n\ncd models/research/\n\n# Reset git head to the sha-1 of the version you want to install\ngit reset --hard 3f6fe2aa410d901aae8829597a65d084bffc20d3\n\nprotoc object_detection/protos/*.proto --python_out=.\n\ncp object_detection/packages/tf2/setup.py .\npython -m pip install . \n```\n\nIn order to use OD Api, you should:\n- Install OD API (with the code snippet provided above)\n- [Genrerate TFRecords] (https://www.kaggle.com/doanquanvietnamca/tfrecords-create-from-dicom-to-image)\n- [Prepare the workspace] (https://tensorflow-object-detection-api-tutorial.readthedocs.io/en/latest/training.html#preparing-the-workspace)\n- Select your pre-trained model (e.g. faster-rcnn)\n- Write config file for your model (hyperparameters, loss functions etc..)\n- Train and Evaluate the model",
      "votes": 4,
      "replies": [
        {
          "id": 1142281,
          "postDate": "2021-01-07T09:22:59.843Z",
          "content": "<p>I think there are other repositories or python libraries for object detection that uses tensorflow/keras as well, but I don't know any of them and would appreciate if someone points out something different</p>",
          "rawMarkdown": "I think there are other repositories or python libraries for object detection that uses tensorflow/keras as well, but I don't know any of them and would appreciate if someone points out something different"
        },
        {
          "id": 1153778,
          "postDate": "2021-01-15T06:42:32.437Z",
          "content": "<p>Sorry for a really late response. <br>\nThanks a lot for detailed answer. <br>\nI was trying to use the api on my jupyter notebook instead of kaggle kernel. It is a pain to setup all the dependencies. But I have yet to try it on kaggle kernel. <br>\nI will get back to you if I find some good repositories. </p>",
          "rawMarkdown": "Sorry for a really late response. \nThanks a lot for detailed answer. \nI was trying to use the api on my jupyter notebook instead of kaggle kernel. It is a pain to setup all the dependencies. But I have yet to try it on kaggle kernel. \nI will get back to you if I find some good repositories. ",
          "votes": 1
        }
      ]
    },
    {
      "id": 1142092,
      "postDate": "2021-01-07T06:27:01.260Z",
      "content": "<p>Hello everyone, <br>\nI want to try Faster RCNN on the dataset.  Is there a reliable guide to use TF Object Detection API with kaggle. I could not install the API on kaggle kernel despite following the instructions. Have any of you tried it? </p>\n<p>Has anyone use this API on kaggle recently? <br>\nWhat are some other reliable ways for using object detection algorithms in TF 2.0. </p>",
      "rawMarkdown": "Hello everyone, \nI want to try Faster RCNN on the dataset.  Is there a reliable guide to use TF Object Detection API with kaggle. I could not install the API on kaggle kernel despite following the instructions. Have any of you tried it? \n\nHas anyone use this API on kaggle recently? \nWhat are some other reliable ways for using object detection algorithms in TF 2.0. ",
      "votes": 4
    },
    {
      "id": 1153675,
      "postDate": "2021-01-15T04:40:34.180Z",
      "content": "<p>Hi <a href=\"https://www.kaggle.com/zainahmedsharif\" target=\"_blank\">@zainahmedsharif</a></p>\n<p>Please check out a notebook which presents the complete process of data preparation, training and inference using the TF2 Object Detection API for EfficientDet models. The notebook can be adapted to any other models in the Model Zoo including FasterRCNN with just 1-2 lines of code change. <br>\n<a href=\"https://www.kaggle.com/sreevishnudamodaran/vbd-efficientdet-tf2-object-detection-api-gpu\" target=\"_blank\">https://www.kaggle.com/sreevishnudamodaran/vbd-efficientdet-tf2-object-detection-api-gpu</a></p>\n<p>Hope it was helpful. Thanks👍🙂</p>",
      "rawMarkdown": "Hi @zainahmedsharif\n\nPlease check out a notebook which presents the complete process of data preparation, training and inference using the TF2 Object Detection API for EfficientDet models. The notebook can be adapted to any other models in the Model Zoo including FasterRCNN with just 1-2 lines of code change. \nhttps://www.kaggle.com/sreevishnudamodaran/vbd-efficientdet-tf2-object-detection-api-gpu\n\nHope it was helpful. Thanks👍🙂",
      "votes": 1,
      "replies": [
        {
          "id": 1153779,
          "postDate": "2021-01-15T06:42:58.863Z",
          "content": "<p>Thanks a lot. I will check it out.<br>\nReally appreciate your help. </p>",
          "rawMarkdown": "Thanks a lot. I will check it out.\nReally appreciate your help. ",
          "votes": 1
        },
        {
          "id": 1157006,
          "postDate": "2021-01-17T15:25:21.827Z",
          "content": "<p>Hi <a href=\"https://www.kaggle.com/zainahmedsharif\" target=\"_blank\">@zainahmedsharif</a>, I've published a <a href=\"https://www.kaggle.com/lazcoder/tf2-object-detection-api-efficientdet-b0\" target=\"_blank\">notebook</a> with a slightly different approach to object detection api, that should be more suitable for kaggle notebooks and should allow you to have more control on the whole training.</p>\n<p>It isn't detailed as <a href=\"https://www.kaggle.com/sreevishnudamodaran\" target=\"_blank\">@sreevishnudamodaran</a> work, but the idea is to provide a more in-deep approach to this API, and with both you should be able to implement your own detector as you wish.</p>\n<p>Hope this help to better understand how OD API works.</p>",
          "rawMarkdown": "Hi @zainahmedsharif, I've published a [notebook](https://www.kaggle.com/lazcoder/tf2-object-detection-api-efficientdet-b0) with a slightly different approach to object detection api, that should be more suitable for kaggle notebooks and should allow you to have more control on the whole training.\n\nIt isn't detailed as @sreevishnudamodaran work, but the idea is to provide a more in-deep approach to this API, and with both you should be able to implement your own detector as you wish.\n\nHope this help to better understand how OD API works.",
          "votes": 3
        },
        {
          "id": 1157576,
          "postDate": "2021-01-18T03:01:09.673Z",
          "content": "<p>Thanks man, I will check it out. </p>",
          "rawMarkdown": "Thanks man, I will check it out. "
        }
      ]
    }
  ],
  "comments": [
    {
      "id": 1142276,
      "author_name": "LAZCoder",
      "author_url": "",
      "post_date": "2021-01-07T09:19:18.713000",
      "content": "<p>Hi <a href=\"https://www.kaggle.com/zainahmedsharif\" target=\"_blank\">@zainahmedsharif</a> , I'm trying to use TF 2.0 Object Detection API for this competition too. Following the <a href=\"https://tensorflow-object-detection-api-tutorial.readthedocs.io/en/latest/training.html\" target=\"_blank\">tutorial</a> on the docs is enough to setup a training/evaluation pipeline.  I'm actually diving deep into it in order to understand how to customize my detector.</p>\n<p>In my experiments I've found that in order to install object detection api on kaggle kernels and use it on GPU, you should point out to a version that does not requires tf 2.4.0, as this would cause tensorflow to not detect the GPU at all because of CUDA version mismatch. FYI I'm using <a href=\"https://github.com/tensorflow/models/tree/3f6fe2aa410d901aae8829597a65d084bffc20d3\" target=\"_blank\">this version</a> (i.e. commit 3f6fe2aa410d901aae8829597a65d084bffc20d3, dated 13 Aug 2020), but you can select any version from the tree.</p>\n<p>You can install api with the following code snippet:</p>\n<pre><code>git clone https://github.com/tensorflow/models.git\n\ncd models/research/\n\n# Reset git head to the sha-1 of the version you want to install\ngit reset --hard 3f6fe2aa410d901aae8829597a65d084bffc20d3\n\nprotoc object_detection/protos/*.proto --python_out=.\n\ncp object_detection/packages/tf2/setup.py .\npython -m pip install . \n</code></pre>\n<p>In order to use OD Api, you should:</p>\n<ul>\n<li>Install OD API (with the code snippet provided above)</li>\n<li><a href=\"https://www.kaggle.com/doanquanvietnamca/tfrecords-create-from-dicom-to-image\" target=\"_blank\">Genrerate TFRecords</a></li>\n<li><a href=\"https://tensorflow-object-detection-api-tutorial.readthedocs.io/en/latest/training.html#preparing-the-workspace\" target=\"_blank\">Prepare the workspace</a></li>\n<li>Select your pre-trained model (e.g. faster-rcnn)</li>\n<li>Write config file for your model (hyperparameters, loss functions etc..)</li>\n<li>Train and Evaluate the model</li>\n</ul>",
      "votes": 4,
      "replies": [
        {
          "id": 1142281,
          "author_name": "LAZCoder",
          "author_url": "",
          "post_date": "2021-01-07T09:22:59.843000",
          "content": "<p>I think there are other repositories or python libraries for object detection that uses tensorflow/keras as well, but I don't know any of them and would appreciate if someone points out something different</p>",
          "votes": 0,
          "replies": []
        },
        {
          "id": 1153778,
          "author_name": "Zain Ahmed",
          "author_url": "",
          "post_date": "2021-01-15T06:42:32.437000",
          "content": "<p>Sorry for a really late response. <br>\nThanks a lot for detailed answer. <br>\nI was trying to use the api on my jupyter notebook instead of kaggle kernel. It is a pain to setup all the dependencies. But I have yet to try it on kaggle kernel. <br>\nI will get back to you if I find some good repositories. </p>",
          "votes": 1,
          "replies": []
        }
      ]
    },
    {
      "id": 1153675,
      "author_name": "Sreevishnu Damodaran",
      "author_url": "",
      "post_date": "2021-01-15T04:40:34.180000",
      "content": "<p>Hi <a href=\"https://www.kaggle.com/zainahmedsharif\" target=\"_blank\">@zainahmedsharif</a></p>\n<p>Please check out a notebook which presents the complete process of data preparation, training and inference using the TF2 Object Detection API for EfficientDet models. The notebook can be adapted to any other models in the Model Zoo including FasterRCNN with just 1-2 lines of code change. <br>\n<a href=\"https://www.kaggle.com/sreevishnudamodaran/vbd-efficientdet-tf2-object-detection-api-gpu\" target=\"_blank\">https://www.kaggle.com/sreevishnudamodaran/vbd-efficientdet-tf2-object-detection-api-gpu</a></p>\n<p>Hope it was helpful. Thanks👍🙂</p>",
      "votes": 1,
      "replies": [
        {
          "id": 1153779,
          "author_name": "Zain Ahmed",
          "author_url": "",
          "post_date": "2021-01-15T06:42:58.863000",
          "content": "<p>Thanks a lot. I will check it out.<br>\nReally appreciate your help. </p>",
          "votes": 1,
          "replies": []
        },
        {
          "id": 1157006,
          "author_name": "LAZCoder",
          "author_url": "",
          "post_date": "2021-01-17T15:25:21.827000",
          "content": "<p>Hi <a href=\"https://www.kaggle.com/zainahmedsharif\" target=\"_blank\">@zainahmedsharif</a>, I've published a <a href=\"https://www.kaggle.com/lazcoder/tf2-object-detection-api-efficientdet-b0\" target=\"_blank\">notebook</a> with a slightly different approach to object detection api, that should be more suitable for kaggle notebooks and should allow you to have more control on the whole training.</p>\n<p>It isn't detailed as <a href=\"https://www.kaggle.com/sreevishnudamodaran\" target=\"_blank\">@sreevishnudamodaran</a> work, but the idea is to provide a more in-deep approach to this API, and with both you should be able to implement your own detector as you wish.</p>\n<p>Hope this help to better understand how OD API works.</p>",
          "votes": 3,
          "replies": []
        },
        {
          "id": 1157576,
          "author_name": "Zain Ahmed",
          "author_url": "",
          "post_date": "2021-01-18T03:01:09.673000",
          "content": "<p>Thanks man, I will check it out. </p>",
          "votes": 0,
          "replies": []
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "1142276": "Hi @zainahmedsharif , I'm trying to use TF 2.0 Object Detection API for this competition too. Following the [tutorial](https://tensorflow-object-detection-api-tutorial.readthedocs.io/en/latest/training.html) on the docs is enough to setup a training/evaluation pipeline.  I'm actually diving deep into it in order to understand how to customize my detector.\n\nIn my experiments I've found that in order to install object detection api on kaggle kernels and use it on GPU, you should point out to a version that does not requires tf 2.4.0, as this would cause tensorflow to not detect the GPU at all because of CUDA version mismatch. FYI I'm using [this version](https://github.com/tensorflow/models/tree/3f6fe2aa410d901aae8829597a65d084bffc20d3) (i.e. commit 3f6fe2aa410d901aae8829597a65d084bffc20d3, dated 13 Aug 2020), but you can select any version from the tree.\n\nYou can install api with the following code snippet:\n\n```\ngit clone https://github.com/tensorflow/models.git\n\ncd models/research/\n\n# Reset git head to the sha-1 of the version you want to install\ngit reset --hard 3f6fe2aa410d901aae8829597a65d084bffc20d3\n\nprotoc object_detection/protos/*.proto --python_out=.\n\ncp object_detection/packages/tf2/setup.py .\npython -m pip install . \n```\n\nIn order to use OD Api, you should:\n- Install OD API (with the code snippet provided above)\n- [Genrerate TFRecords] (https://www.kaggle.com/doanquanvietnamca/tfrecords-create-from-dicom-to-image)\n- [Prepare the workspace] (https://tensorflow-object-detection-api-tutorial.readthedocs.io/en/latest/training.html#preparing-the-workspace)\n- Select your pre-trained model (e.g. faster-rcnn)\n- Write config file for your model (hyperparameters, loss functions etc..)\n- Train and Evaluate the model",
    "1142092": "Hello everyone, \nI want to try Faster RCNN on the dataset.  Is there a reliable guide to use TF Object Detection API with kaggle. I could not install the API on kaggle kernel despite following the instructions. Have any of you tried it? \n\nHas anyone use this API on kaggle recently? \nWhat are some other reliable ways for using object detection algorithms in TF 2.0. ",
    "1153675": "Hi @zainahmedsharif\n\nPlease check out a notebook which presents the complete process of data preparation, training and inference using the TF2 Object Detection API for EfficientDet models. The notebook can be adapted to any other models in the Model Zoo including FasterRCNN with just 1-2 lines of code change. \nhttps://www.kaggle.com/sreevishnudamodaran/vbd-efficientdet-tf2-object-detection-api-gpu\n\nHope it was helpful. Thanks👍🙂"
  }
}