Weird error while attemmting to train tensorflow model

I’m trying to train my model on Google Colab. When I run training section in notebook that integrated google colab, it gives me an error which I couldn’t find anny solution. Can anyone explain me what is the problem and how can I fix it please.

The error:

Requirement already satisfied: tf_slim in /usr/local/lib/python3.7/dist-packages (1.1.0)
Requirement already satisfied: absl-py>=0.2.2 in /usr/local/lib/python3.7/dist-packages (from tf_slim) (0.12.0)
Requirement already satisfied: six in /usr/local/lib/python3.7/dist-packages (from absl-py>=0.2.2->tf_slim) (1.15.0)
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
/content/gdrive/My Drive/models/research/object_detection
WARNING:tensorflow:From /usr/local/lib/python3.7/dist-packages/absl/app.py:251: main (from __main__) is deprecated and will be removed in a future version.
Instructions for updating:
Use object_detection/model_main.py.
W0709 08:26:23.871510 140330500528000 deprecation.py:323] From /usr/local/lib/python3.7/dist-packages/absl/app.py:251: main (from __main__) is deprecated and will be removed in a future version.
Instructions for updating:
Use object_detection/model_main.py.
WARNING:tensorflow:From /content/gdrive/My Drive/models/research/object_detection/legacy/trainer.py:265: create_global_step (from tf_slim.ops.variables) is deprecated and will be removed in a future version.
Instructions for updating:
Please switch to tf.train.create_global_step
W0709 08:26:24.229744 140330500528000 deprecation.py:323] From /content/gdrive/My Drive/models/research/object_detection/legacy/trainer.py:265: create_global_step (from tf_slim.ops.variables) is deprecated and will be removed in a future version.
Instructions for updating:
Please switch to tf.train.create_global_step
Traceback (most recent call last):
  File "train.py", line 186, in <module>
    tf.app.run()
  File "/tensorflow-1.15.2/python3.7/tensorflow_core/python/platform/app.py", line 40, in run
    _run(main=main, argv=argv, flags_parser=_parse_flags_tolerate_undef)
  File "/usr/local/lib/python3.7/dist-packages/absl/app.py", line 303, in run
    _run_main(main, args)
  File "/usr/local/lib/python3.7/dist-packages/absl/app.py", line 251, in _run_main
    sys.exit(main(argv))
  File "/tensorflow-1.15.2/python3.7/tensorflow_core/python/util/deprecation.py", line 324, in new_func
    return func(*args, **kwargs)
  File "train.py", line 182, in main
    graph_hook_fn=graph_rewriter_fn)
  File "/content/gdrive/My Drive/models/research/object_detection/legacy/trainer.py", line 279, in train
    train_config.prefetch_queue_capacity, data_augmentation_options)
  File "/content/gdrive/My Drive/models/research/object_detection/legacy/trainer.py", line 58, in create_input_queue
    tensor_dict = create_tensor_dict_fn()
  File "train.py", line 123, in get_next
    dataset_builder.build(config)).get_next()
  File "/content/gdrive/My Drive/models/research/object_detection/builders/dataset_builder.py", line 210, in build
    decoder = decoder_builder.build(input_reader_config)
  File "/content/gdrive/My Drive/models/research/object_detection/builders/decoder_builder.py", line 64, in build
    load_keypoint_depth_features=input_reader_config
  File "/content/gdrive/My Drive/models/research/object_detection/data_decoders/tf_example_decoder.py", line 421, in __init__
    default_value=''),
  File "/content/gdrive/My Drive/models/research/object_detection/data_decoders/tf_example_decoder.py", line 89, in __init__
    label_map_proto_file, use_display_name=False)
TypeError: get_label_map_dict() got an unexpected keyword argument 'use_display_name'

Here is the code blocks that I run orderly:

!pip install --upgrade pip
!pip install --upgrade protobuf
%tensorflow_version 1.15
import tensorflow as tf
print(tf.__version__)

!pip install numpy
device_name = tf.test.gpu_device_name()
if device_name != '/device:GPU:0':
   raise SystemError('GPU device not found')
print('Found GPU at: {}'.format(device_name))
# memory footprint support libraries/code
!ln -sf /opt/bin/nvidia-smi /usr/bin/nvidia-smi
!pip install gputil
!pip install psutil
!pip install humanize
import psutil
import humanize
import os
import GPUtil as GPU
GPUs = GPU.getGPUs()
# XXX: only one GPU on Colab and isn’t guaranteed
gpu = GPUs[0]
def printm():
 process = psutil.Process(os.getpid())
 print("Gen RAM Free: " + humanize.naturalsize( psutil.virtual_memory().available ), " | Proc size: " + humanize.naturalsize( process.memory_info().rss))
 print("GPU RAM Free: {0:.0f}MB | Used: {1:.0f}MB | Util {2:3.0f}% | Total {3:.0f}MB".format(gpu.memoryFree, gpu.memoryUsed, gpu.memoryUtil*100, gpu.memoryTotal))
printm()
from google.colab import drive
drive.mount("/content/gdrive")

# change to working tensorflow directory on the drive
%cd '/content/gdrive/My Drive/models/'
!apt-get install protobuf-compiler python-pil python-lxml python-tk
!pip install Cython
%cd '/content/gdrive/My Drive/models/research/'
#!protoc object_detection/protos/*.proto --python_out=.

import os
os.environ['PYTHONPATH'] += ':/content/gdrive/My Drive/models/research/:/content/gdrive/My Drive/models/research/slim'

!ls
!python setup.py build
!python setup.py install
import time, psutil
Start = time.time()- psutil.boot_time()
Left= 12*3600 - Start
print('Time remaining for this session is: ', Left/3600)

I got error below here!

!pip install tf_slim
%cd /content/gdrive/My Drive/models/research/object_detection
os.environ['PYTHONPATH'] += ':/content/gdrive/My Drive/models/research/:/content/gdrive/My Drive/models/research/slim'

!python train.py --train_dir=training/ --pipeline_config_path=training/ssd_mobilenet_v1_coco.config --logtostderr
%cd object_detection/
!pip install tf_slim
!python export_inference_graph.py --input_type image_tensor --pipeline_config_path training/ssd_mobilenet_v1_coco.config --trained_checkpoint_prefix training/model.ckpt-131906 --output_directory new_graph

Source: Python-3x Questions

LEAVE A COMMENT