def start_server(A_val, left_val): server = pk.FCEUXServer( lambda server, frame: on_frame(server, frame, A_val, left_val)) print(server.info) server.start()
inputs.append(img) outputs.append(joypad) print('Collected:', len(inputs), 'frames') def on_quit(): # Process the collected data inputs_numpy = np.array(inputs) outputs_numpy = [] for output in outputs: values = output.split() if (values[1] == 'true'): onehot = [1, 0, 0] elif (values[5] == 'true'): onehot = [0, 1, 0] else: onehot = [0, 0, 1] outputs_numpy.append(onehot) outputs_numpy = np.array(outputs_numpy) print('Collected', inputs_numpy.shape[0], 'frames.') if (inputs_numpy.shape[0] < 2000): print('Warning not enough data points.') save((inputs_numpy[:2000], outputs_numpy[:2000]), 'Data/' + filename) # Intialize and start server server = pk.FCEUXServer(on_frame, on_quit) print(server.info) server.start()