diff --git a/train.py b/train.py index 0817c14d8eec5b27f0a4e1ab0100d06687e97ac0..454d1115fb8478e542d797ee8f4f153475c8200d 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__'])# 发生异常所在的文件