{
  "id": 303438,
  "title": "TF-OD Export Inference graph and model inferencing.",
  "url": "/competitions/tensorflow-great-barrier-reef/discussion/303438",
  "author_name": "",
  "post_date": "2022-01-27T16:01:22.556038800Z",
  "votes": 6,
  "comment_count": 1,
  "views": 0,
  "content": "<p>Hi everyone,</p>\n<p>I received a few mails regarding how to export a TensorFlow object detection model and later infer the model so I decided to create a topic for it.</p>\n<p>Here it goes.</p>\n<p>So if you are using <strong>tensorflow 2.x</strong> od api then in <code>modesls/research/object_detection</code> there is file <code>exporter_main_v2</code> and for <strong>tensorflow 1.x</strong> the file name is <code>export_inference_graph.py</code>.</p>\n<p>To export a graph the inference graph tfod2 api -<br>\n<code>python exporter_main_v2.py \\\n    --input_type image_tensor \\\n    --pipeline_config_path  path to your pipeline.config \\\n    --trained_checkpoint_dir path/to/checkpoint \\\n    --output_directory path/to/exported_model_directory\n</code></p>\n<p>To export a graph the inference graph tfod1 api -<br>\n<code>python export_inference_graph.py \\\n    --input_type image_tensor \\\n    --pipeline_config_path path/to/ssd_inception_v2.config \\\n    --trained_checkpoint_prefix path/to/model.ckpt \\\n    --output_directory path/to/exported_model_directory\n</code><br>\nThe expected output would be in the directory, and will have contents :</p>\n<ul>\n<li>inference_graph.pbtxt</li>\n<li>model.ckpt.data-00000-of-00001</li>\n<li>model.ckpt.info</li>\n<li>model.ckpt.meta</li>\n<li>frozen_inference_graph.pb</li>\n<li>saved_model (a directory)</li>\n</ul>\n<p>To infer the model you can follow this tutotrial from tensorflow's official repo-<br>\nHere is the link <a href=\"https://github.com/tensorflow/models/blob/master/research/object_detection/colab_tutorials/inference_from_saved_model_tf2_colab.ipynb\" target=\"_blank\">Object detection inference tutorial</a></p>\n<p>I hope this will help you with even after the competition for your other object detection tutorials.</p>",
  "messages": [
    {
      "id": "1666269",
      "postDate": "01/27/2022 16:01:22",
      "content": "<p>Hi everyone,</p>\n<p>I received a few mails regarding how to export a TensorFlow object detection model and later infer the model so I decided to create a topic for it.</p>\n<p>Here it goes.</p>\n<p>So if you are using <strong>tensorflow 2.x</strong> od api then in <code>modesls/research/object_detection</code> there is file <code>exporter_main_v2</code> and for <strong>tensorflow 1.x</strong> the file name is <code>export_inference_graph.py</code>.</p>\n<p>To export a graph the inference graph tfod2 api -<br>\n<code>python exporter_main_v2.py \\\n    --input_type image_tensor \\\n    --pipeline_config_path  path to your pipeline.config \\\n    --trained_checkpoint_dir path/to/checkpoint \\\n    --output_directory path/to/exported_model_directory\n</code></p>\n<p>To export a graph the inference graph tfod1 api -<br>\n<code>python export_inference_graph.py \\\n    --input_type image_tensor \\\n    --pipeline_config_path path/to/ssd_inception_v2.config \\\n    --trained_checkpoint_prefix path/to/model.ckpt \\\n    --output_directory path/to/exported_model_directory\n</code><br>\nThe expected output would be in the directory, and will have contents :</p>\n<ul>\n<li>inference_graph.pbtxt</li>\n<li>model.ckpt.data-00000-of-00001</li>\n<li>model.ckpt.info</li>\n<li>model.ckpt.meta</li>\n<li>frozen_inference_graph.pb</li>\n<li>saved_model (a directory)</li>\n</ul>\n<p>To infer the model you can follow this tutotrial from tensorflow's official repo-<br>\nHere is the link <a href=\"https://github.com/tensorflow/models/blob/master/research/object_detection/colab_tutorials/inference_from_saved_model_tf2_colab.ipynb\" target=\"_blank\">Object detection inference tutorial</a></p>\n<p>I hope this will help you with even after the competition for your other object detection tutorials.</p>",
      "rawMarkdown": "Hi everyone,\n\nI received a few mails regarding how to export a TensorFlow object detection model and later infer the model so I decided to create a topic for it.\n\nHere it goes.\n\nSo if you are using **tensorflow 2.x** od api then in `modesls/research/object_detection` there is file `exporter_main_v2` and for **tensorflow 1.x** the file name is `export_inference_graph.py`.\n\nTo export a graph the inference graph tfod2 api -\n`python exporter_main_v2.py \\\n    --input_type image_tensor \\\n    --pipeline_config_path  path to your pipeline.config \\\n    --trained_checkpoint_dir path/to/checkpoint \\\n    --output_directory path/to/exported_model_directory\n    `\n\nTo export a graph the inference graph tfod1 api -\n`python export_inference_graph.py \\\n    --input_type image_tensor \\\n    --pipeline_config_path path/to/ssd_inception_v2.config \\\n    --trained_checkpoint_prefix path/to/model.ckpt \\\n    --output_directory path/to/exported_model_directory\n`\nThe expected output would be in the directory, and will have contents :\n - inference_graph.pbtxt\n - model.ckpt.data-00000-of-00001\n - model.ckpt.info\n - model.ckpt.meta\n - frozen_inference_graph.pb\n + saved_model (a directory)\n\n\nTo infer the model you can follow this tutotrial from tensorflow's official repo-\nHere is the link [Object detection inference tutorial](https://github.com/tensorflow/models/blob/master/research/object_detection/colab_tutorials/inference_from_saved_model_tf2_colab.ipynb)\n\nI hope this will help you with even after the competition for your other object detection tutorials.",
      "votes": null
    },
    {
      "id": "1666305",
      "postDate": "01/27/2022 16:29:00",
      "content": "<p>Thank you so much. This helps me a lot. Will connect with you if got stuck. And accept my request on LinkedIn please</p>",
      "rawMarkdown": "Thank you so much. This helps me a lot. Will connect with you if got stuck. And accept my request on LinkedIn please",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 1666305,
      "author_name": "captainabhijeeth",
      "author_url": "",
      "post_date": "01/27/2022 16:29:00",
      "content": "<p>Thank you so much. This helps me a lot. Will connect with you if got stuck. And accept my request on LinkedIn please</p>",
      "votes": null,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "1666269": "Hi everyone,\n\nI received a few mails regarding how to export a TensorFlow object detection model and later infer the model so I decided to create a topic for it.\n\nHere it goes.\n\nSo if you are using **tensorflow 2.x** od api then in `modesls/research/object_detection` there is file `exporter_main_v2` and for **tensorflow 1.x** the file name is `export_inference_graph.py`.\n\nTo export a graph the inference graph tfod2 api -\n`python exporter_main_v2.py \\\n    --input_type image_tensor \\\n    --pipeline_config_path  path to your pipeline.config \\\n    --trained_checkpoint_dir path/to/checkpoint \\\n    --output_directory path/to/exported_model_directory\n    `\n\nTo export a graph the inference graph tfod1 api -\n`python export_inference_graph.py \\\n    --input_type image_tensor \\\n    --pipeline_config_path path/to/ssd_inception_v2.config \\\n    --trained_checkpoint_prefix path/to/model.ckpt \\\n    --output_directory path/to/exported_model_directory\n`\nThe expected output would be in the directory, and will have contents :\n - inference_graph.pbtxt\n - model.ckpt.data-00000-of-00001\n - model.ckpt.info\n - model.ckpt.meta\n - frozen_inference_graph.pb\n + saved_model (a directory)\n\n\nTo infer the model you can follow this tutotrial from tensorflow's official repo-\nHere is the link [Object detection inference tutorial](https://github.com/tensorflow/models/blob/master/research/object_detection/colab_tutorials/inference_from_saved_model_tf2_colab.ipynb)\n\nI hope this will help you with even after the competition for your other object detection tutorials.",
    "1666305": "Thank you so much. This helps me a lot. Will connect with you if got stuck. And accept my request on LinkedIn please"
  },
  "source": "meta"
}