From 3533a7d5ba9c8b170bbaa5b7feda5fe8b767cc12 Mon Sep 17 00:00:00 2001 From: "Eric.Lee2021" <305141918@qq.com> Date: Fri, 23 Apr 2021 11:28:19 +0800 Subject: [PATCH] correct random seed bug --- train.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/train.py b/train.py index 0817c14..454d111 100644 --- a/train.py +++ b/train.py @@ -19,7 +19,7 @@ from loss.loss import * import cv2 import time from datetime import datetime - +import random def trainer(ops,f_log): try: os.environ['CUDA_VISIBLE_DEVICES'] = ops.GPUS @@ -134,7 +134,7 @@ def trainer(ops,f_log): step += 1 if epoch % 5 == 0 and epoch >0: torch.save(model_.state_dict(), ops.model_exp + '{}-epoch-{}.pth'.format(ops.model,epoch)) - + set_seed(random.randint(0,65535)) except Exception as e: print('Exception : ',e) # 打印异常 print('Exception file : ', e.__traceback__.tb_frame.f_globals['__file__'])# 发生异常所在的文件 -- GitLab