diff --git a/keras-autoencoder/autoencoder.py b/keras-autoencoder/autoencoder.py index 6e9977507..9b99bffb0 100644 --- a/keras-autoencoder/autoencoder.py +++ b/keras-autoencoder/autoencoder.py @@ -5,7 +5,7 @@ from keras.callbacks import Callback import numpy as np import wandb -from wandb.wandb_keras import WandbKerasCallback +from wandb.keras import WandbCallback run = wandb.init() config = run.config @@ -41,7 +41,7 @@ def on_epoch_end(self, epoch, logs): model.fit(x_train, x_train, epochs=config.epochs, validation_data=(x_test, x_test), - callbacks=[Images(), WandbKerasCallback()]) + callbacks=[Images(), WandbCallback()]) model.save('auto-small.h5') diff --git a/keras-autoencoder/autoencoder_cnn.py b/keras-autoencoder/autoencoder_cnn.py index 83d978842..68f1eab3c 100644 --- a/keras-autoencoder/autoencoder_cnn.py +++ b/keras-autoencoder/autoencoder_cnn.py @@ -5,7 +5,7 @@ import numpy as np import wandb -from wandb.wandb_keras import WandbKerasCallback +from wandb.keras import WandbCallback run = wandb.init() config = run.config @@ -44,7 +44,7 @@ def on_epoch_end(self, epoch, logs): model.fit(x_train, x_train, epochs=config.epochs, validation_data=(x_test, x_test), - callbacks=[Images(), WandbKerasCallback()]) + callbacks=[Images(), WandbCallback()]) model.save('auto-cnn.h5') diff --git a/keras-autoencoder/denoising_autoencoder.py b/keras-autoencoder/denoising_autoencoder.py index 9dadc92f0..0b9b1e1f9 100644 --- a/keras-autoencoder/denoising_autoencoder.py +++ b/keras-autoencoder/denoising_autoencoder.py @@ -4,7 +4,7 @@ from keras.datasets import mnist import numpy as np import wandb -from wandb.wandb_keras import WandbKerasCallback +from wandb.keras import WandbCallback def add_noise(x_train, x_test): noise_factor = 0.5 @@ -50,7 +50,7 @@ def on_epoch_end(self, epoch, logs): model.fit(x_train_noisy, x_train, epochs=config.epochs, - validation_data=(x_test_noisy, x_test), callbacks=[Images(), WandbKerasCallback()]) + validation_data=(x_test_noisy, x_test), callbacks=[Images(), WandbCallback()]) model.save("auto-denoise.h5") diff --git a/keras-autoencoder/denoising_autoencoder_cnn.py b/keras-autoencoder/denoising_autoencoder_cnn.py index 8112d4520..21b7e40c2 100644 --- a/keras-autoencoder/denoising_autoencoder_cnn.py +++ b/keras-autoencoder/denoising_autoencoder_cnn.py @@ -4,7 +4,7 @@ from keras.datasets import mnist import numpy as np import wandb -from wandb.wandb_keras import WandbKerasCallback +from wandb.keras import WandbCallback def add_noise(x_train, x_test): noise_factor = 0.5 @@ -60,7 +60,7 @@ def on_epoch_end(self, epoch, logs): model.fit(x_train_noisy, x_train, epochs=config.epochs, - validation_data=(x_test_noisy, x_test), callbacks=[Images(), WandbKerasCallback()]) + validation_data=(x_test_noisy, x_test), callbacks=[Images(), WandbCallback()]) model.save("auto-denoise.h5") diff --git a/keras-autoencoder/wandb/settings b/keras-autoencoder/wandb/settings index 7b7de4f5c..2bfb3caab 100644 --- a/keras-autoencoder/wandb/settings +++ b/keras-autoencoder/wandb/settings @@ -1,4 +1,4 @@ [default] -entity: qualcomm -project: autoencoder-apr10 +entity: trainai +project: encoding base_url: https://api.wandb.ai diff --git a/keras-cnn/cnn.py b/keras-cnn/cnn.py index 0904fbe9d..fda16efb0 100644 --- a/keras-cnn/cnn.py +++ b/keras-cnn/cnn.py @@ -2,7 +2,7 @@ from keras.models import Sequential from keras.layers import Conv2D, MaxPooling2D, Dropout, Dense, Flatten from keras.utils import np_utils -from wandb.wandb_keras import WandbKerasCallback +from wandb.keras import WandbCallback import wandb run = wandb.init() @@ -23,6 +23,7 @@ y_train = np_utils.to_categorical(y_train) y_test = np_utils.to_categorical(y_test) num_classes = y_test.shape[1] +labels=range(10) # build model model = Sequential() @@ -41,4 +42,5 @@ model.summary() model.fit(X_train, y_train, validation_data=(X_test, y_test), - callbacks=[WandbKerasCallback()], epochs=config.epochs) + epochs=config.epochs, + callbacks=[WandbCallback(validation_data=X_test, labels=labels)]) diff --git a/keras-cnn/convolution-demo.py b/keras-cnn/convolution-demo.py index b6c6e463c..5d37b41d7 100644 --- a/keras-cnn/convolution-demo.py +++ b/keras-cnn/convolution-demo.py @@ -14,7 +14,7 @@ image = io.imread('dog.jpg', as_grey=True) kernel = [[0.0, 0.0, 0.0], - [0.5, 0.0, -0.5], + [0.0, 1.0, 0.0], [0.0, 0.0, 0.0]] new_image = convolve2d(image, kernel) diff --git a/keras-cnn/wandb/settings b/keras-cnn/wandb/settings index 0bc576ce4..d2076b025 100644 --- a/keras-cnn/wandb/settings +++ b/keras-cnn/wandb/settings @@ -1,4 +1,4 @@ [default] -entity: mlclass -project: cnn-may1 +entity: trainai +project: digits base_url: https://api.wandb.ai diff --git a/keras-encoding/wandb/settings b/keras-encoding/wandb/settings index 7bd130935..2bfb3caab 100644 --- a/keras-encoding/wandb/settings +++ b/keras-encoding/wandb/settings @@ -1,4 +1,4 @@ [default] -entity: mlclass -project: encoding-may1 +entity: trainai +project: encoding base_url: https://api.wandb.ai diff --git a/keras-fashion/wandb/settings b/keras-fashion/wandb/settings index 950d33a9d..91bdb3ce8 100644 --- a/keras-fashion/wandb/settings +++ b/keras-fashion/wandb/settings @@ -1,4 +1,4 @@ [default] -entity: mlclass -project: fashion-may1 +entity: trainai +project: fashion base_url: https://api.wandb.ai diff --git a/keras-mlp/dropout.py b/keras-mlp/dropout.py index bf7d16d5c..edc2f7db1 100644 --- a/keras-mlp/dropout.py +++ b/keras-mlp/dropout.py @@ -5,7 +5,7 @@ from keras.utils import np_utils import json -from wandb.wandb_keras import WandbKerasCallback +from wandb.keras import WandbCallback import wandb run = wandb.init() @@ -23,9 +23,10 @@ # one hot encode outputs y_train = np_utils.to_categorical(y_train) -num_classes = y_train.shape[1] - y_test = np_utils.to_categorical(y_test) +labels = range(10) + +num_classes = y_train.shape[1] # create model model=Sequential() @@ -40,4 +41,4 @@ # Fit the model model.fit(X_train, y_train, validation_data=(X_test, y_test), - callbacks=[WandbKerasCallback()], epochs=config.epochs) + epochs=config.epochs, callbacks=[WandbCallback(validation_data=X_test, labels=labels)]) diff --git a/keras-mlp/mlp.py b/keras-mlp/mlp.py index 5bca9c9b8..6ca41807b 100644 --- a/keras-mlp/mlp.py +++ b/keras-mlp/mlp.py @@ -6,7 +6,7 @@ from keras.callbacks import Callback import json -from wandb.wandb_keras import WandbKerasCallback +from wandb.keras import WandbCallback import wandb run = wandb.init() @@ -26,9 +26,11 @@ # one hot encode outputs y_train = np_utils.to_categorical(y_train) +y_test = np_utils.to_categorical(y_test) +labels = range(10) + num_classes = y_train.shape[1] -y_test = np_utils.to_categorical(y_test) # create model model=Sequential() @@ -38,25 +40,7 @@ model.compile(loss='categorical_crossentropy', optimizer=config.optimizer, metrics=['accuracy']) -class Images(Callback): - def on_epoch_end(self, epoch, logs): -# indices = np.random.randint(self.validation_data[0].shape[0], size=8) - test_data = self.validation_data[0][:10] - val_data = self.validation_data[1][:10] - - test_data = X_test[:10] - val_data = y_test[:10] - print(val_data) - - pred_data = self.model.predict(test_data) - run.history.row.update({ - "examples": [ - wandb.Image(test_data[i], caption=str(val_data[i])+str(np.argmax(val_data[i]))) for i in range(8) - ] - }) - - - # Fit the model -model.fit(X_train, y_train, validation_data=(X_test, y_test), - callbacks=[Images(), WandbKerasCallback()], epochs=config.epochs) +model.fit(X_train, y_train, validation_data=(X_test, y_test), + epochs=config.epochs, + callbacks=[WandbCallback(validation_data=X_test, labels=labels)]) diff --git a/keras-mlp/wandb/settings b/keras-mlp/wandb/settings index 7a97f5caf..d2076b025 100644 --- a/keras-mlp/wandb/settings +++ b/keras-mlp/wandb/settings @@ -1,4 +1,4 @@ [default] -entity: mlclass -project: mlp-may1 +entity: trainai +project: digits base_url: https://api.wandb.ai diff --git a/keras-perceptron/perceptron-linear.py b/keras-perceptron/perceptron-linear.py index 5b6b7ef00..52e5c8033 100644 --- a/keras-perceptron/perceptron-linear.py +++ b/keras-perceptron/perceptron-linear.py @@ -4,7 +4,7 @@ from keras.utils import np_utils import wandb -from wandb.wandb_keras import WandbKerasCallback +from wandb.keras import WandbCallback # logging code run = wandb.init() @@ -19,6 +19,7 @@ # one hot encode outputs y_train = np_utils.to_categorical(y_train) y_test = np_utils.to_categorical(y_test) +labels = range(10) num_classes = y_train.shape[1] @@ -31,6 +32,6 @@ # Fit the model model.fit(X_train, y_train, epochs=10, validation_data=(X_test, y_test), - callbacks=[WandbKerasCallback()]) + callbacks=[WandbCallback(validation_data=X_test, labels=labels)]) diff --git a/keras-perceptron/perceptron-log.py b/keras-perceptron/perceptron-log.py index 85383bfb6..25eb3c733 100644 --- a/keras-perceptron/perceptron-log.py +++ b/keras-perceptron/perceptron-log.py @@ -10,8 +10,8 @@ from keras.callbacks import TensorBoard import json -from wandb.wandb_keras import WandbKerasCallback import wandb +from wandb.keras import WandbCallback run = wandb.init() config = run.config @@ -29,6 +29,7 @@ # one hot encode outputs y_train = np_utils.to_categorical(y_train) y_test = np_utils.to_categorical(y_test) +labels = range(10) num_classes = y_train.shape[1] @@ -44,7 +45,7 @@ # Fit the model history = model.fit(X_train, y_train, epochs=config.epochs, batch_size=config.batch_size, validation_data=(X_test, y_test), - callbacks=[tensorboard, WandbKerasCallback()]) + callbacks=[tensorboard, WandbCallback(validation_data=X_test, labels=labels)]) # Final evaluation of the model scores = model.evaluate(X_test, y_test, verbose=0) diff --git a/keras-perceptron/perceptron-logistic.py b/keras-perceptron/perceptron-logistic.py index 7d699666d..59fca7e49 100644 --- a/keras-perceptron/perceptron-logistic.py +++ b/keras-perceptron/perceptron-logistic.py @@ -4,7 +4,7 @@ from keras.utils import np_utils import wandb -from wandb.wandb_keras import WandbKerasCallback +from wandb.keras import WandbCallback # logging code run = wandb.init() @@ -19,6 +19,7 @@ # one hot encode outputs y_train = np_utils.to_categorical(y_train) y_test = np_utils.to_categorical(y_test) +labels = range(10) num_classes = y_train.shape[1] @@ -31,4 +32,4 @@ # Fit the model model.fit(X_train, y_train, epochs=10, validation_data=(X_test, y_test), - callbacks=[WandbKerasCallback()]) + callbacks=[WandbCallback(validation_data=X_test, labels=labels)]) diff --git a/keras-perceptron/perceptron-normalize.py b/keras-perceptron/perceptron-normalize.py index 3e53be1dc..24d8c8569 100644 --- a/keras-perceptron/perceptron-normalize.py +++ b/keras-perceptron/perceptron-normalize.py @@ -4,7 +4,7 @@ from keras.layers import Dense, Flatten, Dropout from keras.utils import np_utils import wandb -from wandb.wandb_keras import WandbKerasCallback +from wandb.keras import WandbCallback # logging code run = wandb.init() @@ -24,6 +24,7 @@ # one hot encode outputs y_train = np_utils.to_categorical(y_train) y_test = np_utils.to_categorical(y_test) +labels = range(10) num_classes = y_train.shape[1] @@ -36,4 +37,5 @@ # Fit the model model.fit(X_train, y_train, epochs=10, validation_data=(X_test, y_test), - callbacks=[WandbKerasCallback()]) + callbacks=[WandbCallback(validation_data=X_test, labels=labels)]) + diff --git a/keras-perceptron/perceptron-single-fixed.py b/keras-perceptron/perceptron-single-fixed.py index c29040466..8751a8589 100644 --- a/keras-perceptron/perceptron-single-fixed.py +++ b/keras-perceptron/perceptron-single-fixed.py @@ -4,7 +4,7 @@ from keras.utils import np_utils import wandb -from wandb.wandb_keras import WandbKerasCallback +from wandb.keras import WandbCallback # logging code run = wandb.init() @@ -15,6 +15,7 @@ is_five_train = y_train == 5 is_five_test = y_test == 5 +labels = ["Not Five", "Is Five"] img_width = X_train.shape[1] img_height = X_train.shape[2] @@ -27,7 +28,6 @@ metrics=['binary_accuracy']) # Fit the model -model.fit(X_train[:1000], is_five_train[:1000], epochs=10, validation_data=(X_test, is_five_test), - callbacks=[WandbKerasCallback()]) +model.fit(X_train, is_five_train, epochs=10, validation_data=(X_test, is_five_test), + callbacks=[WandbCallback(validation_data=X_test, labels=labels)]) -print(model.predict(X_test[:20])) diff --git a/keras-perceptron/perceptron-single.py b/keras-perceptron/perceptron-single.py index c923c7e8a..8f5b0eb16 100644 --- a/keras-perceptron/perceptron-single.py +++ b/keras-perceptron/perceptron-single.py @@ -4,7 +4,7 @@ from keras.utils import np_utils import wandb -from wandb.wandb_keras import WandbKerasCallback +from wandb.keras import WandbCallback # logging code run = wandb.init() @@ -15,6 +15,7 @@ is_five_train = y_train == 5 is_five_test = y_test == 5 +labels = ["Not Five", "Is Five"] img_width = X_train.shape[1] img_height = X_train.shape[2] @@ -22,12 +23,12 @@ # create model model=Sequential() model.add(Flatten(input_shape=(img_width,img_height))) -model.add(Dense(1)) +model.add(Dense(1, activation="sigmoid")) model.compile(loss='mse', optimizer='adam', - metrics=['binary_accuracy']) + metrics=['accuracy']) # Fit the model model.fit(X_train, is_five_train, epochs=10, validation_data=(X_test, is_five_test), - callbacks=[WandbKerasCallback()]) + callbacks=[WandbCallback(validation_data=X_test, labels=labels)]) diff --git a/keras-perceptron/perceptron.py b/keras-perceptron/perceptron.py index 03c447270..94dde139c 100644 --- a/keras-perceptron/perceptron.py +++ b/keras-perceptron/perceptron.py @@ -4,7 +4,7 @@ from keras.layers import Dense, Flatten, Dropout from keras.utils import np_utils import wandb -from wandb.wandb_keras import WandbKerasCallback +from wandb.keras import WandbCallback # logging code run = wandb.init() @@ -19,6 +19,7 @@ # one hot encode outputs y_train = np_utils.to_categorical(y_train) y_test = np_utils.to_categorical(y_test) +labels = range(10) num_classes = y_train.shape[1] @@ -31,4 +32,4 @@ # Fit the model model.fit(X_train, y_train, epochs=10, validation_data=(X_test, y_test), - callbacks=[WandbKerasCallback()]) + callbacks=[WandbCallback(validation_data=X_test, labels=labels)]) diff --git a/keras-perceptron/wandb/settings b/keras-perceptron/wandb/settings index fda91ff9e..d2076b025 100644 --- a/keras-perceptron/wandb/settings +++ b/keras-perceptron/wandb/settings @@ -1,4 +1,4 @@ [default] -entity: mlclass -project: perceptron-may1 +entity: trainai +project: digits base_url: https://api.wandb.ai