liudakai2 / UnsupDIS-pytorch

A pytorch implementation of UnsupervisedDeepImageStitching
GNU General Public License v3.0
109 stars 19 forks source link

Randomness #33

Closed fcbfcb1998 closed 1 year ago

fcbfcb1998 commented 1 year ago

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 commented 1 year ago

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 https://github.com/ultralytics/yolov5/issues/9287
torch.use_deterministic_algorithms(True)
torch.backends.cudnn.deterministic = True
os.environ['CUBLAS_WORKSPACE_CONFIG'] = ':4096:8'
os.environ['PYTHONHASHSEED'] = str(seed)
liudakai2 commented 1 year ago

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 commented 1 year ago

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

liudakai2 commented 1 year ago

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

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

QinAolong commented 1 year ago

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

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

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

liudakai2 commented 1 year ago

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

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

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

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

QinAolong commented 1 year ago

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

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

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

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

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