简体   繁体   English

如何在CNN模型中使用tensorflow-gpu获得可重现的结果?

[英]How to get reproducible results using tensorflow-gpu in CNN model?

I'm using Tensorflow GPU in CNN model and I would like to reproduce my results on each execution. 我在CNN模型中使用Tensorflow GPU,我想在每次执行时重现我的结果。

I have tried setting the graph level seed, numpy random seed, and even operation level seeds. 我已经尝试设置图级别种子,numpy随机种子,甚至操作级别种子。 However, it still not reproducible. 但是,它仍然不可重复。

I have also tried Tensorflow with CPU; 我也尝试过Tensorflow和CPU; I have got a reproducible result, but it's so slow. 我有一个可重复的结果,但它太慢了。

Any idea or debugging experiment suggestion to get a reproducible result using Tensorflow with GPU? 任何想法或调试实验建议使用Tensorflow和GPU获得可重现的结果?

Did you try to save the weights of your model at each iteration ? 您是否尝试在每次迭代时保存模型的权重? Using keras callbacks for exemple : 使用keras回调示例:

filepath = 'weights/' + model.name + '.{epoch:02d}-{acc:.2f}.hdf5'
checkpoint = ModelCheckpoint(filepath, monitor='acc', verbose=0, save_weights_only=True, save_best_only=True, mode='auto', period=1)

You can then load the weights of your model at the iteration you want 然后,您可以在所需的迭代中加载模型的权重

Hope i understood well you problem ! 希望我明白你的问题!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM