def __init__(self,type='nn'): self.num_classes = 10 self.history = None self.epoch = 10 self.verbose = True self.info = Info() if type == 'nn': self.model = Sequential() self.model.add(Dense(128,input_shape=(784,),activation='relu')) self.model.add(Dense(128,activation='relu')) self.model.add(Dense(self.num_classes,activation='softmax')) elif type == 'cnn': self.model = Sequential() self.model.add(Conv2D(32, (3, 3), padding='same', input_shape=(32, 32, 3),activation='relu')) #model.add(Activation('relu')) self.model.add(Conv2D(32,(3, 3),activation='relu')) #model.add(Activation('relu')) self.model.add(MaxPooling2D(pool_size=(2, 2))) #model.add(Dropout(0.25)) self.model.add(Conv2D(64, (3, 3), padding='same',activation='relu')) #model.add(Activation('relu')) self.model.add(Conv2D(64, (3,3),activation='relu')) #model.add(Activation('relu')) self.model.add(MaxPooling2D(pool_size=(2, 2))) #model.add(Dropout(0.25)) self.model.add(Flatten()) self.model.add(Dense(512,activation='relu')) #model.add(Activation('relu')) #model.add(Dropout(0.5)) self.model.add(Dense(self.num_classes,activation='softmax'))
def __init__(self): self.dim = 64 self.num_classes = 10 self.history = None self.epoch = 1 input_shape = (32, 32, 3) self.info = Info() self.model = Sequential() self.model.add( Conv2D(32, (3, 3), padding='same', input_shape=input_shape, activation='relu')) self.model.add(Conv2D(32, (3, 3), activation='relu')) self.model.add(MaxPooling2D(pool_size=(2, 2))) self.model.add(Dropout(0.25)) self.model.add(Conv2D(64, (3, 3), padding='same', activation='relu')) self.model.add(Conv2D(64, (3, 3), activation='relu')) self.model.add(MaxPooling2D(pool_size=(2, 2))) self.model.add(Dropout(0.25)) self.model.add(Flatten()) self.model.add(Dense(512, activation='relu')) self.model.add(Dropout(0.5)) self.model.add(Dense(self.num_classes, activation='softmax'))
def __init__(self): self.dim = 64 self.num_classes = 10 self.history = None self.epoch = 10 self.info = Info() self.count = 0 self.model = Sequential() self.model.add(Dense(50,input_shape=(784,),activation='relu')) self.model.add(Dense(self.num_classes,activation='softmax')) self.y = self.model.output self.var_list = self.model.trainable_weights
def run(): pygame.init() pygame.font.init() set = Setting() screen = pygame.display.set_mode((set.width, set.height)) info = Info(screen, set) pygame.display.set_caption("TicTac") blocks = Group() winpage = WinPage(screen, set, info) pausepage = PausePage(screen, set, info) pages = {} pages['Win'] = winpage pages['Pause'] = pausepage pages['Play'] = PlayPage(screen, set, info, blocks) create_board(screen, set, blocks) while True: check_event(screen, set, blocks, info, pages) update_screen(screen, set, blocks, info, pages)
def __init__(self): self.dim = 64 self.num_classes = 10 self.history = None self.epoch = 10 self.info = Info() self.model = Sequential() self.model.add(Dense(50, input_shape=(784, ), activation='relu')) self.model.add(Dense(self.num_classes, activation='softmax')) self.tbCallBack = TensorBoard(log_dir='./logs/mnist_drift/kal/', histogram_freq=0, write_graph=True, write_grads=True, write_images=True, embeddings_freq=0, embeddings_layer_names=None, embeddings_metadata=None)