October 2018
Intermediate to advanced
472 pages
10h 57m
English
This module implements the training and evaluation of a convolution classifier:
"""This module implements a simple convolution classifier."""import numpy as npfrom keras.datasets import mnistfrom keras.models import Sequentialfrom keras.layers import Dense, Conv2D, Flattenimport matplotlib.pyplot as pltfrom sklearn.model_selection import train_test_splitfrom loss_plot import loss_plot# Number of epochsepochs = 20# Batchsizebatch_size = 128# Optimizer for the generatorfrom keras.optimizers import Adamoptimizer = Adam(lr=0.0001)# Shape of the input imageinput_shape = (28,28,1)(X_train, y_train), (X_test, y_test) = mnist.load_data()X_train, X_val, y_train, y_val = train_test_split(X_train, y_train, stratify = y_train, ...
Read now
Unlock full access