Esempio n. 1
0
 def get_diagnostics(self, paths, prefix=''):
     statistics = OrderedDict()
     for stat_name in [
         'touch_distance',
         'hand_success',
         'obj_success',
         'hand_and_obj_success',
         'touch_success',
         'hand_distance',
         'obj_distance',
         'hand_and_obj_distance',
         'total_pickups',
     ]:
         stat_name = stat_name
         stat = get_stat_in_paths(paths, 'env_infos', stat_name)
         statistics.update(create_stats_ordered_dict(
             '%s%s' % (prefix, stat_name),
             stat,
             always_show_all_stats=True,
         ))
         statistics.update(create_stats_ordered_dict(
             'Final %s%s' % (prefix, stat_name),
             [s[-1] for s in stat],
             always_show_all_stats=True,
         ))
     return statistics
Esempio n. 2
0
 def get_diagnostics(self, paths, prefix=''):
     statistics = OrderedDict()
     stat_names = [
         'hand_success',
         'obj_success',
         'hand_and_obj_success',
         'hand_distance',
         'obj_distance',
         'obj_distance0',
         'hand_and_obj_distance',
         'total_pickups',
         'obj_x0', 'obj_y0', 'obj_z0',
         'mujoco_exception_raised', 'flying_object',
     ]
     if self.two_obj:
         stat_names.append('obj_distance1')
         stat_names.append('obj_x1')
         stat_names.append('obj_y1')
         stat_names.append('obj_z1')
     for stat_name in stat_names:
         stat_name = stat_name
         stat = get_stat_in_paths(paths, 'env_infos', stat_name)
         statistics.update(create_stats_ordered_dict(
             '%s%s' % (prefix, stat_name),
             stat,
             always_show_all_stats=True,
         ))
         statistics.update(create_stats_ordered_dict(
             'Final %s%s' % (prefix, stat_name),
             [s[-1] for s in stat],
             always_show_all_stats=True,
         ))
     return statistics
Esempio n. 3
0
 def get_diagnostics(self, paths, prefix=''):
     statistics = OrderedDict()
     for stat_name in [
             'radius',
             'target_position',
             'distance_to_target',
             'velocity',
             'speed',
             'is_success',
     ]:
         stat_name = stat_name
         stat = get_stat_in_paths(paths, 'env_infos', stat_name)
         statistics.update(
             create_stats_ordered_dict(
                 '%s%s' % (prefix, stat_name),
                 stat,
                 always_show_all_stats=True,
             ))
         statistics.update(
             create_stats_ordered_dict(
                 'Final %s%s' % (prefix, stat_name),
                 [s[-1] for s in stat],
                 always_show_all_stats=True,
             ))
     return statistics
    def log_diagnostics(self, paths, logger=None, prefix=""):
        if logger is None:
            return

        statistics = OrderedDict()
        for stat_name in [
                'hand_distance',
                'puck_distance',
                'touch_distance',
                'success',
        ]:
            stat_name = stat_name
            stat = get_stat_in_paths(paths, 'env_infos', stat_name)
            statistics.update(
                create_stats_ordered_dict(
                    '%s %s' % (prefix, stat_name),
                    stat,
                    always_show_all_stats=True,
                ))
            statistics.update(
                create_stats_ordered_dict(
                    'Final %s %s' % (prefix, stat_name),
                    [s[-1] for s in stat],
                    always_show_all_stats=True,
                ))

        for key, value in statistics.items():
            logger.record_tabular(key, value)
Esempio n. 5
0
    def get_diagnostics(self, paths, prefix=''):
        statistics = OrderedDict()
        stat_names = [
            'opt_func_loss',
            'opt_grad_norm',
            'opt_v_value',
            'opt_v_value_min',
            'opt_v_value_sum',
            'opt_realistic_subgoal_rew',

            'init_opt_func_loss',
            'init_opt_grad_norm',
            'init_opt_v_value',
            'init_opt_v_value_min',
            'init_opt_v_value_sum',
            'init_opt_realistic_subgoal_rew',

            'opt_func_calls',
            'opt_num_iters',
            'opt_stopped',
        ]

        for stat_name in stat_names:
            stat_name = stat_name
            stat = get_stat_in_paths(paths, 'agent_infos', stat_name)
            statistics.update(create_stats_ordered_dict(
                '%s%s' % (prefix, stat_name),
                stat,
                always_show_all_stats=True,
                ))
        return statistics
Esempio n. 6
0
 def get_diagnostics(self, paths, prefix=''):
     statistics = OrderedDict()
     # for stat_name in [
     #     'touch_distance',
     #     'hand_success',
     #     'obj_success',
     #     'hand_and_obj_success',
     #     'touch_success',
     #     'hand_distance',
     #     'obj_distance',
     #     'hand_and_obj_distance',
     #     'total_pickups',
     # ]: # these are copied from saywer_pickup_and_place.py
     for stat_name in [
             'ag_state',
             'g_state',
             'image_dist',
             'image_success',
     ]:
         stat_name = stat_name
         stat = get_stat_in_paths(paths, 'env_infos', stat_name)
         statistics.update(
             create_stats_ordered_dict(
                 '%s%s' % (prefix, stat_name),
                 stat,
                 always_show_all_stats=True,
             ))
         statistics.update(
             create_stats_ordered_dict(
                 'Final %s%s' % (prefix, stat_name),
                 [s[-1] for s in stat],
                 always_show_all_stats=True,
             ))
     return statistics
Esempio n. 7
0
    def get_diagnostics(self, paths, prefix=''):
        statistics = OrderedDict()
        list_of_stat_names = [
            'state_diff',
            'pos_diff',
            'angle_diff',
            'pos_angle_diff',
            'pos_success',
            'angle_success',
        ]
        if self.vel_in_state:
            list_of_stat_names.append('velocity_diff')
            list_of_stat_names.append('angular_velocity_diff')

        for stat_name in list_of_stat_names:
            stat_name = stat_name
            stat = get_stat_in_paths(paths, 'env_infos', stat_name)
            statistics.update(
                create_stats_ordered_dict(
                    '%s%s' % (prefix, stat_name),
                    stat,
                    always_show_all_stats=True,
                ))
            statistics.update(
                create_stats_ordered_dict(
                    'Final %s%s' % (prefix, stat_name),
                    [s[-1] for s in stat],
                    always_show_all_stats=True,
                ))
        return statistics
Esempio n. 8
0
 def get_diagnostics(self, paths, prefix=''):
     statistics = OrderedDict()
     for stat_name in [
             'distance_to_target',
             'is_success',
     ]:
         stat_name = stat_name
         stat = get_stat_in_paths(paths, 'env_infos', stat_name)
         statistics.update(
             create_stats_ordered_dict(
                 '%s%s' % (prefix, stat_name),
                 stat,
                 always_show_all_stats=True,
             ))
         statistics.update(
             create_stats_ordered_dict(
                 'Final %s%s' % (prefix, stat_name),
                 [s[-1] for s in stat],
                 always_show_all_stats=True,
             ))
     for i, obj in enumerate(self.objects):
         stat_name = 'distance_to_target_obj_{}'.format(i)
         stat = get_stat_in_paths(paths, 'env_infos', stat_name)
         statistics.update(
             create_stats_ordered_dict(
                 '%s%s' % (prefix, stat_name),
                 stat,
                 always_show_all_stats=True,
             ))
         statistics.update(
             create_stats_ordered_dict(
                 'Final %s%s' % (prefix, stat_name),
                 [s[-1] for s in stat],
                 always_show_all_stats=True,
             ))
     return statistics
Esempio n. 9
0
 def get_diagnostics(self, paths, **kwargs):
     statistics = self.wrapped_env.get_diagnostics(paths, **kwargs)
     for stat_name_in_paths in ["image_dist", "image_success"]:
         stats = get_stat_in_paths(paths, 'env_infos', stat_name_in_paths)
         statistics.update(create_stats_ordered_dict(
             stat_name_in_paths,
             stats,
             always_show_all_stats=True,
         ))
         final_stats = [s[-1] for s in stats]
         statistics.update(create_stats_ordered_dict(
             "Final " + stat_name_in_paths,
             final_stats,
             always_show_all_stats=True,
         ))
     return statistics
Esempio n. 10
0
 def get_diagnostics(self, paths, prefix=''):
     statistics = OrderedDict()
     for stat_name in ['angle_difference', 'angle_success']:
         stat_name = stat_name
         stat = get_stat_in_paths(paths, 'env_infos', stat_name)
         statistics.update(
             create_stats_ordered_dict(
                 '%s%s' % (prefix, stat_name),
                 stat,
                 always_show_all_stats=True,
             ))
         statistics.update(
             create_stats_ordered_dict(
                 'Final %s%s' % (prefix, stat_name),
                 [s[-1] for s in stat],
                 always_show_all_stats=True,
             ))
     return statistics
 def get_diagnostics(self, paths, prefix=''):
     statistics = OrderedDict()
     for stat_name in [
             obj_name + '_distance' for obj_name in self._object_names
     ]:
         stat_name = stat_name
         stat = get_stat_in_paths(paths, 'env_infos', stat_name)
         statistics.update(
             create_stats_ordered_dict(
                 '%s%s' % (prefix, stat_name),
                 stat,
                 always_show_all_stats=True,
             ))
         statistics.update(
             create_stats_ordered_dict(
                 'Final %s%s' % (prefix, stat_name),
                 [s[-1] for s in stat],
                 always_show_all_stats=True,
             ))
     return statistics
Esempio n. 12
0
 def get_diagnostics(self, paths, prefix=""):
     statistics = collections.OrderedDict()
     stats = ['hand_distance']
     for i in range(self.puck_count):
         stats += [
             'puck{}_distance'.format(i),
             'touch{}_distance'.format(i),
         ]
     for stat_name in stats:
         stat_name = stat_name
         stat = get_stat_in_paths(paths, 'env_infos', stat_name)
         statistics.update(
             create_stats_ordered_dict(
                 '%s%s' % (prefix, stat_name),
                 stat,
                 always_show_all_stats=True,
             ))
         statistics.update(
             create_stats_ordered_dict(
                 'Final %s%s' % (prefix, stat_name),
                 [s[-1] for s in stat],
                 always_show_all_stats=True,
             ))
     return statistics