AttributeError: module 'tensorflow' has no attribute 'app'

Dora89 picture Dora89 · Oct 6, 2019 · Viewed 36.2k times · Source

I am following this tutorial and doing a project on custom object-detection using tensorflow.

So when I tried to create TF record for the train images using the following command

python3 generate_tfrecord.py --csv_input=data/train_labels.csv --output_path=data/train.record

I get the following error:

Traceback (most recent call last):
  File "generate_tfrecord.py", line 23, in <module>
    flags = tf.app.flags
AttributeError: module 'tensorflow' has no attribute 'app'

How can I resolve this error?

Answer

ThMore picture ThMore · Nov 3, 2019

try using import tensorflow.compat.v1 as tf