Tensorflow - CNN modeling cheet sheet
Library import tensorflow as tf from keras.models import Sequential from keras.layers import Dense, Flatten from keras.layers import Conv2D, MaxPooling2D Modeling def CNN_model() : class myCallback(tf.keras.callbacks.Callback): def on_epoch_end(self, epoch, logs={}) : if logs.get('val_accuracy') >= 0.96 : print('\nReached 96% accuracy so cancelling training!') self.model.stop_training=True my_ca..
- AI & ML/Machine Learning (Python)
- · 2022. 6. 14.
Tensorflow - mnist cheet sheet
def train_mnist(): class myCallback(tf.keras.callbacks.Callback): def on_epoch_end(self, epoch, logs={}) : if logs.get('val_accuracy') > 0.98 : print('\nReached 98% accuracy so cancelling training!') self.model.stop_training=True my_callback = myCallback() mnist = tf.keras.datasets.mnist (X_train, y_train),(X_test, y_test) = mnist.load_data() X_train = X_train / 255.0 X_test = X_test / 255.0 mod..
- AI & ML/Machine Learning (Python)
- · 2022. 6. 14.