Repository navigation
Fit strain live against a reference pattern built once before the scan - #50
Open
CSSFrancis wants to merge 6 commits into
Open
CSSFrancis wants to merge 6 commits into
CSSFrancis wants to merge 6 commits into
Conversation
…entations strain_from_reference fitted regions' shifts; it now fits every pixel inside the margin by Gauss-Newton on a pyramid (integrated DIC against a real reference), seeded from the lattice rotation the indexed orientations give. On synthetic patterns a 2e-3 strain came back within about 1e-4 out to 5 degrees, where the region correlation was off by 1.6e-3 at half a degree.
…n's soft directions On a real Si indent the fit of a pattern against itself left the identity, tenfold an iteration, once a call held two patterns on CUDA: the ill-conditioned normal equations, summed in single over the pattern, carried 1.5e-4 of rounding. They are summed in single by chunks of 4096 pixels and the chunks in double, as accurate as double throughout and six times faster on a workstation GPU. Gauss-Newton wandered along the rotations a single pattern barely tells from a moved pattern center; each level is Levenberg-Marquardt now, a step kept only if it lowers the residual, with 50 iterations a level.
…re it StrainReference projects the summed reference onto an equal-area texture by its cubic B-spline and fits each pattern, binned to at most 1024 rows and flattened by its own blur, on the fused CUDA kernel, seeded from the orientations and at each point's pattern center. LiveIndexer and DynamicalIndexer build one with strain_reference; DynamicalIndexer's strain_from_reference takes it and returns strain, rotation and score.
At 1024 x 1024 the 64-pixel Gaussian took 8.5 ms a pattern, as long as the fit itself; averaged down by 8 and drawn back up it takes 0.17 ms. On 16 Si indent patterns against a 25-frame reference the strain moved by 3e-6 (median), 1.6e-5 at most: the differences sit at the screen's edges, which the fit leaves out.
The fit's cost goes with its pixels: 0.9, 2.6 and 11 ms a pattern at 256, 512 and 1024 on a TITAN X, so an application picks the size its scan's frame rate allows.
…y binned A fit call costs about the same for 8 patterns as for 32, so a live consumer that gets a dozen frames at a time gathers them, binned, and fits them together.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Strain against a real reference pattern, fitted over the whole pattern, fast enough to run live during a scan.
StrainReference(de_ebsd.index.live.reference), built once before a scan from the reference point's summed frames:StrainReference.fitfits each pattern against that texture with the existing fused CUDA kernel:LiveIndexer.strain_referenceandDynamicalIndexer.strain_referencebuild one from frames.strain_from_referencetakes a built reference.DynamicalIndexer.strain_from_referencenow returns(strain, rotation_vector, score)and takespattern_centers.fit_reference, the pyramid fit added here, with a polynomial contrast surface.Measured
FLATTEN_SIGMA.Tests
tests/index/test_strain_reference.py(CUDA).tests/index/test_reference_fit.py,test_live.pyandtest_multiphase.py.tests/test_dynamical_indexer_seam.py, which adds a CUDA seam test.test_kinematic_indexing.py::test_invariant_to_gain_and_offsetalready fails on main.Autopilot's PR, which uses this, follows. It needs a release containing this one.