Skip to content

Fix focal points between separated salient regions - #9

Merged
TorstenDittmann merged 3 commits into
mainfrom
fix/strongest-saliency-region
Sep 7, 2026
Merged

Fix focal points between separated salient regions#9
TorstenDittmann merged 3 commits into
mainfrom
fix/strongest-saliency-region

Conversation

@TorstenDittmann

@TorstenDittmann TorstenDittmann commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Summary

  • group high-saliency pixels into 8-connected regions
  • select the region with the greatest integrated saliency
  • calculate the weighted focal point only within that region
  • document the updated focal-point behavior
  • add regression coverage for separated subjects with equal peak confidence

This prevents two separated subjects from averaging to a focal point in empty space between them.

Before and after

Before and after focal-point comparison

The supplied example changes from gravity=(0.4705, 0.4784) to gravity=(0.0770, 0.4788), selecting the stronger left-dog region.

Validation

  • go test ./...
  • ONNXRUNTIME_LIB=/path/to/libonnxruntime.dylib go test -tags=integration ./cmd/autogravity
  • manually verified the supplied image through POST /analyze

@greptile-apps

greptile-apps Bot commented Sep 7, 2026

Copy link
Copy Markdown

Greptile Summary

The PR changes focal-point calculation to select the 8-connected salient region with the greatest integrated saliency before calculating its weighted centroid.

  • Adds connected-component selection above half the peak activation.
  • Preserves peak-based confidence and center fallback behavior.
  • Documents the updated focal-point semantics.
  • Adds regression coverage for separated subjects and diagonal connectivity.

Confidence Score: 5/5

The PR appears safe to merge; no outstanding correctness, security, or repository-rule issues remain.

The diagonal-connectivity regression fully addresses the resolved previous finding, and the changes since the previous review introduce no actionable new issue.

Important Files Changed

Filename Overview
internal/gravity/gravity.go Implements thresholded 8-connected component discovery and computes the focal point from the strongest component.
internal/gravity/gravity_test.go Covers separated salient subjects, within-component weighting, and the previously requested diagonal-connectivity behavior.
README.md Documents selection of the connected salient region with the greatest total saliency.
docs/src/lib/site.ts Updates site metadata to describe the strongest-region focal-point behavior.
docs/src/routes/index.tsx Updates public endpoint documentation to match the revised algorithm.

Reviews (3): Last reviewed commit: "test: cover diagonal saliency connectivi..." | Re-trigger Greptile

Comment thread internal/gravity/gravity_test.go
@TorstenDittmann
TorstenDittmann merged commit b04e3ac into main Sep 7, 2026
4 checks passed
@TorstenDittmann
TorstenDittmann deleted the fix/strongest-saliency-region branch September 7, 2026 20:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant