當前位置: 首頁>>代碼示例>>Python>>正文


Python utils.load_variables方法代碼示例

本文整理匯總了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 
開發者ID:ringringyi,項目名稱:DOTA_models,代碼行數:20,代碼來源:nav_env.py

示例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 
開發者ID:ringringyi,項目名稱:DOTA_models,代碼行數:26,代碼來源:nav_env.py

示例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 
開發者ID:ringringyi,項目名稱:DOTA_models,代碼行數:17,代碼來源:factory.py

示例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 
開發者ID:ringringyi,項目名稱:DOTA_models,代碼行數:15,代碼來源:script_plot_trajectory.py


注:本文中的src.utils.load_variables方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。