def _load_trajectory(): base_dir = FLAGS.base_dir config_name = FLAGS.config_name+_get_suffix_str() dir_name = os.path.join(base_dir, FLAGS.type, config_name) tf.logging.info('Waiting for snapshot in directory %s.', dir_name) last_checkpoint = slim.evaluation.wait_for_new_checkpoint(dir_name, None) checkpoint_iter = int(os.path.basename(last_checkpoint).split('-')[1]) # Load the distances. a = utils.load_variables(os.path.join(dir_name, 'bench_on_'+FLAGS.imset, 'all_locs_at_t_{:d}.pkl'.format(checkpoint_iter))) return a
def _load_trajectory(): base_dir = FLAGS.base_dir config_name = FLAGS.config_name+_get_suffix_str() dir_name = os.path.join(base_dir, FLAGS.type, config_name) logging.info('Waiting for snapshot in directory %s.', dir_name) last_checkpoint = slim.evaluation.wait_for_new_checkpoint(dir_name, None) checkpoint_iter = int(os.path.basename(last_checkpoint).split('-')[1]) # Load the distances. a = utils.load_variables(os.path.join(dir_name, 'bench_on_'+FLAGS.imset, 'all_locs_at_t_{:d}.pkl'.format(checkpoint_iter))) return a
def get_meta_data(self, file_name, data_dir=None): if data_dir is None: data_dir = self.get_data_dir() full_file_name = os.path.join(data_dir, 'meta', file_name) assert(fu.exists(full_file_name)), \ '{:s} does not exist'.format(full_file_name) ext = os.path.splitext(full_file_name)[1] if ext == '.txt': ls = [] with fu.fopen(full_file_name, 'r') as f: for l in f: ls.append(l.rstrip()) elif ext == '.pkl': ls = utils.load_variables(full_file_name) return ls
def get_meta_data(self, file_name, data_dir=None): if data_dir is None: data_dir = self.get_data_dir() full_file_name = os.path.join(data_dir, 'meta', file_name) assert(fu.exists(full_file_name)), \ '{:s} does not exist'.format(full_file_name) ext = os.path.splitext(full_file_name)[1] if ext == '.txt': ls = [] with fu.fopen(full_file_name, 'r') as f: for l in f: ls.append(l.rstrip()) elif ext == '.pkl': ls = utils.load_variables(full_file_name) return ls