if __name__ == '__main__': parser = argparse.ArgumentParser(description='Assurance Monitoring for RL-based emergency braking system.') parser.add_argument("-g", "--gui", help="set gui mode.", action="store_true") parser.add_argument("-t", "--testing", help="set testing mode", action="store_true", default=False) parser.add_argument("-cp", "--collect_perception", help="collect the data for perception training") parser.add_argument("-ca", "--collect_detector", help="collect the data for detector training") parser.add_argument("-p", "--perception", help="set the path of perception neural network") parser.add_argument("-e", "--episode", help="set the number of episode", type=int, default=1) args = parser.parse_args() try: os.environ["CUDA_DEVICE_ORDER"]="PCI_BUS_ID" os.environ["CUDA_VISIBLE_DEVICES"]="0" # specify which GPU(s) to be used collect = args_assertions(args) env = SetupWorld(mass=1300, wheel_radius=0.04, dt=0.05, collect=collect) agent = ddpgAgent(Testing=args.testing) input_preprocessor = InputPreprocessor() avf=AVF_search() stopdist=6.0 print('Number of episodes :',args.episode) for episode in range(args.episode): #while stopdist>5.0: agnt_number=2000; numberofsamples=2000 initial_distance = np.random.normal(100, 1) initial_speed = np.random.normal(38,11) #initial_speed = avf.avf_predictor(numberofsamples,agnt_number) if initial_speed <1 : initial_speed=1 friction=np.random.normal(0.7,0.15) if friction<=0 : friction=0
parser = argparse.ArgumentParser(description='Assurance Monitoring for RL-based emergency braking system.') parser.add_argument("-g", "--gui", help="set gui mode.", action="store_true") parser.add_argument("-t", "--testing", help="set testing mode", action="store_true", default=False) parser.add_argument("-cp", "--collect_perception", help="collect the data for perception training") parser.add_argument("-ca", "--collect_detector", help="collect the data for detector training") parser.add_argument("-p", "--perception", help="set the path of perception neural network") parser.add_argument("-e", "--episode", help="set the number of episode", type=int, default=1) args = parser.parse_args() try: collect = args_assertions(args) carla_server = ServerManagerBinary({'CARLA_SERVER': os.environ["CARLA_SERVER"]}) carla_server.reset(port=2002) carla_server.wait_until_ready() env = SetupWorld(town=1, gui=args.gui, collect=collect, perception=args.perception) agent = ddpgAgent(Testing=args.testing) input_preprocessor = InputPreprocessor() total_episode_count=[] avf_model = tf.keras.models.load_model('./DATA/saved_model/my_model') samples_per_iteration=100 container = np.load('./DATA/stdmean.npz') for episode in range(args.episode): #Generating data stream random_seed=np.random.randint(1,10000) np.random.seed(random_seed) candidate_initial_speed =5+40*(np.random.rand(samples_per_iteration,1).reshape(-1,1)) random_seed=np.random.randint(1,10000) np.random.seed(random_seed)
parser.add_argument("-e", "--episode", help="set the number of episode", type=int, default=1) args = parser.parse_args() try: collect = args_assertions(args) carla_server = ServerManagerBinary( {'CARLA_SERVER': os.environ["CARLA_SERVER"]}) carla_server.reset() carla_server.wait_until_ready() env = SetupWorld(town=1, gui=args.gui, collect=collect, perception=args.perception) agent = ddpgAgent(Testing=args.testing) input_preprocessor = InputPreprocessor() for episode in range(args.episode): initial_distance = np.random.normal(100, 1) initial_speed = np.random.uniform(5, 45) #initial_speed =45 s = env.reset(initial_distance, initial_speed) print( "Episode {} is started, target distance: {}, target speed: {}, initial distance: {}, initial speed: {}" .format(episode, initial_distance, initial_speed, s[0], s[1])) s = input_preprocessor(s) epsilon = 1.0 - (episode + 1) / (args.episode) while True: a = agent.getAction(s, epsilon)
if __name__ == '__main__': parser = argparse.ArgumentParser(description='Assurance Monitoring for RL-based emergency braking system.') parser.add_argument("-g", "--gui", help="set gui mode.", action="store_true") parser.add_argument("-t", "--testing", help="set testing mode", action="store_true", default=False) parser.add_argument("-cp", "--collect_perception", help="collect the data for perception training") parser.add_argument("-ca", "--collect_detector", help="collect the data for detector training") parser.add_argument("-p", "--perception", help="set the path of perception neural network") parser.add_argument("-e", "--episode", help="set the number of episode", type=int, default=1) args = parser.parse_args() try: os.environ["CUDA_DEVICE_ORDER"]="PCI_BUS_ID" os.environ["CUDA_VISIBLE_DEVICES"]="0" # specify which GPU(s) to be used collect = args_assertions(args) env = SetupWorld(mass=1300, wheel_radius=0.04, dt=0.05, collect=collect) agent = ddpgAgent(Testing=args.testing) input_preprocessor = InputPreprocessor() agnt_number=15000; # select agent pr_avf=PR_AVF(agnt_number) # Priority replay avf class declaration avf=AVF_search() crashed = pd.read_csv('./DATA/crashed_for_train.csv') crashed=crashed[["Kick_Speed","friction_patch","loc_patch","size_patch"]].values print(crashed) gmm=gmm_trainer(crashed) number_of_retraining=0 # avf search class declaration with open('gmm_5D', 'rb') as f: model = pickle.load(f) failure_collection=[];
help="set the path of perception neural network") parser.add_argument("-e", "--episode", help="set the number of episode", type=int, default=1) args = parser.parse_args() try: os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID" os.environ[ "CUDA_VISIBLE_DEVICES"] = "0" # specify which GPU(s) to be used collect = args_assertions(args) env = SetupWorld(mass=1300, wheel_radius=0.04, dt=0.05, collect=collect) agent = ddpgAgent(Testing=args.testing) input_preprocessor = InputPreprocessor() rcf = rcf(100) print('Number of episodes :', args.episode) plot = Liveplot() cnt = 0 coDisp = [] #rcf.trainer() for episode in range(args.episode): #stopdist=1.0; #Comment below 3 lines while training , its only for running set of testing #print('***********************************************************************************************************') #print('******** Launching failure search test ID:',episode+1) #np.random.seed()