question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ValueError: No such layer: P3

See original GitHub issue

One issue when I convert the train model to inference model:

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-7-8c208d1cf44b> in <module>()
----> 1 inference_model = retinanet_bbox(model=model)

~/RCNN/keras-retinanet/keras_retinanet/models/retinanet.py in retinanet_bbox(model, anchor_parameters, nms, class_specific_filter, name, **kwargs)
    335 
    336     # compute the anchors
--> 337     features = [model.get_layer(p_name).output for p_name in ['P3', 'P4', 'P5', 'P6', 'P7']]
    338     anchors  = __build_anchors(anchor_parameters, features)
    339 

~/RCNN/keras-retinanet/keras_retinanet/models/retinanet.py in <listcomp>(.0)
    335 
    336     # compute the anchors
--> 337     features = [model.get_layer(p_name).output for p_name in ['P3', 'P4', 'P5', 'P6', 'P7']]
    338     anchors  = __build_anchors(anchor_parameters, features)
    339 

~/.conda/envs/21/lib/python3.6/site-packages/keras/engine/network.py in get_layer(self, name, index)
    363                 return layer
    364 
--> 365         raise ValueError('No such layer: ' + name)
    366 
    367     @property

ValueError: No such layer: P3

However, in retinanet.py __create_pyramid_features(C3, C4, C5, feature_size=256), we can find the codes already included the name='P3' :

...
    # add P4 elementwise to C3
    P3 = keras.layers.Conv2D(feature_size, kernel_size=1, strides=1, padding='same', name='C3_reduced')(C3)
    P3 = keras.layers.Add(name='P3_merged')([P4_upsampled, P3])
    P3 = keras.layers.Conv2D(feature_size, kernel_size=3, strides=1, padding='same', name='P3')(P3)
...

Does anybody know what is going wrong? Thanks in advance!

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
hgaisercommented, Aug 1, 2018

I’m not sure if the multi-gpu model can easily be converted back to a non-multi-gpu model. What did you change in train.py? By default, model should be saved, which is the non-multi-gpu model even if you enable multi-gpu.

0reactions
15241192958commented, May 14, 2020

I trained again and saved the inference model. The inference model is working just fine, though I don’t know if it is multi-gpu model or not. Thanks!

excuse me ? can you tell me how to save the inference model?

Read more comments on GitHub >

github_iconTop Results From Across the Web

No such layer - Extracting the output of a tensorflow keras layer
Value Error : No such layer - Extracting the output of a tensorflow keras layer · The variable name is thelayer not the...
Read more >
Keras-io/Lobby - Gitter
Is there asyncio support for training and prediction using keras? ... get_layer raise ValueError('No such layer: ' + name) ValueError: No such layer:...
Read more >
Raise ValueError(f'No such layer: {name}. Existing layers are
I am trying to run the following code but I get this error how can I resolve it """ Encoder """ s1 =...
Read more >
Mobilenet Model with submission | Kaggle
Explore and run machine learning code with Kaggle Notebooks | Using data from ... Conv2D(32, (3, 3), activation='relu', padding='same') (c3) p3 = layers....
Read more >
A `Concatenate` layer should be called on a list of at least 2 ...
This error is coming because concatenate expects list of tensors to be concatenated. While you are passing graph and graph_1 which is not...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found