ravens/agents/gt_state.py
def init_model(self, dataset):
        """Initialize self.model, including normalization parameters."""
        self.set_max_obs_vector_length(dataset)

        # Get obs dim and action dim (3 for pick, 3 for place), initialize model.
        if self.goal_conditioned:
            _, _, info, goal = dataset.random_sample(goal_images=True)
            obs_vector = self.info_to_gt_obs(info, goal=goal)
        else:
            _, _, info = dataset.random_sample()
            obs_vector = self.info_to_gt_obs(info)

        obs_dim = obs_vector.shape[0]
        act_dim = 6
        if self.six_dof:
            act_dim = 9
        self.model = MlpModel(self.BATCH_SIZE, obs_dim, act_dim, 'relu', self.USE_MDN, dropout=0.1)

        # Sample points from the data to get reasonable mean / std values.
        sampled_gt_obs = []
        num_samples = 1000
        for _ in range(num_samples):
            t_worldaug_world, _ = self.get_augmentation_transform()
            if self.goal_conditioned:
                _, _, info, goal = dataset.random_sample(goal_images=True)
                sampled_gt_obs.append(self.info_to_gt_obs(info, t_worldaug_world, goal=goal))
            else:
                _, _, info = dataset.random_sample()
                sampled_gt_obs.append(self.info_to_gt_obs(info, t_worldaug_world))
        sampled_gt_obs = np.array(sampled_gt_obs)
        obs_train_parameters = dict()
        obs_train_parameters['mean'] = sampled_gt_obs.mean(axis=(0)).astype(np.float32)
        obs_train_parameters['std'] = sampled_gt_obs.std(axis=(0)).astype(np.float32)
        self.model.set_normalization_parameters(obs_train_parameters)

        self.obs_train_mean = obs_train_parameters['mean']
        self.obs_train_std  = obs_train_parameters['std']
        print('Done initializing self.model for ground truth agent.')
Initialize self.model, including normalization parameters.
Initialize self.model, including normalization parameters.
Initialize self . model including normalization parameters .
def init_model(self, dataset):
        self.set_max_obs_vector_length(dataset)
        if self.goal_conditioned:
            _, _, info, goal = dataset.random_sample(goal_images=True)
            obs_vector = self.info_to_gt_obs(info, goal=goal)
        else:
            _, _, info = dataset.random_sample()
            obs_vector = self.info_to_gt_obs(info)
        obs_dim = obs_vector.shape[0]
        act_dim = 6
        if self.six_dof:
            act_dim = 9
        self.model = MlpModel(self.BATCH_SIZE, obs_dim, act_dim, 'relu', self.USE_MDN, dropout=0.1)
        sampled_gt_obs = []
        num_samples = 1000
        for _ in range(num_samples):
            t_worldaug_world, _ = self.get_augmentation_transform()
            if self.goal_conditioned:
                _, _, info, goal = dataset.random_sample(goal_images=True)
                sampled_gt_obs.append(self.info_to_gt_obs(info, t_worldaug_world, goal=goal))
            else:
                _, _, info = dataset.random_sample()
                sampled_gt_obs.append(self.info_to_gt_obs(info, t_worldaug_world))
        sampled_gt_obs = np.array(sampled_gt_obs)
        obs_train_parameters = dict()
        obs_train_parameters['mean'] = sampled_gt_obs.mean(axis=(0)).astype(np.float32)
        obs_train_parameters['std'] = sampled_gt_obs.std(axis=(0)).astype(np.float32)
        self.model.set_normalization_parameters(obs_train_parameters)
        self.obs_train_mean = obs_train_parameters['mean']
        self.obs_train_std  = obs_train_parameters['std']
        print('Done initializing self.model for ground truth agent.')
def init_model ( self , dataset ) : self . set_max_obs_vector_length ( dataset ) if self . goal_conditioned : _ , _ , info , goal = dataset . random_sample ( goal_images = True ) obs_vector = self . info_to_gt_obs ( info , goal = goal ) else : _ , _ , info = dataset . random_sample ( ) obs_vector = self . info_to_gt_obs ( info ) obs_dim = obs_vector . shape [ 0 ] act_dim = 6 if self . six_dof : act_dim = 9 self . model = MlpModel ( self . BATCH_SIZE , obs_dim , act_dim , 'relu' , self . USE_MDN , dropout = 0.1 ) sampled_gt_obs = [ ] num_samples = 1000 for _ in range ( num_samples ) : t_worldaug_world , _ = self . get_augmentation_transform ( ) if self . goal_conditioned : _ , _ , info , goal = dataset . random_sample ( goal_images = True ) sampled_gt_obs . append ( self . info_to_gt_obs ( info , t_worldaug_world , goal = goal ) ) else : _ , _ , info = dataset . random_sample ( ) sampled_gt_obs . append ( self . info_to_gt_obs ( info , t_worldaug_world ) ) sampled_gt_obs = np . array ( sampled_gt_obs ) obs_train_parameters = dict ( ) obs_train_parameters [ 'mean' ] = sampled_gt_obs . mean ( axis = ( 0 ) ) . astype ( np . float32 ) obs_train_parameters [ 'std' ] = sampled_gt_obs . std ( axis = ( 0 ) ) . astype ( np . float32 ) self . model . set_normalization_parameters ( obs_train_parameters ) self . obs_train_mean = obs_train_parameters [ 'mean' ] self . obs_train_std = obs_train_parameters [ 'std' ] print ( 'Done initializing self.model for ground truth agent.' )
Initialize self.model, including normalization parameters.
Initialize self . model including normalization parameters .
"""Initialize self.model, including normalization parameters.""" # Get obs dim and action dim (3 for pick, 3 for place), initialize model. # Sample points from the data to get reasonable mean / std values.
self
dataset