Last active
June 16, 2023 10:13
-
-
Save hugozanini/b58e970f8a3d2ba742e528ea9256fcc3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"nbformat": 4, | |
"nbformat_minor": 0, | |
"metadata": { | |
"colab": { | |
"name": "Publishing.ipynb", | |
"provenance": [] | |
}, | |
"kernelspec": { | |
"name": "python3", | |
"display_name": "Python 3" | |
} | |
}, | |
"cells": [ | |
{ | |
"cell_type": "markdown", | |
"metadata": { | |
"id": "UaUG3D6m_FEY" | |
}, | |
"source": [ | |
"### **Clone and install the Tensorflow Object Detection API** \n", | |
"\n", | |
"In order to use the TensorFlow Object Detection API, we need to clone it's GitHub Repo.\n", | |
"<br>\n", | |
"\n", | |
"#### **Dependencies**\n", | |
"\n", | |
"\n", | |
"Most of the dependencies required come preloaded in Google Colab. No extra installation is needed.\n", | |
"<br>\n", | |
"\n", | |
"#### **Protocol Buffers**\n", | |
"\n", | |
"\n", | |
"\n", | |
"The TensorFlow Object Detection API relies on what are called `protocol buffers` (also known as `protobufs`). Protobufs are a language neutral way to describe information. That means you can write a protobuf once and then compile it to be used with other languages, like Python, Java or C [5].\n", | |
"\n", | |
"The `protoc` command used below is compiling all the protocol buffers in the `object_detection/protos` folder for Python." | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"metadata": { | |
"id": "xbkuAjhU-3e6", | |
"colab": { | |
"base_uri": "https://localhost:8080/" | |
}, | |
"outputId": "9686f0c2-79ec-4b0e-9ed4-aa778dbba185" | |
}, | |
"source": [ | |
"!git clone https://github.com/tensorflow/models.git" | |
], | |
"execution_count": 1, | |
"outputs": [ | |
{ | |
"output_type": "stream", | |
"text": [ | |
"Cloning into 'models'...\n", | |
"remote: Enumerating objects: 12, done.\u001b[K\n", | |
"remote: Counting objects: 100% (12/12), done.\u001b[K\n", | |
"remote: Compressing objects: 100% (12/12), done.\u001b[K\n", | |
"remote: Total 50253 (delta 3), reused 9 (delta 0), pack-reused 50241\u001b[K\n", | |
"Receiving objects: 100% (50253/50253), 559.90 MiB | 20.79 MiB/s, done.\n", | |
"Resolving deltas: 100% (34186/34186), done.\n" | |
], | |
"name": "stdout" | |
} | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"metadata": { | |
"id": "ukzhAgID_gyP", | |
"colab": { | |
"base_uri": "https://localhost:8080/" | |
}, | |
"outputId": "6baa1929-d2c7-4aa0-9962-c2a11cceb4ab" | |
}, | |
"source": [ | |
"%cd /content/models/research/\r\n", | |
"!protoc object_detection/protos/*.proto --python_out=.\r\n", | |
"# Install TensorFlow Object Detection API.\r\n", | |
"!cp object_detection/packages/tf2/setup.py .\r\n", | |
"!python -m pip install ." | |
], | |
"execution_count": 2, | |
"outputs": [ | |
{ | |
"output_type": "stream", | |
"text": [ | |
"/content/models/research\n", | |
"Successfully installed apache-beam-2.27.0 avro-python3-1.10.1 dill-0.3.1.1 fastavro-1.2.3 future-0.18.2 hdfs-2.5.8 lvis-0.5.3 mock-2.0.0 object-detection-0.1 opencv-python-headless-4.5.1.48 pbr-5.5.1 py-cpuinfo-7.0.0 pyarrow-2.0.0 pyyaml-5.3.1 requests-2.25.1 sentencepiece-0.1.95 seqeval-1.2.2 tensorflow-model-optimization-0.5.0 tf-models-official-2.4.0 tf-slim-1.1.0\n" | |
], | |
"name": "stdout" | |
} | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": { | |
"id": "jkZtxPYCXLHu" | |
}, | |
"source": [ | |
"Run the model builder test" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"metadata": { | |
"id": "XzfZSmpSXMxS", | |
"colab": { | |
"base_uri": "https://localhost:8080/" | |
}, | |
"outputId": "597fac0a-188e-4ee8-b0e6-c39f7ad31033" | |
}, | |
"source": [ | |
"!python /content/models/research/object_detection/builders/model_builder_tf2_test.py" | |
], | |
"execution_count": 3, | |
"outputs": [ | |
{ | |
"output_type": "stream", | |
"text": [ | |
"INFO:tensorflow:time(__main__.ModelBuilderTF2Test.test_unknown_meta_architecture): 0.0s\n", | |
"I0113 21:31:21.168457 140501804394368 test_util.py:2076] time(__main__.ModelBuilderTF2Test.test_unknown_meta_architecture): 0.0s\n", | |
"[ OK ] ModelBuilderTF2Test.test_unknown_meta_architecture\n", | |
"[ RUN ] ModelBuilderTF2Test.test_unknown_ssd_feature_extractor\n", | |
"INFO:tensorflow:time(__main__.ModelBuilderTF2Test.test_unknown_ssd_feature_extractor): 0.0s\n", | |
"I0113 21:31:21.169473 140501804394368 test_util.py:2076] time(__main__.ModelBuilderTF2Test.test_unknown_ssd_feature_extractor): 0.0s\n", | |
"[ OK ] ModelBuilderTF2Test.test_unknown_ssd_feature_extractor\n", | |
"----------------------------------------------------------------------\n", | |
"Ran 20 tests in 35.358s\n", | |
"\n", | |
"OK (skipped=1)\n" | |
], | |
"name": "stdout" | |
} | |
] | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment