本文整理汇总了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