'--log_name', metavar='T', default='test', help='The name of the log file to be created by the scripts') argparser.add_argument( '--avoid-stopping', default=True, action='store_false', help=' Uses the speed prediction branch to avoid unwanted agent stops') argparser.add_argument( '--continue-experiment', action='store_true', help='If you want to continue the experiment with the given log name') args = argparser.parse_args() log_level = logging.DEBUG if args.debug else logging.INFO logging.basicConfig(format='%(levelname)s: %(message)s', level=log_level) logging.info('listening to server %s:%s', args.host, args.port) agent = ImitationLearning(args.city_name, args.avoid_stopping) if args.test_name == 'CORL2017': corl = CoRL2017(args.city_name) else: corl = trainingData(args.city_name) # Now actually run the driving_benchmark run_driving_benchmark(agent, corl, args.city_name, args.log_name, args.continue_experiment, args.host, args.port)
import h5py import numpy as np from agents.imitation.imitation_learning import ImitationLearning learner = ImitationLearning("Town01", False) data = h5py.File("/localdata2/yasasaa/dataset1.h5") images = list(data["images"]) outputs = list(data["outputs"]) speeds = list(data["speeds"]) cmds = [2.] * len(images) learner.train_model(images, speeds, cmds, outputs, epochs=500)
def main(): argparser = argparse.ArgumentParser( description='CARLA Manual Control Client') argparser.add_argument('-v', '--verbose', action='store_true', dest='debug', help='print debug information') argparser.add_argument('--host', metavar='H', default='localhost', help='IP of the host server (default: localhost)') argparser.add_argument('-p', '--port', metavar='P', default=2000, type=int, help='TCP port to listen to (default: 2000)') argparser.add_argument('-a', '--autopilot', action='store_true', help='enable autopilot') argparser.add_argument('-l', '--lidar', action='store_true', help='enable Lidar') argparser.add_argument( '-q', '--quality-level', choices=['Low', 'Epic'], type=lambda s: s.title(), default='Epic', help= 'graphics quality level, a lower level makes the simulation run considerably faster.' ) argparser.add_argument( '-m', '--map-name', metavar='M', default=None, help='plot the map of the current city (needs to match active map in ' 'server, options: Town01 or Town02)') argparser.add_argument( '--avoid-stopping', default=True, action='store_false', help= ' Uses the speed prediction branch to avoid unwanted NN agent stops') args = argparser.parse_args() log_level = logging.DEBUG if args.debug else logging.INFO logging.basicConfig(format='%(levelname)s: %(message)s', level=log_level) logging.info('listening to server %s:%s', args.host, args.port) print(__doc__) while True: try: with make_carla_client(args.host, args.port) as client: client.load_settings(CarlaSettings()) client.start_episode(0) NNagent = ImitationLearning(args.map_name, args.avoid_stopping) game = CarlaGame(client, NNagent, args) game.execute() break except TCPConnectionError as error: logging.error(error) time.sleep(1)
'(needs to match active town in server, options: Town01 or Town02)') argparser.add_argument( '-n', '--log_name', metavar='T', default='test', help='The name of the log file to be created by the scripts') args = argparser.parse_args() log_level = logging.DEBUG if args.debug else logging.INFO logging.basicConfig(format='%(levelname)s: %(message)s', level=log_level) logging.info('listening to server %s:%s', args.host, args.port) agent = ImitationLearning(args.city_name) while True: try: with make_carla_client(args.host, args.port) as client: corl = CoRL2017(args.city_name, args.log_name) results = corl.benchmark_agent(agent, client) corl.plot_summary_test() corl.plot_summary_train() break except TCPConnectionError as error: logging.error(error)