Skip to content

Commit

Permalink
fix random seed
Browse files Browse the repository at this point in the history
  • Loading branch information
zdaiot committed Oct 25, 2019
1 parent c8874ef commit 2af4de5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion train_classify.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ def __init__(self, config, fold):

self.max_accuracy_valid = 0
# 设置随机种子,注意交叉验证部分划分训练集和验证集的时候,要保持种子固定
self.seed = 1570421136
self.seed = int(time.time())
# self.seed = 1570421136
seed_torch(self.seed)
with open(self.model_path + '/'+ TIMESTAMP + '.pkl','wb') as f:
pickle.dump({'seed': self.seed}, f, -1)
Expand Down
3 changes: 2 additions & 1 deletion train_segment.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ def __init__(self, config, fold):
self.max_dice_valid = 0

# 设置随机种子,注意交叉验证部分划分训练集和验证集的时候,要保持种子固定
self.seed = 1570421136
self.seed = int(time.time())
# self.seed = 1570421136
seed_torch(self.seed)
with open(self.model_path + '/'+ TIMESTAMP + '.pkl','wb') as f:
pickle.dump({'seed': self.seed}, f, -1)
Expand Down

0 comments on commit 2af4de5

Please sign in to comment.