1

I have been getting multiple errors which are due to conflicts in the TensorFlow version installed in my system and the version used to write the code in Tensorflow API. I am using python 3.6.7 and Tensorflow 2.0 to get started with the code https://github.com/tensorflow/models/blob/master/research/deeplab/g3doc/installation.md

But I am getting several errors :

  1. flags = tf.app.flags AttributeError: module 'tensorflow' has no attribute 'app. As I am using 2.0 , I replaced tf.app.flags with tf.compat.v1.flags.

  2. from tensorflow.contrib import slim as contrib_slim ModuleNotFoundError: No module named 'tensorflow.contrib'

I am not able to solve the second one. Can I get help to know which python and tensorflow version should be used to run DeepLab v3+?

Pallawi.ds
  • 103
  • 1
  • 7
  • Since the code could not find the `tf.contrib` module, I think you should try running the code with TF 1.x versions. `tf.contrib` is deprecated in TF 2.0. – Shubham Panchal Nov 24 '19 at 08:38

1 Answers1

1

You should use the Tensorflow version 1.x to run the DeepLabV3+ model because it uses a session to run and also the slim library which is based on the TensorFlow 1.x. And so your two problems can be solved as:

  1. Do not need to replace tf.app.flags with tf.compat.v1.flags.
  2. To run DeepLabV3+ model, you need to put deeplab and slim folder in a folder (deeplab_slim), and export them by running following export commands from this parent folder (deeplab_slim):
export PYTHONPATH=$PYTHONPATH:`pwd`:`pwd`/slim
export PYTHONPATH=$PYTHONPATH:`pwd`:`pwd`/deeplab
Manas
  • 888
  • 10
  • 20