[ITK] Determinism & Registration v4
Timothee Evain
tevain at telecom-paristech.fr
Wed Mar 15 09:33:05 EDT 2017
@Dženan
It was the 4.10.0! I guess that said commits are posterior to this release.
@Brad
Many thanks for this complete answer, it's a bit more clear for me now.
So, to sum up, the way to get deterministic behavior is to:
-get the 4.11 release (or there are some other useful commits since the tag?)
-manually set the seed for pseudo-random number generation
-run on single-threaded mode
That's it ?
Tim
----- Mail original -----
De: "Bradley Lowekamp (NIH/NLM/LHC) [C]" <blowekamp at mail.nih.gov>
À: "Timothee Evain" <tevain at telecom-paristech.fr>
Cc: community at itk.org
Envoyé: Mercredi 15 Mars 2017 14:05:54
Objet: Re: [ITK] Determinism & Registration v4
Hello,
> Is it possible to get a determinist pipeline ?
Yes. There are two known sources of non-determinism. The first is where pseudo-random number generation is used and the second can be more subtle with multi-threading and non-commutative floating point operations.
With the recent 4.11 release there has been significant improvements in the available usage of seed for pseudo-random number generation. With the 4.11 release the seeds are now initialized with the wall-clock, which would give non-deterministic behavior. Additionally, methods were added to registration components which used the MersenneTwisterRandomVariateGenerator fro pseudo-random number generation to allow manually setting the seed for deterministic behavior.
Specifically, in the ImageRegistrationMethodv4 a seed was exposed for sampling for the metric[1]. This is used for both the REGULAR and RANDOM sampling[2].
Also, there is some usage of the pseudo-random number generation for the sampling certain cases. Recently the method used for affine transforms changed to be deterministic [3].
Lastly regarding multi-threading non-determinism, just using one thread is the simple work around. But there is also an experimental method SetFloaringPointCorrectionResolution which may help [4] determinism and portability.
HTH,
Brad
[1] https://itk.org/Doxygen/html/classitk_1_1ImageRegistrationMethodv4.html#ab1ae25c0b7ef720a7743c3c828eeca6c
[2] https://github.com/InsightSoftwareConsortium/ITK/blob/1b666d295bdb39ba174b381f20c91df4ecb00849/Modules/Registration/RegistrationMethodsv4/include/itkImageRegistrationMethodv4.hxx#L954-L1032
[3] https://github.com/InsightSoftwareConsortium/ITK/commit/99a7ac8f3ab88cdc508084e4921f0f4c9678468b
[4] https://itk.org/Doxygen/html/classitk_1_1ImageToImageMetricv4.html#a341ca404fc872698f3225e3e8361149b
> On Mar 15, 2017, at 5:54 AM, Timothee Evain <tevain at telecom-paristech.fr> wrote:
>
> Hi everyone,
>
> A small question about the registration v4 framework:
> Is it possible to get a determinist pipeline ?
> I use the Mattes mutual information combined with the Regular step gradient descent and my problem is that each run produce a different parameter set.
> The deviation is really small, but I expected to see same results with same inputs.
> I was testing with the REGULAR sampling strategy at first, but there is a random perturbation of the point picking in the code, so I tried with dense sampling, but here again, the results are varying.
> Is that an expected behavior ?
>
> Tim
> _______________________________________________
> Community mailing list
> Community at itk.org
> http://public.kitware.com/mailman/listinfo/community
More information about the Community
mailing list