def __init__(self, eval_keyword: str, args): self.eval_keyword = eval_keyword GameEnvironment.__init__(self, args=args, agent_type='evaluation') self.eval_name = args.eval_name # load params and evaluators self.control_param, self.control_evaluator = \ load_param_and_evaluator(eval_keyword=eval_keyword, args=args, model_type='control') self.stop_param, self.stop_evaluator = \ load_param_and_evaluator(eval_keyword=eval_keyword, args=args, model_type='stop') self.high_level_param, self.high_level_evaluator = \ load_param_and_evaluator(eval_keyword=eval_keyword, args=args, model_type='high') # set image type self.image_type = self.high_level_param.image_type if 'd' in self.image_type: from model import DeepLabModel, prepare_deeplab_model self.deeplab_model: DeepLabModel = prepare_deeplab_model() self.final_images = [] self.eval_dataset, self.eval_sentences = load_evaluation_dataset( self.high_level_param) self.eval_transforms = list( map(lambda x: x[0].state.transform, self.eval_dataset)) self.high_level_sentences = self.eval_sentences logger.info('fetched {} sentences from {}'.format( len(self.high_level_sentences), self.high_level_param.eval_keyword.lower())) self.softmax = torch.nn.Softmax(dim=1) EvaluationDirectory.__init__(self, *self.eval_info) self.high_level_data_dict = dict()
def __init__(self, args, model_type: str): GameEnvironment.__init__(self, args=args, agent_type='evaluation') self.eval_param, self.evaluator = load_param_and_evaluator( args=args, model_type=model_type) self.eval_transforms = self.world.get_map().get_spawn_points() EvaluationDirectory.__init__(self, *self.eval_info)