InsightSoftwareConsortium / InsightSoftwareConsortium/ITK
Gradient sometimes zero (which prevents a gradient decent optimizer from decenting)
- Dominant language
- C++
- Stars
- 1.7k
- Forks
- 748
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 64
Description
I have experienced many cases where I can extract a path with the [IterateNeighborhoodOptimizer](https://itk.org/Doxygen/html/classitk_1_1IterateNeighborhoodOptimizer.html) but where the [GradientDescentOptimizer](https://itk.org/Doxygen/html/classitk_1_1GradientDescentOptimizer.html) does not start to decent even though the speed function is continuous (based on a binary segmentation), apparently because the initial local gradient is calculated to be zero (even though start- and end-point, speed function etc are kept the same).
I have a vague feeling that this thresholding:
https://github.com/InsightSoftwareConsortium/ITKMinimalPathExtraction/blob/6ae35b9d044ff2be22ce42776c64258be9252313/include/itkSingleImageCostFunction.hxx#L145-L152
to a hard coded value of `15.0`:
https://github.com/InsightSoftwareConsortium/ITKMinimalPathExtraction/blob/6ae35b9d044ff2be22ce42776c64258be9252313/include/itkSingleImageCostFunction.hxx#L140
could be the culprit.
Another possible reason I could imagine is that the floating point precision might not suffice under some circumstances to calculate a non-zero gradient even if there is no extrema in the cost function at the current optimizer position.
I use this CLI for the testing:
https://github.com/romangrothausmann/ITK-CLIs/blob/bfb1312142d505cacd6770e4d5acc23475290c8f/min-path_seg.cxx
Contributor guide
Assessment
This issue has not been assessed yet.