def create_training_agent(agent_config): '''Returns an training agent object agent_config - Dictionary containing the key specified in ConfigParams ''' model_metadata = agent_config['model_metadata'] observation_list, network, _ = utils_parse_model_metadata.parse_model_metadata(model_metadata) sensor = construct_sensor(observation_list, SensorFactory) network_settings = get_network_settings(sensor, network) sensor = construct_sensor(observation_list, SensorFactory) ctrl_config = agent_config['car_ctrl_cnfig'] ctrl = TrainingCtrl(ctrl_config[ConfigParams.AGENT_NAME.value], ctrl_config[ConfigParams.ACTION_SPACE_PATH.value]) return Agent(network_settings, sensor, ctrl, None)
def create_training_agent(agent_config): '''Returns an training agent object agent_config - Dictionary containing the key specified in ConfigParams ''' model_metadata = agent_config['model_metadata'] observation_list, network, _ = model_metadata.get_model_metadata_info() sensor = construct_sensor( agent_config[ConfigParams.CAR_CTRL_CONFIG.value][ ConfigParams.AGENT_NAME.value], observation_list, SensorFactory) network_settings = get_network_settings(sensor, network) ctrl_config = agent_config[ConfigParams.CAR_CTRL_CONFIG.value] ctrl = TrainingCtrl(ctrl_config[ConfigParams.AGENT_NAME.value], ctrl_config[ConfigParams.ACTION_SPACE_PATH.value]) return Agent(network_settings, sensor, ctrl)
def create_rollout_agent(agent_config, metrics): '''Returns an rollout agent object agent_config - Dictionary containing the key specified in ConfigParams metrics - Metrics object for the agent ''' model_metadata = agent_config['model_metadata'] observation_list, network, _ = utils_parse_model_metadata.parse_model_metadata( model_metadata) sensor = construct_sensor(observation_list, SensorFactory) network_settings = get_network_settings(sensor, network) frustum = Frustum.get_instance() frustum.add_cameras(observation_list) ctrl_config = agent_config['car_ctrl_cnfig'] ctrl = RolloutCtrl(ctrl_config) return Agent(network_settings, sensor, ctrl, metrics)
def create_training_agent(agent_config): '''Returns an training agent object agent_config - Dictionary containing the key specified in ConfigParams ''' model_metadata = agent_config['model_metadata'] model_metadata_info = model_metadata.get_model_metadata_info() observation_list = model_metadata_info[ModelMetadataKeys.SENSOR.value] network = model_metadata_info[ModelMetadataKeys.NEURAL_NETWORK.value] sensor = construct_sensor( agent_config[ConfigParams.CAR_CTRL_CONFIG.value][ ConfigParams.AGENT_NAME.value], observation_list, SensorFactory) network_settings = get_network_settings(sensor, network) ctrl_config = agent_config[ConfigParams.CAR_CTRL_CONFIG.value] ctrl = TrainingCtrl(ctrl_config[ConfigParams.AGENT_NAME.value], ctrl_config[ConfigParams.MODEL_METADATA.value]) return Agent(network_settings, sensor, ctrl)
def create_rollout_agent(agent_config, metrics, run_phase_subject): '''Returns an rollout agent object agent_config - Dictionary containing the key specified in ConfigParams metrics - Metrics object for the agent run_phase_subject - Subject that notifies observers when the run phase changes ''' model_metadata = agent_config['model_metadata'] observation_list, network, version = model_metadata.get_model_metadata_info() agent_name = agent_config[ConfigParams.CAR_CTRL_CONFIG.value][ConfigParams.AGENT_NAME.value] sensor = construct_sensor(agent_name, observation_list, SensorFactory) network_settings = get_network_settings(sensor, network) FrustumManager.get_instance().add(agent_name=agent_name, observation_list=observation_list, version=version) ctrl_config = agent_config[ConfigParams.CAR_CTRL_CONFIG.value] ctrl = RolloutCtrl(ctrl_config, run_phase_subject, metrics) return Agent(network_settings, sensor, ctrl)