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

Preprocessing for mean standardization. #64

Closed
akirasosa opened this issue Nov 15, 2017 · 3 comments
Closed

Preprocessing for mean standardization. #64

akirasosa opened this issue Nov 15, 2017 · 3 comments

Comments

@akirasosa
Copy link

akirasosa commented Nov 15, 2017

I use Keras and use featurewise_center and featurewise_std_normalization. Then, I have mean and std for each channels.

But coreml provides only redBias, greenBias, blueBias and imageScale, so that I can not scale for each channels respectively.

Could you provide options something like redScale, greenScale and blueScale?

@aseemw
Copy link
Collaborator

aseemw commented Nov 27, 2017

@akirasosa To add this functionality a change needs to the made in the CoreML proto and Framework.
For now, I have a few suggestions for you to do this:

  • Do the processing in your app on the MLMutltiArray before feeding it to mlmodel
  • The "scale" layer in CoreML can do this kind of processing. You can modify the .mlmodel file and add the scale layer in the beginning with the appropriate channel scales.
  • You can also modify the Keras model before conversion. Keras does not have a scale layer but you can use the Batch normalization layer and set mean to 0, variance to 1, beta to 0 and gamma (a length 3 vector) to the channel scales.

@akirasosa
Copy link
Author

@aseemw
Thanks! The first option is handy for me.

To add this functionality a change needs to the made in the CoreML proto and Framework.

Is there a public github project for it? I would like to watch it.

@yonatanbitton
Copy link

Hey, is there a documented solution for it? I'm in the same situation. Thanks!

Birch-san pushed a commit to Birch-san/coremltools that referenced this issue Nov 27, 2022
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

3 participants