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

Question about changing the input size of YAMNet model to constant for TFlite applications #10235

Closed
jake-is-ESD-protected opened this issue Sep 1, 2021 · 2 comments
Assignees
Labels
models:research models that come under research directory type:feature

Comments

@jake-is-ESD-protected
Copy link

YAMNet is able to accept dynamically sized inputs to be able to process audio of different lenghts and sample rates. However, when trying to port this to TFlite a few problems arise as seen here.

A workaround could be to modify the input of YAMNet to only accept a fixed amount of samples (basically limiting the input to a certain sample rate and time window). It would be convenient to have an option to set an input size before converting the model to TFlite. If that's not possible, how would one be able to change the input layer of the model?

Note: this was tried by using the STM32 X CUBE AI model analyzer on a .tflite version of YAMNet with experimental_new_converter = True enabled. It returns the following message:

Neural Network Tools for STM32AI v1.5.1 (STM.ai v7.0.0-RC8) 
NOT IMPLEMENTED: Shape with 1 dimensions not supported: (1,)
@jake-is-ESD-protected jake-is-ESD-protected added models:research models that come under research directory type:feature labels Sep 1, 2021
@kumariko kumariko assigned kumariko, dpwe and plakal and unassigned kumariko Sep 1, 2021
@plakal
Copy link
Collaborator

plakal commented Sep 2, 2021

We have released a couple of different TF-Lite versions of YAMNet on TF-Hub:

It's not clear to me how you are converting YAMNet to TF-Lite and I know nothing about the analyzer tool you are using, but note that the latest version of TF-Lite naturally supports variable-length inputs. If you need fixed length inputs because you want the model to be quantized or because your tool is having problems with variable-length inputs, then perhaps you could try the quantized model that I linked above.

@tonyrusignuolo
Copy link

We have released a couple of different TF-Lite versions of YAMNet on TF-Hub:

It's not clear to me how you are converting YAMNet to TF-Lite and I know nothing about the analyzer tool you are using, but note that the latest version of TF-Lite naturally supports variable-length inputs. If you need fixed length inputs because you want the model to be quantized or because your tool is having problems with variable-length inputs, then perhaps you could try the quantized model that I linked above.

Disclaimer: I know very little about ML/AI.
I want to use the second fixed input size model you linked to to do classification on a coral edge device, but use my own labels (i.e. transfer learning). But as I understand, I can't do transfer learning on tflite files, and, if I were to transfer learn on the first dynamic size input model you linked to, that won't work on the coral edge board bc of the dynamic size inputs. Could you make the tf model for the second link available so I can transfer learn on it? Or is there a simpler process that I'm unaware of?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
models:research models that come under research directory type:feature
Projects
None yet
Development

No branches or pull requests

5 participants