Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 18 additions & 4 deletions Section #4 - Capstone/simpsons.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@
"import numpy as np\n",
"import cv2 as cv\n",
"import gc\n",
"import tensorflow as tf\n",
"import keras\n",
"from keras.models import Sequential, Model\n",
"from keras.layers import Conv2D, Flatten, MaxPooling2D, Dense, Input, Reshape, Concatenate, GlobalAveragePooling2D, BatchNormalization, Dropout, Activation, GlobalMaxPooling2D\n",
"from keras.utils import Sequence\n",

"#pylint:disable=no-member (Removes linting problems with cv)"
],
"outputs": [],
Expand Down Expand Up @@ -245,9 +251,16 @@
"execution_count": null,
"source": [
"# Create our model (returns a compiled model)\n",
"model = canaro.models.createSimpsonsModel(IMG_SIZE=IMG_SIZE, channels=channels, output_dim=len(characters), \n",
" loss='binary_crossentropy', decay=1e-7, learning_rate=0.001, momentum=0.9,\n",
" nesterov=True)"
"def create_ST_layer(input_shape = (64, 128, 3)):\n",
"input_img = Input(shape=input_shape)\n",
"model = Conv2D(48, kernel_size=(5, 5), input_shape = input_shape, strides = (1, 1), activation = 'relu')(input_img)\n",
"model = MaxPooling2D(pool_size=(2, 2), strides = (2, 2))(model)\n",
"model = Conv2D(32, kernel_size=(5, 5), strides = (1, 1), activation = 'relu')(model)\n",
"model = MaxPooling2D(pool_size=(2, 2), strides = (2, 2))(model)\n",
"model = Dense(50, activation = 'relu')(model)\n",
"model = Dense(6)(model)\n",
"model = tf.keras.Model(inputs=input_img, outputs= model)\n",
"return model"
],
"outputs": [],
"metadata": {
Expand All @@ -259,6 +272,7 @@
"cell_type": "code",
"execution_count": null,
"source": [
"model = create_ST_layer()\n",
"model.summary()"
],
"outputs": [],
Expand Down Expand Up @@ -368,4 +382,4 @@
}
}
]
}
}