Created
May 14, 2019 04:23
-
-
Save lockdef/0870e6b09ad897e7659028f7889d7414 to your computer and use it in GitHub Desktop.
データセットの前処理
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from tensorflow.keras.utils import to_categorical | |
def preprocessing(data, ch=3, label=False): | |
if label: | |
return to_categorical(data) | |
data = data / 255.0 | |
w, h = data[0:3] | |
data = data.reshape((-1, w, h, ch)) | |
return data |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment