I’m on the second week of Advanced Computer Vision with TensorFlow, I downloaded the officiel notebook
[Google Colab]
I Installed all the requirements, but when I execute this cell
from object_detection.utils import label_map_util
from object_detection.utils import visualization_utils as viz_utils
from object_detection.utils import ops as utils_ops
%matplotlib inline
but I got this error :
{
"name": "ImportError",
"message": "cannot import name 'runtime_version' from 'google.protobuf' (/Users/mouaad/anaconda3/envs/tensorflow-1-public/lib/python3.9/site-packages/google/protobuf/__init__.py)",
"stack": "---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
Cell In[10], line 1
----> 1 from object_detection.utils import label_map_util
2 from object_detection.utils import visualization_utils as viz_utils
3 from object_detection.utils import ops as utils_ops
File ~/anaconda3/envs/tensorflow-1-public/lib/python3.9/site-packages/object_detection/utils/label_map_util.py:29
27 import tensorflow.compat.v1 as tf
28 from google.protobuf import text_format
---> 29 from object_detection.protos import string_int_label_map_pb2
31 _LABEL_OFFSET = 1
34 def _validate_label_map(label_map):
File ~/anaconda3/envs/tensorflow-1-public/lib/python3.9/site-packages/object_detection/protos/string_int_label_map_pb2.py:9
7 from google.protobuf import descriptor as _descriptor
8 from google.protobuf import descriptor_pool as _descriptor_pool
----> 9 from google.protobuf import runtime_version as _runtime_version
10 from google.protobuf import symbol_database as _symbol_database
11 from google.protobuf.internal import builder as _builder
ImportError: cannot import name 'runtime_version' from 'google.protobuf' (/Users/mouaad/anaconda3/envs/tensorflow-1-public/lib/python3.9/site-packages/google/protobuf/__init__.py)"
}
I searched over the internet and asked ChatGPT and claude3.5 and still I can’t fix it.
can I know what all you download, as far as I remember this assignment required to download some files other than required mentioned in the assignment, so did you download those?
Also please make sure the version of python, tf and keras matches with the version used in the assignment notebook.
Tensorflow version 2.17.0
keras version 3.4.1
tensorflow hub version 0.16.1
Python 3.10.14
The tutorial worked well on Colab, but on my local machine, I keep getting this error:
{
"name": "ImportError",
"message": "cannot import name 'runtime_version' from 'google.protobuf' (/opt/anaconda3/envs/tf-object-detection/lib/python3.10/site-packages/google/protobuf/__init__.py)",
"stack": "---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
Cell In[4], line 1
----> 1 from object_detection.utils import label_map_util
2 from object_detection.utils import visualization_utils as viz_utils
3 from object_detection.utils import ops as utils_ops
File /opt/anaconda3/envs/tf-object-detection/lib/python3.10/site-packages/object_detection/utils/label_map_util.py:29
27 import tensorflow.compat.v1 as tf
28 from google.protobuf import text_format
---> 29 from object_detection.protos import string_int_label_map_pb2
31 _LABEL_OFFSET = 1
34 def _validate_label_map(label_map):
File /opt/anaconda3/envs/tf-object-detection/lib/python3.10/site-packages/object_detection/protos/string_int_label_map_pb2.py:9
7 from google.protobuf import descriptor as _descriptor
8 from google.protobuf import descriptor_pool as _descriptor_pool
----> 9 from google.protobuf import runtime_version as _runtime_version
10 from google.protobuf import symbol_database as _symbol_database
11 from google.protobuf.internal import builder as _builder
ImportError: cannot import name 'runtime_version' from 'google.protobuf' (/opt/anaconda3/envs/tf-object-detection/lib/python3.10/site-packages/google/protobuf/__init__.py)"
}
I am not saying you to match the colab environment version but the coursera provided colab version for tf, keras and python.
Another thing, you are suppose to check object detection.utils mentioned here is not able to download the necessary module due to its dependency modules.
So check all the tick boss mentioned when you run the Coursera provided colab environment version properly. Also check all the files is in the proper location.