Copyright(c) 2020-
Author: Chaitanya Tejaswi (github.com/CRTejaswi) License: GPL v3.0+
Personal notes on image processing.
- SciPy Stack
Install the SciPy stack if not already installed.
python -m pip install --user numpy scipy matplotlib ipython jupyter pandas sympy nose
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense, Dropout, Flatten
from tensorflow.keras.layers import Conv2D, MaxPooling2D
from tensorflow.keras import backend as K
from tensorflow.keras.optimizers import SGD
model = Sequential()
model.add(Conv2d(32, kernel_size=(3, 3), activation='relu', input_shape=input_shape))
model.add(MaxPooling2D(pool_size=(2, 2)))
model.add(Flatten())
model.add(Dense(num_classes, activation='softmax'))
model.compile(loss='categorical_crossentropy',
optimizer=SGD(0.01),
metrics=['accuracy'])
model.fit(x_train,
y_train,
batch_size=batch_size,
epochs=epochs,
verbose=1,
validation_data=(x_test, y_test))