Last active
June 18, 2018 14:30
-
-
Save siakon89/a8dd8cc5ff2eaf1712d4c1fd268dd781 to your computer and use it in GitHub Desktop.
The Keras model for the object detection
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import keras | |
from keras.models import Sequential | |
from keras.utils import np_utils | |
from keras.preprocessing.image import ImageDataGenerator | |
from keras.layers import Dense, Activation, Flatten, Dropout, BatchNormalization | |
from keras.layers import Conv2D, MaxPooling2D | |
from keras.datasets import cifar10 | |
from keras import regularizers | |
from keras.callbacks import LearningRateScheduler | |
import numpy as np | |
# Create the model | |
model = Sequential() | |
model.add(Conv2D(32, (3, 3), padding='same', | |
input_shape=x_train.shape[1:])) | |
model.add(Activation('relu')) | |
model.add(Conv2D(32, (3, 3))) | |
model.add(Activation('relu')) | |
model.add(MaxPooling2D(pool_size=(2, 2))) | |
model.add(Dropout(0.25)) | |
model.add(Conv2D(64, (3, 3), padding='same')) | |
model.add(Activation('relu')) | |
model.add(Conv2D(64, (3, 3))) | |
model.add(Activation('relu')) | |
model.add(MaxPooling2D(pool_size=(2, 2))) | |
model.add(Dropout(0.25)) | |
model.add(Flatten()) | |
model.add(Dense(512)) | |
model.add(Activation('relu')) | |
model.add(Dropout(0.5)) | |
model.add(Dense(num_classes)) | |
model.add(Activation('softmax')) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment