Monday, June 6, 2022

Tensor Flow error : module 'tensorflow' has no attribute 'gfile'

Background: This gfile is still present in tensorflow. This occur due to version change in Tensorflow.


  File "/Users/MRJ/anaconda3/envs/python37-tf2.1/lib/python3.7/
site-packages/object_detection/utils/label_map_util.py",
line 137, in load_labelmap

with tf.gfile.GFile(path, 'r') as fid:
  AttributeError: module 'tensorflow' has no attribute 'gfile'




Solution:

We need to update the file with the new  key word tf.io.gfile.GFile where the error is occurring. 

version 1.xx points to tf.gfile.GFile change for new version 2.xx is tf.io.gfile.GFile

Normally this is updated in config_util.py. The error will point which file(s) need to be updated. Once file is updated and saved.  Shutdown and restart the jupyter notebook to take effect.





Popular Posts