Skip to content

Commit 116e15b

Browse files
committed
WIP: Writing v2.0
1 parent 1c940c4 commit 116e15b

File tree

14 files changed

+381
-184
lines changed

14 files changed

+381
-184
lines changed
1.05 KB
Binary file not shown.

docs/build/doctrees/index.doctree

0 Bytes
Binary file not shown.
17.9 KB
Binary file not shown.
124 Bytes
Binary file not shown.

docs/build/html/_sources/index.rst.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ The software tools which we shall use throughout this tutorial are listed in the
2929
.. [*] Even though this tutorial is based on Windows 10, most steps (excluding the setting of environmental variables) should apply for Ubuntu 16.04, too.
3030
3131
.. toctree::
32-
:maxdepth: 4
32+
:maxdepth: 5
3333
:caption: Contents:
3434

3535
install

docs/build/html/_sources/install.rst.txt

Lines changed: 110 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ Install TensorFlow GPU for Python
191191

192192
.. code-block:: posh
193193
194-
pip install --ignore-installed --upgrade tensorflow-gpu==1.7.0
194+
pip install --ignore-installed --upgrade tensorflow-gpu==1.8
195195
196196
- Wait for the installation to finish
197197

@@ -221,12 +221,16 @@ Test your Installation
221221

222222
.. code-block:: python
223223
224-
2018-03-21 21:46:18.962971: I C:\tf_jenkins\workspace\rel-win\M\windows-gpu\PY\36\tensorflow\core\common_runtime\gpu\gpu_device.cc:1212] Found device 0 with properties:
225-
name: GeForce GTX 770 major: 3 minor: 0 memoryClockRate(GHz): 1.163
226-
pciBusID: 0000:02:00.0
227-
totalMemory: 2.00GiB freeMemory: 1.63GiB
228-
2018-03-21 21:46:18.978254: I C:\tf_jenkins\workspace\rel-win\M\windows-gpu\PY\36\tensorflow\core\common_runtime\gpu\gpu_device.cc:1312] Adding visible gpu devices: 0
229-
2018-03-21 21:46:19.295152: I C:\tf_jenkins\workspace\rel-win\M\windows-gpu\PY\36\tensorflow\core\common_runtime\gpu\gpu_device.cc:993] Creating TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 1414 MB memory) -> physical GPU (device: 0, name: GeForce GTX 770, pci bus id: 0000:02:00.0, compute capability: 3.0)
224+
2019-02-28 06:56:43.617192: I T:\src\github\tensorflow\tensorflow\core\platform\cpu_feature_guard.cc:140] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2
225+
2019-02-28 06:56:43.792865: I T:\src\github\tensorflow\tensorflow\core\common_runtime\gpu\gpu_device.cc:1356] Found device 0 with properties:
226+
name: GeForce GTX 1080 major: 6 minor: 1 memoryClockRate(GHz): 1.7335
227+
pciBusID: 0000:01:00.0
228+
totalMemory: 8.00GiB freeMemory: 6.61GiB
229+
2019-02-28 06:56:43.799610: I T:\src\github\tensorflow\tensorflow\core\common_runtime\gpu\gpu_device.cc:1435] Adding visible gpu devices: 0
230+
2019-02-28 06:56:44.338771: I T:\src\github\tensorflow\tensorflow\core\common_runtime\gpu\gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:
231+
2019-02-28 06:56:44.348418: I T:\src\github\tensorflow\tensorflow\core\common_runtime\gpu\gpu_device.cc:929] 0
232+
2019-02-28 06:56:44.351039: I T:\src\github\tensorflow\tensorflow\core\common_runtime\gpu\gpu_device.cc:942] 0: N
233+
2019-02-28 06:56:44.352873: I T:\src\github\tensorflow\tensorflow\core\common_runtime\gpu\gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 6387 MB memory) -> physical GPU (device: 0, name: GeForce GTX 1080, pci bus id: 0000:01:00.0, compute capability: 6.1)
230234
231235
- Finally, for the sake of completing the test as described by TensorFlow themselves (see `here <https://www.tensorflow.org/install/install_windows#validate_your_installation>`_), let's run the following:
232236

@@ -263,19 +267,23 @@ Building on the assumption that you have just created your new virtual environme
263267
| opencv | 3.3.1-py36h20b85fd_1 |
264268
+--------------+------------------------------+
265269

266-
The packages can be install by running:
270+
The packages can be installed using ``conda`` by running:
267271

268272
.. code-block:: posh
269273
270-
conda install <package_name>(=<version>)
274+
conda install <package_name>(=<version>), <package_name>(=<version>), ..., <package_name>(=<version>)
271275
272-
where ``<package_name>`` can be replaced with the name of the package, and optionally the package version can be specified by adding the optional specifier ``=<version>`` after ``<package_name>``.
276+
where ``<package_name>`` can be replaced with the name of the package, and optionally the package version can be specified by adding the optional specifier ``=<version>`` after ``<package_name>``. For example, to simply install all packages at their latest versions you can run:
277+
278+
.. code-block:: posh
279+
280+
conda install pillow, lxml, jupyter, matplotlib, opencv
273281
274282
Alternatively, if you don't want to use Anaconda you can install the packages using ``pip``:
275283

276284
.. code-block:: posh
277285
278-
pip install <package_name>(=<version>)
286+
pip install <package_name>(==<version>) <package_name>(==<version>) ... <package_name>(==<version>)
279287
280288
but you will need to install ``opencv-python`` instead of ``opencv``.
281289

@@ -298,70 +306,121 @@ Downloading the TensorFlow Models
298306
299307
.. [#] The latest repo commit when writing this tutorial is `da903e0 <https://github.com/tensorflow/models/commit/da903e07aea0887d59ebf612557243351ddfb4e6>`_.
300308
309+
Protobuf Installation/Compilation
310+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
311+
312+
The Tensorflow Object Detection API uses Protobufs to configure model and
313+
training parameters. Before the framework can be used, the Protobuf libraries
314+
must be downloaded and compiled.
315+
316+
This should be done as follows:
317+
318+
- Head to the `protoc releases page <https://github.com/google/protobuf/releases>`_
319+
- Download the latest ``*-win32.zip`` release (e.g. ``protoc-3.5.1-win32.zip``)
320+
- Create a folder in ``C:\Program Files`` and name it ``Google Protobuf``.
321+
- Extract the contents of the downloaded ``*-win32.zip``, inside ``C:\Program Files\Google Protobuf``
322+
- Add ``C:\Program Files\Google Protobuf\bin`` to your ``Path`` environment variable (see :ref:`set_env`)
323+
- In a new `Anaconda/Command Prompt` [#]_, ``cd`` into ``TensorFlow/models/research/`` directory and run the following command:
324+
325+
.. code-block:: python
326+
327+
# From within TensorFlow/models/research/
328+
protoc object_detection/protos/*.proto --python_out=.
329+
330+
If you are on Windows and using Protobuf 3.5 or later, the multi-file selection wildcard (i.e ``*.proto``) will not work but you can do one of the following:
331+
332+
1. If you are using `Windows Powershell`:
333+
334+
.. code-block:: python
335+
336+
# From within TensorFlow/models/research/
337+
Get-ChildItem object_detection/protos/*.proto | foreach {protoc "object_detection/protos/$($_.Name)" --python_out=.}
338+
339+
340+
2. Alternatively, if you are using `Command Prompt`
341+
342+
.. code-block:: python
343+
344+
# From within TensorFlow/models/research/
345+
for /f %i in ('dir /b object_detection\protos\*.proto') do protoc object_detection\protos\%i --python_out=.
346+
347+
348+
.. [#] NOTE: You MUST open a new `Anaconda/Command Prompt` for the changes in the environment variables to take effect.
349+
350+
301351
Adding necessary Environment Variables
302352
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
303353

304-
Since a lot of the scripts we will use require packages from ``Tensorflow\models\research\object_detection`` to be run, I have found that it's convenient to add the specific folder to our environmental variables.
354+
1. As ``Tensorflow\models\research\object_detection`` is the core package for object detection, it's convenient to add the specific folder to our environmental variables.
305355

306-
For Linux users, this can be done by either adding to ``~/.bashrc`` or running the following code:
356+
- Linux: This can be done by either adding to ``~/.bashrc`` or running the following:
307357

308-
.. code-block:: bash
358+
.. code-block:: bash
309359
310-
export PYTHONPATH=$PYTHONPATH:<PATH_TO_TF>/TensorFlow/models/research/object_detection
360+
export PYTHONPATH=$PYTHONPATH:<PATH_TO_TF>/TensorFlow/models/research/object_detection
311361
312-
For Windows users, the following folder must be added to your ``Path`` environment variable (See :ref:`set_env`):
362+
- Windows: The following folder must be added to your ``PYTHONPATH`` environment variable (See :ref:`set_env`):
313363

314-
- ``<PATH_TO_TF>\TensorFlow\models\research\object_detection``
364+
- ``<PATH_TO_TF>\TensorFlow\models\research\object_detection``
315365

316-
For whatever reason, some of the TensorFlow packages that we will need to use to do object detection, do not come pre-installed with our tensorflow installation.
366+
.. note:: The above can also be achieved, in both Linux and Windows environments, by running the following from ``Tensorflow\models\research``:
317367

318-
For Linux users ONLY, the `Installation docs <https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/installation.md>`_ suggest that you either run, or add to ``~/.bashrc`` file, the following command, which adds these packages to your PYTHONPATH:
368+
.. code-block:: python
319369
320-
.. code-block:: bash
370+
# From within TensorFlow/models/research/
371+
python setup.py build
372+
python setup.py install
321373
322-
# From tensorflow/models/research/
323-
export PYTHONPATH=$PYTHONPATH:`pwd`:`pwd`/slim
374+
The above commands essentially build and install the ``object_detection`` Python package.
375+
376+
**DRAWBACK**: The above commands need to be run everytime there is a change/update of the ``object_detection`` package.
324377

325-
For Windows, the only way that I found works best, is to simply add the following folders to your ``Path`` environment variable (See also :ref:`set_env`):
378+
2. For whatever reason, some of the TensorFlow packages that are required to perform object detection, do not come pre-installed with our tensorflow installation.
326379

327-
- ``<PATH_TO_TF>\TensorFlow\models\research\slim``
328-
- ``<PATH_TO_TF>\TensorFlow\models\research\slim\datasets``
329-
- ``<PATH_TO_TF>\TensorFlow\models\research\slim\deployment``
330-
- ``<PATH_TO_TF>\TensorFlow\models\research\slim\nets``
331-
- ``<PATH_TO_TF>\TensorFlow\models\research\slim\preprocessing``
332-
- ``<PATH_TO_TF>\TensorFlow\models\research\slim\scripts``
380+
- Linux: The `Installation docs <https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/installation.md>`_ suggest that you either run, or add to ``~/.bashrc`` file, the following command, which adds these packages to your PYTHONPATH:
333381

334-
where ``<PATH_TO_TF>`` replaces the absolute path to your ``TesnorFlow`` folder. (e.g. ``<PATH_TO_TF>`` = ``C:\Users\sglvladi\Documents`` if ``TensorFlow`` resides within your ``Documents`` folder)
382+
.. code-block:: bash
335383
336-
Protobuf Installation/Compilation
337-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
384+
# From within tensorflow/models/research/
385+
export PYTHONPATH=$PYTHONPATH:<PATH_TO_TF>/TensorFlow/models/research:<PATH_TO_TF>/TensorFlow/models/research/slim
338386
339-
The Tensorflow Object Detection API uses Protobufs to configure model and
340-
training parameters. Before the framework can be used, the Protobuf libraries
341-
must be downloaded and compiled.
387+
- Windows: The only way that I found works best, is to simply add the following folders to your ``PYTHONPATH`` environment variable (See also :ref:`set_env`):
342388

343-
This should be done as follows:
389+
- ``<PATH_TO_TF>\TensorFlow\models\research``
390+
- ``<PATH_TO_TF>\TensorFlow\models\research\slim``
344391

345-
- Head to the `protoc releases page <https://github.com/google/protobuf/releases>`_
346-
- Download the latest ``*-win32.zip`` release (e.g. ``protoc-3.5.1-win32.zip``)
347-
- Create a folder in ``C:\Program Files`` and name it ``Google Protobuf``.
348-
- Extract the contents of the downloaded ``*-win32.zip``, inside ``C:\Program Files\Google Protobuf``
349-
- Add ``C:\Program Files\Google Protobuf\bin`` to your ``Path`` environment variable (see :ref:`set_env`)
350-
- In a new `Anaconda/Command Prompt` [#]_, ``cd`` into ``TensorFlow/models/research/`` directory and run the following command:
392+
where, in both cases, ``<PATH_TO_TF>`` replaces the absolute path to your ``TesnorFlow`` folder. (e.g. ``<PATH_TO_TF>`` = ``C:\Users\sglvladi\Documents`` if ``TensorFlow`` resides within your ``Documents`` folder)
351393

352-
.. code-block:: python
394+
COCO API installation (Optional)
395+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
353396

354-
# From TensorFlow/models/research/
355-
protoc object_detection/protos/*.proto --python_out=.
397+
The ``pycocotools`` package should be installed if you are interested in using COCO evaluation metrics.
356398

357-
If you are on Windows and using version 3.5 or later, the wildcard will not work and you have to run this in the command prompt:
399+
1. Windows:
358400

359-
.. code-block:: python
401+
Run the following command to install ``pycocotools`` with Windows support:
360402

361-
# From TensorFlow/models/research/
362-
for /f %i in ('dir /b object_detection\protos\*.proto') do protoc object_detection\protos\%i --python_out=.
403+
.. code-block:: bash
404+
405+
pip install git+https://github.com/philferriere/cocoapi.git#subdirectory=PythonAPI
406+
407+
408+
Note that, according to the `package's instructions <https://github.com/philferriere/cocoapi#this-clones-readme>`_, Visual C++ 2015 build tools must be installed and on your path. If they are not, make sure to install them from `here <https://go.microsoft.com/fwlink/?LinkId=691126>`_.
409+
410+
2. Linux:
411+
412+
Download `cocoapi <https://github.com/cocodataset/cocoapi>`_ to a directory of your choice, then ``make`` and copy the pycocotools subfolder to the ``Tensorflow/models/research`` directory, as such:
413+
414+
.. code-block:: bash
415+
416+
git clone https://github.com/cocodataset/cocoapi.git
417+
cd cocoapi/PythonAPI
418+
make
419+
cp -r pycocotools <PATH_TO_TF>/TensorFlow/models/research/
420+
421+
422+
The default metrics are based on those used in Pascal VOC evaluation. To use the COCO object detection metrics add `metrics_set: "coco_detection_metrics"` to the `eval_config` message in the config file. To use the COCO instance segmentation metrics add `metrics_set: "coco_mask_metrics"` to the `eval_config` message in the config file.
363423

364-
.. [#] NOTE: You MUST open a new `Anaconda/Command Prompt` for the changes in the environment variables to take effect.
365424

366425
.. _test_tf_models:
367426

@@ -373,7 +432,7 @@ Test your Installation
373432

374433
.. code-block:: posh
375434
376-
# From TensorFlow/models/research/object_detection
435+
# From within TensorFlow/models/research/object_detection
377436
jupyter notebook
378437
379438
- This should start a new ``jupyter notebook`` server on your machine and you should be redirected to a new tab of your default browser.
@@ -435,7 +494,6 @@ Downloading labelImg
435494
| ├── samples
436495
| └── tutorials
437496
|
438-
|
439497
440498
.. [#] The latest repo commit when writing this tutorial is `8d1bd68 <https://github.com/tzutalin/labelImg/commit/8d1bd68ab66e8c311f2f45154729bba301a81f0b>`_.
441499

docs/build/html/_sources/training.rst.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -532,6 +532,7 @@ Now that we have downloaded and extracted our pre-trained model, let's have a lo
532532
epsilon: 0.001,
533533
}
534534
}
535+
override_base_feature_extractor_hyperparams: true
535536
}
536537
loss {
537538
classification_loss {

docs/build/html/index.html

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -215,16 +215,17 @@ <h1>TensorFlow Object Detection API tutorial<a class="headerlink" href="#tensorf
215215
<li class="toctree-l2"><a class="reference internal" href="install.html#tensorflow-models-installation">TensorFlow Models Installation</a><ul>
216216
<li class="toctree-l3"><a class="reference internal" href="install.html#install-prerequisites">Install Prerequisites</a></li>
217217
<li class="toctree-l3"><a class="reference internal" href="install.html#downloading-the-tensorflow-models">Downloading the TensorFlow Models</a></li>
218-
<li class="toctree-l3"><a class="reference internal" href="install.html#adding-necessary-environment-variables">Adding necessary Environment Variables</a></li>
219218
<li class="toctree-l3"><a class="reference internal" href="install.html#protobuf-installation-compilation">Protobuf Installation/Compilation</a></li>
219+
<li class="toctree-l3"><a class="reference internal" href="install.html#adding-necessary-environment-variables">Adding necessary Environment Variables</a></li>
220+
<li class="toctree-l3"><a class="reference internal" href="install.html#coco-api-installation-optional">COCO API installation (Optional)</a></li>
220221
<li class="toctree-l3"><a class="reference internal" href="install.html#test-tf-models">Test your Installation</a></li>
221222
</ul>
222223
</li>
223224
<li class="toctree-l2"><a class="reference internal" href="install.html#labelimg-installation">LabelImg Installation</a><ul>
224-
<li class="toctree-l3"><a class="reference internal" href="install.html#id11">Create a new Conda virtual environment</a></li>
225+
<li class="toctree-l3"><a class="reference internal" href="install.html#id12">Create a new Conda virtual environment</a></li>
225226
<li class="toctree-l3"><a class="reference internal" href="install.html#downloading-labelimg">Downloading labelImg</a></li>
226227
<li class="toctree-l3"><a class="reference internal" href="install.html#installing-dependencies-and-compiling-package">Installing dependencies and compiling package</a></li>
227-
<li class="toctree-l3"><a class="reference internal" href="install.html#id16">Test your installation</a></li>
228+
<li class="toctree-l3"><a class="reference internal" href="install.html#id17">Test your installation</a></li>
228229
</ul>
229230
</li>
230231
</ul>

0 commit comments

Comments
 (0)