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

Added support for Resizing op #36

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Pascal0902
Copy link

Hello everyone,

this PR aims to enable Resizing op support. The implementation translates tensorflow resizing ops into NCNN Interpolation Ops.

As ncnn expects a scale factor for these ops, the input shape of the layer must be known. I am currently using keras to load the model and determine the input_shape. There would be other ways that don't require keras, if you want to use one of those instead please feel free to do so.

To my knowledge NCNN currently only supports the "bilinear" and "nearest" interpolation methods, so using any other interpolation method will raise an Error while converting the model.

The implementation worked flawlessly in my tests. Please feel free to perform your own tests, since a second pair of eyes is always appreciated.

@MarsTechHAN
Copy link
Owner

Cool. Thanks for the PR!

Light and not requiring keras or tf is something that I am trying to achieve. Maybe you can take a look at this code I wrote for another project for static shape inference, hmmm let me think for a momet.

https://github.com/microsoft/nn-Meter/blob/a478371d309a53fdd19f4d1c497017c5aabb902a/nn_meter/ir_converters/frozenpb_converter/shape_inference.py

@Pascal0902
Copy link
Author

Thanks for the reply!

I looked at the code you send, should work for this case as well. Needs some changes to work in this project of course.

I will test that code and update the PR as soon as I find the time.

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

Successfully merging this pull request may close these issues.

2 participants