Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Randomness #33

Closed
fcbfcb1998 opened this issue Feb 3, 2023 · 7 comments
Closed

Randomness #33

fcbfcb1998 opened this issue Feb 3, 2023 · 7 comments

Comments

@fcbfcb1998
Copy link

Hello! It is a wonderful work!
I have an issue. The image alignment training seems to be unrepeatable. The seed was set to 0, but the performance still different every time. Can you show me how to modify the codes?

@fcbfcb1998
Copy link
Author

I solved this issue.

If you want to have replicable results. you can change init_seed function in general.py to,
def init_seeds(seed=0):
# Initialize random number generator (RNG) seeds https://pytorch.org/docs/stable/notes/randomness.html
random.seed(seed)
np.random.seed(seed)
torch.manual_seed(seed)
torch.cuda.manual_seed(seed)
torch.cuda.manual_seed_all(seed) # for Multi-GPU, exception safe
# torch.backends.cudnn.benchmark = True # AutoBatch problem ultralytics/yolov5#9287
torch.use_deterministic_algorithms(True)
torch.backends.cudnn.deterministic = True
os.environ['CUBLAS_WORKSPACE_CONFIG'] = ':4096:8'
os.environ['PYTHONHASHSEED'] = str(seed)

@liudakai2
Copy link
Owner

liudakai2 commented Feb 8, 2023

Hi, thanks for your advice. A little randomness is not always a bad thing. But we are happy to provide users with the option of strict reproducibility, as YOLOv5 dose.

@QinAolong
Copy link

您好,我在windows上进行训练,但是数据集不知道怎么导入,也是采用建立软连接的方式嘛,如果您看到,请您帮我一下,谢谢您

@liudakai2
Copy link
Owner

您好,我在windows上进行训练,但是数据集不知道怎么导入,也是采用建立软连接的方式嘛,如果您看到,请您帮我一下,谢谢您

把软连接换成文件夹是一样的

@QinAolong
Copy link

您好,我在windows上进行训练,但是数据集不知道怎么导入,也是采用建立软连接的方式嘛,如果您看到,请您帮我一下,谢谢您

把软连接换成文件夹是一样的

这个怎么换一下,我太菜了,菜哭了

@liudakai2
Copy link
Owner

您好,我在windows上进行训练,但是数据集不知道怎么导入,也是采用建立软连接的方式嘛,如果您看到,请您帮我一下,谢谢您

把软连接换成文件夹是一样的

这个怎么换一下,我太菜了,菜哭了

就是直接新建文件夹,不要软连接,然后把数据放在文件夹里面

@QinAolong
Copy link

您好,我在windows上进行训练,但是数据集不知道怎么导入,也是采用建立软连接的方式嘛,如果您看到,请您帮我一下,谢谢您

把软连接换成文件夹是一样的

这个怎么换一下,我太菜了,菜哭了

就是直接新建文件夹,不要软连接,然后把数据放在文件夹里面

那这样的话,是不是把yaml的路径改成我的数据集的路径就好了
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants