本文整理匯總了Python中utils.set_seed方法的典型用法代碼示例。如果您正苦於以下問題:Python utils.set_seed方法的具體用法?Python utils.set_seed怎麽用?Python utils.set_seed使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類utils
的用法示例。
在下文中一共展示了utils.set_seed方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: __init__
# 需要導入模塊: import utils [as 別名]
# 或者: from utils import set_seed [as 別名]
def __init__(self, data_path, mode, modal, feature_fps, num_segments, len_feature, sampling, seed=-1, supervision='weak'):
if seed >= 0:
utils.set_seed(seed)
self.mode = mode
self.modal = modal
self.feature_fps = feature_fps
self.num_segments = num_segments
self.len_feature = len_feature
if self.modal == 'all':
self.feature_path = []
for _modal in ['rgb', 'flow']:
self.feature_path.append(os.path.join(data_path, 'features', self.mode, _modal))
else:
self.feature_path = os.path.join(data_path, 'features', self.mode, self.modal)
split_path = os.path.join(data_path, 'split_{}.txt'.format(self.mode))
split_file = open(split_path, 'r')
self.vid_list = []
for line in split_file:
self.vid_list.append(line.strip())
split_file.close()
anno_path = os.path.join(data_path, 'gt.json')
anno_file = open(anno_path, 'r')
self.anno = json.load(anno_file)
anno_file.close()
self.class_name_to_idx = dict((v, k) for k, v in config.class_dict.items())
self.num_classes = len(self.class_name_to_idx.keys())
self.supervision = supervision
self.sampling = sampling