Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

I installed anaconda, created a fresh new environment and installed tensorflow via pip. Then I tried this:

import tensorflow as tf
tf.keras.applications.ResNet152V2(
    include_top=True,
    weights="imagenet",
    input_tensor=None,
    input_shape=None,
    pooling=None,
    classes=1000,
    classifier_activation="softmax",

And i directly got:

TypeError: Couldn't build proto file into descriptor pool!
Invalid proto descriptor for file "tensorflow/python/framework/cpp_shape_inference.proto":
  tensorflow.CppShapeInferenceResult.HandleShapeAndType.specialized_type: ".tensorflow.SpecializedType" is not defined.

What I am doing wrong?

The code just works fine on Google_colab

import tensorflow as tf
tf.keras.applications.resnet_v2.ResNet152V2(
    include_top=True, weights='imagenet', input_tensor=None,
    input_shape=None, pooling=None, classes=1000,
    classifier_activation='softmax'

Output

Downloading data from https://storage.googleapis.com/tensorflow/keras-applications/resnet/resnet152v2_weights_tf_dim_ordering_tf_kernels.h5
242753536/242745792 [==============================] - 3s 0us/step
242761728/242745792 [==============================] - 3s 0us/step
<keras.engine.functional.Functional at 0x7faf1736c210>

Issue is with Protobuf insatallation

pip uninstall protobuf
pip install --no-binary protobuf protobuf
                Got the following error:  AttributeError: module 'tensorflow.core.framework.types_pb2' has no attribute '_SPECIALIZEDTYPE'
– h612
                Oct 20, 2021 at 1:55
                I was having issues with error : "TypeError: Descriptors cannot not be created directly." this was happening on a docker container running tensorflow and this answer helped me solve the problem.
– Ricardo Alvarez Correa
                May 26, 2022 at 6:16
        

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.