batch_size = 128 nb_epoch = 100 nb_classes = 19 * 19 # One class for each position on the board go_board_rows, go_board_cols = 19, 19 # input dimensions of go board nb_filters = 32 # number of convolutional filters to use nb_pool = 2 # size of pooling area for max pooling nb_conv = 3 # convolution kernel size # SevenPlaneProcessor loads seven planes (doh!) of 19*19 data points, so we need 7 input channels processor = SevenPlaneProcessor() input_channels = processor.num_planes # Load go data and one-hot encode labels X, y = processor.load_go_data(num_samples=1000) X = X.astype('float32') Y = np_utils.to_categorical(y, nb_classes) # Specify a keras model with two convolutional layers and two dense layers, # connecting the (num_samples, 7, 19, 19) input to the 19*19 output vector. model = Sequential() model.add(Convolution2D(nb_filters, nb_conv, nb_conv, border_mode='valid', input_shape=(input_channels, go_board_rows, go_board_cols))) model.add(Activation('relu')) model.add(Convolution2D(nb_filters, nb_conv, nb_conv)) model.add(Activation('relu')) model.add(MaxPooling2D(pool_size=(nb_pool, nb_pool))) model.add(Dropout(0.25)) model.add(Flatten()) model.add(Dense(256))
batch_size = 128 nb_epoch = 100 nb_classes = 19 * 19 # One class for each position on the board go_board_rows, go_board_cols = 19, 19 # input dimensions of go board nb_filters = 32 # number of convolutional filters to use nb_pool = 2 # size of pooling area for max pooling nb_conv = 3 # convolution kernel size # SevenPlaneProcessor loads seven planes (doh!) of 19*19 data points, so we need 7 input channels processor = SevenPlaneProcessor(use_generator=True) input_channels = processor.num_planes # Load go data and one-hot encode labels data_generator = processor.load_go_data(num_samples=1000) print(data_generator.get_num_samples()) # Specify a keras model with two convolutional layers and two dense layers, # connecting the (num_samples, 7, 19, 19) input to the 19*19 output vector. model = Sequential() model.add(Convolution2D(nb_filters, nb_conv, nb_conv, border_mode='valid', input_shape=(input_channels, go_board_rows, go_board_cols))) model.add(Activation('relu')) model.add(Convolution2D(nb_filters, nb_conv, nb_conv)) model.add(Activation('relu')) model.add(MaxPooling2D(pool_size=(nb_pool, nb_pool))) model.add(Dropout(0.25)) model.add(Flatten()) model.add(Dense(256)) model.add(Activation('relu'))
model_file = os.path.join(model_zoo, args.bot_name + '_model.yml') batch_size = 128 nb_classes = 19 * 19 # One class for each position on the board go_board_rows, go_board_cols = 19, 19 # input dimensions of go board nb_filters = 32 # number of convolutional filters to use nb_pool = 2 # size of pooling area for max pooling nb_conv = 3 # convolution kernel size # SevenPlaneProcessor loads seven planes (doh!) of 19*19 data points, so we need 7 input channels processor = SevenPlaneProcessor(use_generator=True) input_channels = processor.num_planes # Load go data and one-hot encode labels data_generator = processor.load_go_data(num_samples=args.sample_size) print(data_generator.get_num_samples()) # Specify a keras model with two convolutional layers and two dense layers, # connecting the (num_samples, 7, 19, 19) input to the 19*19 output vector. model = Sequential() model.add(Convolution2D(nb_filters, nb_conv, nb_conv, border_mode='valid', input_shape=(input_channels, go_board_rows, go_board_cols))) model.add(Activation('relu')) model.add(Convolution2D(nb_filters, nb_conv, nb_conv)) model.add(Activation('relu')) model.add(MaxPooling2D(pool_size=(nb_pool, nb_pool))) model.add(Dropout(0.25)) model.add(Flatten()) model.add(Dense(256)) model.add(Activation('relu'))
batch_size = 128 nb_epoch = 100 nb_classes = 19 * 19 # One class for each position on the board go_board_rows, go_board_cols = 19, 19 # input dimensions of go board nb_filters = 32 # number of convolutional filters to use nb_pool = 2 # size of pooling area for max pooling nb_conv = 3 # convolution kernel size # SevenPlaneProcessor loads seven planes (doh!) of 19*19 data points, so we need 7 input channels processor = SevenPlaneProcessor(use_generator=True) input_channels = processor.num_planes # Load go data and one-hot encode labels data_generator = processor.load_go_data(num_samples=1000) print(data_generator.get_num_samples()) # Specify a keras model with two convolutional layers and two dense layers, # connecting the (num_samples, 7, 19, 19) input to the 19*19 output vector. model = Sequential() model.add( Convolution2D(nb_filters, nb_conv, nb_conv, border_mode='valid', input_shape=(input_channels, go_board_rows, go_board_cols))) model.add(Activation('relu')) model.add(Convolution2D(nb_filters, nb_conv, nb_conv)) model.add(Activation('relu')) model.add(MaxPooling2D(pool_size=(nb_pool, nb_pool)))