示例#1
0
# import arch
import smallarch as arch
from keras.models import Sequential
from keras.layers.core import Dense
from keras.callbacks import ModelCheckpoint
from keras.utils import to_categorical

go_board_rows, go_board_cols = 19, 19
num_classes = go_board_rows * go_board_cols
num_games = 100
# encoder = OnePlaneEncoder((go_board_rows, go_board_cols))
encoder = SevenPlaneEncoder((go_board_rows, go_board_cols))

processor = DataProcessor(encoder)

generator = processor.load_go_data('train', num_games, use_generator=True)
X = generator.generate(32, num_classes)
print(X)
# test_generator =processor.load_go_data('test', num_games,use_generator=True)

# from split import Splitter
# dir = 'dataset/data'
# splitter = Splitter(data_dir=dir)
# data = splitter.draw_data('train', num_games)
# data_test = splitter.draw_data('test', num_games)

# generator = DataGenerator(dir, data)
# test_generator = DataGenerator(dir,data_test)

# input_shape = (encoder.num_planes, go_board_rows, go_board_cols)
# network_layers = arch.layers(input_shape)
示例#2
0
from dataprocessor import DataProcessor
# pass the encoder
# processor = DataProcessor()
# features, labels = processor.load_go_data('train', 100)

from encoder.oneplane import OnePlaneEncoder
encoder = OnePlaneEncoder((19, 19))

processor = DataProcessor(encoder)
generator = processor.load_go_data('train', 100, use_generator=True)
print(generator.get_num_samples())
generator = generator.generate(batch_size=10)
# X, y = generator.next() # implement next ??