Skip to content

Latest commit

 

History

History
44 lines (35 loc) · 1.18 KB

imaging.md

File metadata and controls

44 lines (35 loc) · 1.18 KB
Copyright(c) 2020-
Author: Chaitanya Tejaswi (github.com/CRTejaswi)    License: GPL v3.0+

Image Processing

Personal notes on image processing.

Index

Software Setup

  • SciPy Stack
    Install the SciPy stack if not already installed.
    python -m pip install --user numpy scipy matplotlib ipython jupyter pandas sympy nose
    

CNN: Workflow

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))

References