本文整理汇总了Python中src.utils.load_variables方法的典型用法代码示例。如果您正苦于以下问题:Python utils.load_variables方法的具体用法?Python utils.load_variables怎么用?Python utils.load_variables使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类src.utils
的用法示例。
在下文中一共展示了utils.load_variables方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _get_semantic_maps
# 需要导入模块: from src import utils [as 别名]
# 或者: from src.utils import load_variables [as 别名]
def _get_semantic_maps(folder_name, building_name, map, flip):
# Load file from the cache.
file_name = '{:s}_{:d}_{:d}_{:d}_{:d}_{:d}_{:d}.pkl'
file_name = file_name.format(building_name, map.size[0], map.size[1],
map.origin[0], map.origin[1], map.resolution,
flip)
file_name = os.path.join(folder_name, file_name)
logging.info('Loading semantic maps from %s.', file_name)
if fu.exists(file_name):
a = utils.load_variables(file_name)
maps = a['maps'] #HxWx#C
cats = a['cats']
else:
logging.error('file_name: %s not found.', file_name)
maps = None
cats = None
return maps, cats
示例2: _get_room_dimensions
# 需要导入模块: from src import utils [as 别名]
# 或者: from src.utils import load_variables [as 别名]
def _get_room_dimensions(file_name, resolution, origin, flip=False):
if fu.exists(file_name):
a = utils.load_variables(file_name)['room_dimension']
names = a.keys()
dims = np.concatenate(a.values(), axis=0).reshape((-1,6))
ind = np.argsort(names)
dims = dims[ind,:]
names = [names[x] for x in ind]
if flip:
dims_new = dims*1
dims_new[:,1] = -dims[:,4]
dims_new[:,4] = -dims[:,1]
dims = dims_new*1
dims = dims*100.
dims[:,0] = dims[:,0] - origin[0]
dims[:,1] = dims[:,1] - origin[1]
dims[:,3] = dims[:,3] - origin[0]
dims[:,4] = dims[:,4] - origin[1]
dims = dims / resolution
out = {'names': names, 'dims': dims}
else:
out = None
return out
示例3: get_meta_data
# 需要导入模块: from src import utils [as 别名]
# 或者: from src.utils import load_variables [as 别名]
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
示例4: _load_trajectory
# 需要导入模块: from src import utils [as 别名]
# 或者: from src.utils import load_variables [as 别名]
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