Skip to content

Instantly share code, notes, and snippets.

@lockdef
Created May 14, 2019 04:23
Show Gist options
  • Save lockdef/0870e6b09ad897e7659028f7889d7414 to your computer and use it in GitHub Desktop.
Save lockdef/0870e6b09ad897e7659028f7889d7414 to your computer and use it in GitHub Desktop.
データセットの前処理
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