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.

Unknown layer: AnchorBoxes

See original GitHub issue

Sorry ,I’m s a rookie in keras & Neural network. Pardom,can I ask you a question?

I complete the model training and save model & weights,but when I want to load model next time , there will be mistakes : ValueError: Unknown layer: AnchorBoxes #load model && load weights model = load_model('./model/ssd7_0.h5') model.load_weights('./model/ssd7_0_weights.h5') I really want to know how to solve this problem,would like to ask about the experienced elders. thankes!

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

3reactions
pierluigiferraricommented, Nov 14, 2017

@gloddream There definitely is, i just haven’t figured out how yet. i’ve recently implemented the get_config() method in both of the custom layers (L2Normalization and AnchorBoxes), so you should theoretically be able to load the model using

model = load_model('./model/ssd7_0.h5', custom_objects={'AnchorBoxes': AnchorBoxes, 'L2Normalization': L2Normalization, 'SSDLoss': SSDLoss})

but for some reason either model.save or load_model isn’t able to use the dictionaries that get_config() provides correctly. Since Keras documentation regarding saving and loading models with custom objects is basically non-existent and as far as I can tell I implemented the relevant methods in my layers exactly like the Keras core layers implement them, I didn’t bother trying around any longer since I had other stuff to do. If you figure out how to make it work, let me know 🙂

0reactions
sachinkmohancommented, Jan 27, 2021

Hi @pierluigiferrari ! I am so thankful for finding your repository! Great work!!

I know this issue is resolved. But I was trying to apply quantization(tensorflow model optimisation technique) to your repository and again encountered the AnchorBoxes issue. As an author of this repository, I thought you would be the best person to check the issue with. Any inputs from your end will be of great help.

I have detailed this on tensorflow model optimization issues page. Link here

The above mentioned problem is now resolved under tensorflow/model-optimization#620.

All thanks to @Hackerman28 !! 😄

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unknown layer: AnchorBoxes quantization tensorflow
I am applying quantization to a SSD model. The gist is attached. There is a custom object called "AnchorBoxes ...
Read more >
Unknown Layer: Anchorboxes Quantization ... - ADocLib
In this paper we go further in robotic grasp detection with fully convolutional neural network and oriented anchor boxes which are proved to...
Read more >
keras.models.load_model ValueError: Unknown layer
ValueError: Unknown layer: Functional. i'm using the following command in python: from tensorflow import keras.
Read more >
Detect objects using YOLO v4 object detector - MATLAB
The yolov4ObjectDetector object creates a you only look once version 4 (YOLO v4) one-stage object detector for detecting objects in an image.
Read more >
FPN_CNN_Object_detection_Cu...
This class has operations to generate anchor boxes for feature maps ... Layer): """Builds the Feature Pyramid with the feature maps from the ......
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