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

Featurewise zero center and featurewise stdnorm fix #478

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ziky90
Copy link
Contributor

@ziky90 ziky90 commented Nov 22, 2016

This PR fixes featurewise zero centring and normalization in order to work also with datasets that are not float32 eg. uint8 images.

It also replaces redundant for loop by numpy broadcasting.

@jakubsimanek
Copy link
Contributor

jakubsimanek commented Dec 2, 2016

This indeed fixes the issue where batch[i] has incompatible dtype with the self.global_mean.value

When batch[i].dtype is uint8 and self.global_mean.value.dtype is float64 the old implementation of _featurewise_zero_center results in:

   batch[i] -= self.global_mean.value
TypeError: Cannot cast ufunc subtract output from dtype('float64') to dtype('uint8') with casting rule 'same_kind'

@ziky90
Copy link
Contributor Author

ziky90 commented Dec 5, 2016

@aymericdamien is there any progress in reviewing this PR.
It attempts to fix quite serious bug in the tflearn/data_preprocessing.py. As @jakubsimanek writes caused by that numpy can't cast arrays using -= operation.

@arundasan91
Copy link

@ziky90 , This works. Thanks! 👍

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.

None yet

3 participants