impression comparison on gpu#216
Draft
SimoneAriens wants to merge 4 commits intomainfrom
Draft
Conversation
Diff CoverageDiff: origin/main..HEAD, staged and unstaged changes
Summary
packages/scratch-core/src/conversion/surface_comparison/cell_registration/utils.pyLines 180-188 180 max_per_angle, pos_per_angle = flat.max(dim=1)
181 best_angle_idx = int(max_per_angle.argmax())
182 best_score = float(max_per_angle[best_angle_idx])
183 if best_score > 1.0 + SCORE_TOLERANCE:
! 184 raise ValueError(f"NCC score {best_score} exceeds valid range [-1, 1]")
185 best_score = min(best_score, 1.0)
186
187 score_w = score_maps.shape[3]
188 best_pos = int(pos_per_angle[best_angle_idx]) |
Minimum allowed line rate is |
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.
Added a batched GPU path (PyTorch + CUDA) to match_cells for the coarse cell registration step. When CUDA is available, all rotated comparison images are stacked into a single tensor, uploaded once, and matched against all cell templates using FFT-based normalized cross-correlation (torch.fft).
The original algorithm is unchanged — same angles, same NCC formula, same fill-fraction masking. The only difference is execution on GPU with batched FFTs instead of sequential CPU template matching.