本文整理匯總了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