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

Getting the output from intermediate layers in the mobilenetv2 network #11

Open
letdivedeep opened this issue May 21, 2021 · 2 comments

Comments

@letdivedeep
Copy link

letdivedeep commented May 21, 2021

@hollance

I am trying to get the intermediate layer(add_node) output and merge it into the existing model outputs (confidences and coordinates)

Experiments :

  • Was able to get the add output from the ssd model, also passed this output as an input to decode model stage where i just add a dummy permute node.
  • In the NMS model, it has a fixed set of inputs and outputs set by (confidenceInputFeatureName, confidenceOutputFeatureName ..etc) didn't find anything to forcefully create a new input as its set by the NMS_suppression.proto file
  • So thought of creating a new model part that takes input as the NMS outputs(confidences and coordinates) and the previous decode layer add_output.

with this the coreml model is created as attached below.
Screenshot 2021-05-21 at 10 40 11 AM

But while loading it on through python it gives

an error saying:
RuntimeWarning: You will not be able to run predict() on this Core ML model. Underlying exception message was: Error compiling model: "Error reading protobuf spec. validator error: Pipeline: Input 'confidence' of model 'CoreML.Specification.ModelDescription' does not match the type previously specified by the pipeline input or the output of a previous model.".
predict_error

I am assuming this error is prompted bcoz the new model created is taking the input, not from the intermediate layer. Can we add a dummy node in the NMS model to bypass this ... any thoughts on this will be helpful or even is this the correct way of doing it.

I have attached the coreml and convert pythod code used

Archive.zip

@hollance
Copy link
Owner

You don't need to make another model. It should be sufficient to just create a new output on the SSD model, then make an output with the same name in the pipeline model. You don't need to pass this output through the other models.

@letdivedeep
Copy link
Author

Kudos

@hollance. Thanks for your reply.

I tried the above approach, it worked.

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