def make_teacher_model(train_data, validation_data, nb_epoch=3):
 model = Sequential()
 model.add(Conv2D(64, 3, 3, input_shape=input_shape, border_mode='same', name='conv1'))
 model.add(MaxPooling2D(name='pool1'))
 model.add(Conv2D(64, 3, 3, border_mode='same', name='conv2'))
 model.add(MaxPooling2D(name='pool2'))
 model.add(Flatten(name='flatten'))
 model.add(Dense(64, activation='relu', name='fc1'))
 model.add(Dense(nb_class, activation='softmax', name='fc2'))
 model.compile(loss='categorical_crossentropy', optimizer=SGD(lr=0.01, momentum=0.9), metrics=['accuracy'])
 (train_x, train_y) = train_data
 history = model.fit(train_x, train_y, nb_epoch=nb_epoch, validation_data=validation_data)
 return (model, history)

def make_teacher_model ( train_data , validation_data , nb_epoch = 3 ) : model = Sequential ( ) model . add ( Conv2D ( 64 , 3 , 3 , input_shape = input_shape , border_mode = 'same' , name = 'conv1' ) ) model . add ( MaxPooling2D ( name = 'pool1' ) ) model . add ( Conv2D ( 64 , 3 , 3 , border_mode = 'same' , name = 'conv2' ) ) model . add ( MaxPooling2D ( name = 'pool2' ) ) model . add ( Flatten ( name = 'flatten' ) ) model . add ( Dense ( 64 , activation = 'relu' , name = 'fc1' ) ) model . add ( Dense ( nb_class , activation = 'softmax' , name = 'fc2' ) ) model . compile ( loss = 'categorical_crossentropy' , optimizer = SGD ( lr = 0.01 , momentum = 0.9 ) , metrics = [ 'accuracy' ] ) ( train_x , train_y ) = train_data history = model . fit ( train_x , train_y , nb_epoch = nb_epoch , validation_data = validation_data ) return ( model , history )
train a simple cnn as teacher model .