You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- If the above code shows an error, then check to make sure you have activated the `tensorflow_gpu` environment and that tensorflow_gpu was successfully installed within it in the previous step.
84
+
- If the above code shows an error, then check to make sure you have activated the `tensorflow_cpu` environment and that tensorflow_cpu was successfully installed within it in the previous step.
85
85
- Then run the following:
86
86
87
87
.. code-block:: python
@@ -123,6 +123,8 @@ Before proceeding to install TesnsorFlow GPU, you need to make sure that your sy
123
123
| Anaconda with Python 3.6 (Optional) |
124
124
+-------------------------------------+
125
125
126
+
.. _cuda_install:
127
+
126
128
Install CUDA Toolkit
127
129
***********************
128
130
Follow this `link <https://developer.nvidia.com/cuda-90-download-archive?target_os=Windows&target_arch=x86_64&target_version=10&target_type=exenetwork>`_ to download and install CUDA Toolkit v9.0.
@@ -145,15 +147,17 @@ Set Your Environment Variables
145
147
- Go to `Start` and Search "environment variables"
146
148
- Click the Environment Variables button
147
149
- Click on the ``Path`` system variable and select edit
If during the installation of the CUDA Toolkit (see :ref:`cuda_install`) you selected the `Express Installation` option, then your GPU drivers will have been overwritten by those that come bundled with the CUDA toolkit. These drivers are typically NOT the latest drivers and, thus, you may wish to updte your drivers.
160
+
157
161
- Go to `<http://www.nvidia.com/Download/index.aspx>`_
158
162
- Select your GPU version to download
159
163
- Install the driver
@@ -187,7 +191,7 @@ Install TensorFlow GPU for Python
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:
358
+
359
+
.. code-block:: python
360
+
361
+
# From TensorFlow/models/research/
362
+
for/f %i in ('dir /b object_detection\protos\*.proto') do protoc object_detection\protos\%i --python_out=.
363
+
352
364
.. [#] NOTE: You MUST open a new `Anaconda/Command Prompt` for the changes in the environment variables to take effect.
353
365
354
366
.. _test_tf_models:
@@ -379,6 +391,9 @@ Test your Installation
379
391
LabelImg Installation
380
392
---------------------
381
393
394
+
For Windows and Linux you can download the precompiled binary at http://tzutalin.github.io/labelImg/.
395
+
The steps for installing from source follow below.
396
+
382
397
Create a new Conda virtual environment
383
398
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
384
399
@@ -398,7 +413,7 @@ To deal with the fact that ``labelImg`` (on Windows) requires the use of ``pyqt4
398
413
399
414
activate labelImg
400
415
401
-
Once you have activated your virtual environment, the name of the environment should be displayed within brackets at the beggining of your cmd path specifier, e.g.:
416
+
Once you have activated your virtual environment, the name of the environment should be displayed within brackets at the beginning of your cmd path specifier, e.g.:
402
417
403
418
.. code-block:: ps1con
404
419
@@ -407,7 +422,7 @@ Once you have activated your virtual environment, the name of the environment sh
407
422
Downloading labelImg
408
423
~~~~~~~~~~~~~~~~~~~~
409
424
410
-
- Inside you ``TesnorFlow`` folder, create a new directory, name it ``addons`` and then ``cd`` into it.
425
+
- Inside you ``TensorFlow`` folder, create a new directory, name it ``addons`` and then ``cd`` into it.
411
426
- To download the package you can either use `Git <https://git-scm.com/downloads>`_ to clone the `labelImg repo <https://github.com/tzutalin/labelImg>`_ inside the ``TensorFlow\addons`` folder, or you can simply download it as a `ZIP <https://github.com/tzutalin/labelImg/archive/master.zip>`_ and extract it's contents inside the ``TensorFlow\addons`` folder. To keep things consistent, in the latter case you will have to rename the extracted folder ``labelImg-master`` to ``labelImg``. [#]_
412
427
- You should now have a single folder named ``addons\labelImg`` under your ``TensorFlow`` folder, which contains another 4 folders as such:
Copy file name to clipboardExpand all lines: docs/build/html/_sources/training.rst.txt
+24-10
Original file line number
Diff line number
Diff line change
@@ -19,7 +19,7 @@ Now that we have done all the above, we can start doing some cool stuff. Here we
19
19
Preparing workspace
20
20
~~~~~~~~~~~~~~~~~~~
21
21
22
-
If you have followed the tutorial, you shhould by now have a folder ``Tensorflow``, placed under ``<PATH_TO_TF>`` (e.g. ``C:\Users\sglvladi\Documents``), with the following directory tree:
22
+
If you have followed the tutorial, you should by now have a folder ``Tensorflow``, placed under ``<PATH_TO_TF>`` (e.g. ``C:\Users\sglvladi\Documents``), with the following directory tree:
23
23
24
24
|TensorFlow
25
25
|├─ addons
@@ -66,7 +66,7 @@ Here's an explanation for each of the folders/filer shown in the above tree:
66
66
- ``images``: This folder contains a copy of all the images in our dataset, as well as the respective ``*.xml`` files produced for each one, once ``labelImg`` is used to annotate objects.
67
67
68
68
* ``images\train``: This folder contains a copy of all images, and the respective ``*.xml`` files, which will be used to train our model.
69
-
* ``images\test``: This folder contains a copy of all images, and the respective ``*.xml`` files, which will be used to train our model.
69
+
* ``images\test``: This folder contains a copy of all images, and the respective ``*.xml`` files, which will be used to test our model.
70
70
71
71
- ``pre-trained-model``: This folder will contain the pre-trained model of our choice, which shall be used as a starting checkpoint for our training job.
72
72
- ``training``: This folder will contain the training pipeline configuration file ``*.config``, as well as a ``*.pbtxt`` label map file and all files generated during the training of our model.
@@ -296,7 +296,9 @@ Now that we have obtained our ``*.csv`` annotation files, we will need to conver
296
296
import io
297
297
import pandas as pd
298
298
import tensorflow as tf
299
-
299
+
import sys
300
+
sys.path.append("../../models/research")
301
+
300
302
fromPILimport Image
301
303
from object_detection.utils import dataset_util
302
304
from collections import namedtuple, OrderedDict
@@ -305,13 +307,24 @@ Now that we have obtained our ``*.csv`` annotation files, we will need to conver
305
307
flags.DEFINE_string('csv_input', '', 'Path to the CSV input')
306
308
flags.DEFINE_string('output_path', '', 'Path to output TFRecord')
307
309
flags.DEFINE_string('label', '', 'Name of class label')
310
+
# if your image has more labels input them as
311
+
# flags.DEFINE_string('label0', '', 'Name of class[0] label')
312
+
# flags.DEFINE_string('label1', '', 'Name of class[1] label')
313
+
# and so on.
314
+
flags.DEFINE_string('img_path', '', 'Path to images')
308
315
FLAGS= flags.FLAGS
309
316
310
317
311
318
# TO-DO replace this with label map
319
+
# for multiple labels add more else if statements
312
320
defclass_text_to_int(row_label):
313
321
if row_label ==FLAGS.label: # 'ship':
314
322
return1
323
+
# comment upper if statement and uncomment these statements for multiple labelling
324
+
# if row_label == FLAGS.label0:
325
+
# return 1
326
+
# elif row_label == FLAGS.label1:
327
+
# return 0
315
328
else:
316
329
None
317
330
@@ -331,6 +344,7 @@ Now that we have obtained our ``*.csv`` annotation files, we will need to conver
331
344
332
345
filename = group.filename.encode('utf8')
333
346
image_format =b'jpg'
347
+
# check if the image format is matching with your images.
334
348
xmins = []
335
349
xmaxs = []
336
350
ymins = []
@@ -365,7 +379,7 @@ Now that we have obtained our ``*.csv`` annotation files, we will need to conver
@@ -612,7 +626,7 @@ Once the above changes have been applied to our config file, go ahead and save i
612
626
Training the Model
613
627
~~~~~~~~~~~~~~~~~~
614
628
615
-
Before we begin training our model, let's go and copy the ``TensorFlow/models/research/object_detection/train.py`` script and paste it straight into our ``training_demo`` folder. We will need this script in order to train our model.
629
+
Before we begin training our model, let's go and copy the ``TensorFlow/models/research/object_detection/legacy/train.py`` script and paste it straight into our ``training_demo`` folder. We will need this script in order to train our model.
616
630
617
631
Now, to initiate a new training job, ``cd`` inside the ``training_demo`` folder and type the following:
618
632
@@ -715,12 +729,12 @@ Once your training job is complete, you need to extract the newly trained infere
715
729
716
730
activate tensorflow_gpu
717
731
718
-
- Copy the ``TensorFlow/models/research/object_detection/extract_inference_graph.py`` script and paste it straight into your ``training_demo`` folder.
732
+
- Copy the ``TensorFlow/models/research/object_detection/export_inference_graph.py`` script and paste it straight into your ``training_demo`` folder.
719
733
- Check inside your ``training_demo/training`` folder for the ``model.ckpt-*`` checkpoint file with the highest number following the name of the dash e.g. ``model.ckpt-34350``). This number represents the training step index at which the file was created.
720
734
- Alternatively, simply sort all the files inside ``training_demo/training`` by descending time and pick the ``model.ckpt-*`` file that comes first in the list.
721
-
- Make a note of the file's name, as it will be passed as an argument when we call the ``extract_inference_graph.py`` script.
735
+
- Make a note of the file's name, as it will be passed as an argument when we call the ``export_inference_graph.py`` script.
722
736
- Now, ``cd`` inside your ``training_demo`` folder, and run the following command:
0 commit comments