Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'Node' object has no attribute 'output_masks' #109

Open
zubairahmed-ai opened this issue Mar 29, 2020 · 1 comment
Open

'Node' object has no attribute 'output_masks' #109

zubairahmed-ai opened this issue Mar 29, 2020 · 1 comment

Comments

@zubairahmed-ai
Copy link

Hi I am facing this issue for a while. I have posted a detailed issue on SO https://stackoverflow.com/questions/60913598/tensorflow-2-google-colab-efficientnet-training-attributeerror-node-obje

Here's the error output, can you please help

WARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/keras/backend/tensorflow_backend.py:4479: The name tf.truncated_normal is deprecated. Please use tf.random.truncated_normal instead.

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-6-269fe6fc6f99> in <module>()
----> 1 baseModel = enet.EfficientNetB1(weights="imagenet", include_top=False, input_tensor=Input(shape=(224, 224, 3)), pooling='avg')
      2 
      3 # Adding 2 fully-connected layers to B0.
      4 x = baseModel.output
      5 x = BatchNormalization()(x)

4 frames
/usr/local/lib/python3.6/dist-packages/efficientnet/__init__.py in wrapper(*args, **kwargs)
     42         kwargs['models'] = keras.models
     43         kwargs['utils'] = keras.utils
---> 44         return func(*args, **kwargs)
     45 
     46     return wrapper

/usr/local/lib/python3.6/dist-packages/efficientnet/model.py in EfficientNetB1(include_top, weights, input_tensor, input_shape, pooling, classes, **kwargs)
    494         input_tensor=input_tensor, input_shape=input_shape,
    495         pooling=pooling, classes=classes,
--> 496         **kwargs
    497     )
    498 

/usr/local/lib/python3.6/dist-packages/efficientnet/model.py in EfficientNet(width_coefficient, depth_coefficient, default_resolution, dropout_rate, drop_connect_rate, depth_divisor, blocks_args, model_name, include_top, weights, input_tensor, input_shape, pooling, classes, **kwargs)
    348                       use_bias=False,
    349                       kernel_initializer=CONV_KERNEL_INITIALIZER,
--> 350                       name='stem_conv')(x)
    351     x = layers.BatchNormalization(axis=bn_axis, name='stem_bn')(x)
    352     x = layers.Activation(activation, name='stem_activation')(x)

/usr/local/lib/python3.6/dist-packages/keras/engine/base_layer.py in __call__(self, inputs, **kwargs)
    435 
    436             # Handle mask propagation.
--> 437             previous_mask = _collect_previous_mask(inputs)
    438             user_kwargs = kwargs.copy()
    439             if not is_all_none(previous_mask):

/usr/local/lib/python3.6/dist-packages/keras/engine/base_layer.py in _collect_previous_mask(input_tensors)
   1303             inbound_layer, node_index, tensor_index = x._keras_history
   1304             node = inbound_layer._inbound_nodes[node_index]
-> 1305             mask = node.output_masks[tensor_index]
   1306             masks.append(mask)
   1307         else:

AttributeError: 'Node' object has no attribute 'output_masks'
@stvogel
Copy link

stvogel commented Jun 22, 2020

I have the same issue, when I use the input_tensor(!)-Parameter:

import efficientnet.keras as efn 
base_model = efn.EfficientNetB0(
    include_top=False, weights=None, 
    input_tensor=Input(shape=(244, 244, 3)))

By the way, I'm using tensorflow 2.2.

Sorry, I didn't follow the link, you provided. The solution (copied over from stackoverflow) is to fix the import, like this:

import efficientnet.tfkeras as efn

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants