Opencv mlp相同数据不同的结果

时间:2021-10-13 07:17:12

Let Me simplify this question.

让我简化这个问题。

If I run opencv MLP train and classify consecutively on the same data, I get different results. Meaning, if I put training a new mlp on the same train data and classifying on the same test data in a for loop, each iteration will give me different results. Even though I am creating a new mlp object each iteration. However, if instead of using a for loop I just run the program a few times, restarting the program after each train and classify; the results are exactly the same.

如果我运行opencv MLP列车并连续分类相同的数据,我会得到不同的结果。这意味着,如果我在同一列车数据上训练一个新的mlp并在for循环中对相同的测试数据进行分类,每次迭代都会给我不同的结果。即使我每次迭代都要创建一个新的mlp对象。但是,如果不是使用for循环,我只需运行几次程序,在每列火车后重新启动程序并进行分类;结果完全一样。

So question is, does opencv use previous weights, variables, or something of the sorts from other mlp trains? Even though it is not the same mlp object. Anyone know why it does this?

所以问题是,opencv是否使用以前的权重,变量或其他类似的其他mlp列车?即使它不是同一个mlp对象。任何人都知道为什么这样做?

Thanks for the time! -Tim

谢谢你的时间! -Tim

1 个解决方案

#1


0  

I've only done a little bit of poking around so far, but what I've seen confirms my first suspicion...

到目前为止我只是做了一点点,但我所看到的证实了我的第一个怀疑......

It looks as though each time you start the program, the random number generator is seeded to a fixed value:

看起来每次启动程序时,随机数生成器都会播种到固定值:

rng = RNG((uint64)-1);

So each time you run the program you're generating the same random sequence. By running in a loop, you continue generating the next random numbers in the sequence, which is different (generally) from the last sequence.

因此,每次运行程序时,您都会生成相同的随机序列。通过循环运行,您将继续生成序列中的下一个随机数,这与通常的最后一个序列不同。

#1


0  

I've only done a little bit of poking around so far, but what I've seen confirms my first suspicion...

到目前为止我只是做了一点点,但我所看到的证实了我的第一个怀疑......

It looks as though each time you start the program, the random number generator is seeded to a fixed value:

看起来每次启动程序时,随机数生成器都会播种到固定值:

rng = RNG((uint64)-1);

So each time you run the program you're generating the same random sequence. By running in a loop, you continue generating the next random numbers in the sequence, which is different (generally) from the last sequence.

因此,每次运行程序时,您都会生成相同的随机序列。通过循环运行,您将继续生成序列中的下一个随机数,这与通常的最后一个序列不同。