Skip to content

Added ROI-overlap-based global association#1743

Open
FlorianPfaff wants to merge 7 commits intomainfrom
roioverlap
Open

Added ROI-overlap-based global association#1743
FlorianPfaff wants to merge 7 commits intomainfrom
roioverlap

Conversation

@FlorianPfaff
Copy link
Copy Markdown
Owner

No description provided.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 19, 2026

MegaLinter analysis: Error

Descriptor Linter Files Fixed Errors Warnings Elapsed time
✅ COPYPASTE jscpd yes no no 10.68s
✅ JSON prettier 2 0 0 0 0.4s
✅ JSON v8r 2 0 0 2.54s
✅ MARKDOWN markdownlint 1 0 0 0 0.66s
✅ MARKDOWN markdown-table-formatter 1 0 0 0 0.27s
✅ PYTHON bandit 333 0 0 4.95s
✅ PYTHON black 333 7 0 0 8.32s
✅ PYTHON flake8 333 0 0 2.7s
✅ PYTHON isort 333 10 0 0 0.66s
✅ PYTHON mypy 333 0 0 4.83s
❌ PYTHON pylint 333 1 0 103.53s
✅ PYTHON ruff 333 10 0 0 0.06s
✅ REPOSITORY checkov yes no no 22.03s
✅ REPOSITORY gitleaks yes no no 6.75s
✅ REPOSITORY git_diff yes no no 0.05s
✅ REPOSITORY secretlint yes no no 6.23s
✅ REPOSITORY syft yes no no 3.22s
✅ REPOSITORY trivy-sbom yes no no 2.35s
✅ REPOSITORY trufflehog yes no no 19.15s
✅ YAML prettier 4 0 0 0 0.46s
✅ YAML v8r 4 0 0 5.09s
✅ YAML yamllint 4 0 0 0.43s

Detailed Issues

❌ PYTHON / pylint - 1 error
************* Module pyrecest.tests.test_roi_assignment
pyrecest/tests/test_roi_assignment.py:6:0: R0402: Use 'from pyrecest import backend' instead (consider-using-from-import)

------------------------------------
Your code has been rated at 10.00/10

See detailed reports in MegaLinter artifacts

Your project could benefit from a custom flavor, which would allow you to run only the linters you need, and thus improve runtime performances. (Skip this info by defining FLAVOR_SUGGESTIONS: false)

  • Documentation: Custom Flavors
  • Command: npx mega-linter-runner@9.4.0 --custom-flavor-setup --custom-flavor-linters PYTHON_PYLINT,PYTHON_BLACK,PYTHON_FLAKE8,PYTHON_ISORT,PYTHON_BANDIT,PYTHON_MYPY,PYTHON_RUFF,COPYPASTE_JSCPD,JSON_V8R,JSON_PRETTIER,MARKDOWN_MARKDOWNLINT,MARKDOWN_MARKDOWN_TABLE_FORMATTER,REPOSITORY_CHECKOV,REPOSITORY_GIT_DIFF,REPOSITORY_GITLEAKS,REPOSITORY_SECRETLINT,REPOSITORY_SYFT,REPOSITORY_TRIVY_SBOM,REPOSITORY_TRUFFLEHOG,YAML_PRETTIER,YAML_YAMLLINT,YAML_V8R

MegaLinter is graciously provided by OX Security
Show us your support by starring ⭐ the repository

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 19, 2026

Test Results

    12 files  ± 0     12 suites  ±0   4h 21m 10s ⏱️ + 2m 47s
   991 tests + 6    991 ✅ + 6      0 💤 ± 0  0 ❌ ±0 
12 176 runs  +72  9 424 ✅ +52  2 752 💤 +20  0 ❌ ±0 

Results for commit 194f3d2. ± Comparison against base commit 224177b.

♻️ This comment has been updated with latest results.

@FlorianPfaff
Copy link
Copy Markdown
Owner Author

@copilot Suppress the too-many warnings and fix the rest

************* Module pyrecest.utils.roi_assignment
pyrecest/utils/roi_assignment.py:123:0: R0914: Too many local variables (21/15) (too-many-locals)
pyrecest/utils/roi_assignment.py:178:8: E1101: Instance of 'finfo' has no 'eps' member (no-member)
pyrecest/utils/roi_assignment.py:203:0: R0917: Too many positional arguments (6/5) (too-many-positional-arguments)

@FlorianPfaff
Copy link
Copy Markdown
Owner Author

@copilot Do not use numpy (except numpy.testing) and import from pyrecest.backend instead (as in other files)

…sitional-args, replace finfo.eps with np.spacing

Agent-Logs-Url: https://github.com/FlorianPfaff/PyRecEst/sessions/b2e72a2c-de2b-4998-9776-ab73fd07ca4b

Co-authored-by: FlorianPfaff <6773539+FlorianPfaff@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 20, 2026

@copilot Suppress the too-many warnings and fix the rest

************* Module pyrecest.utils.roi_assignment
...

Fixed in commit 6876bd7:

  • R0914 (too-many-locals): Added to the existing pylint disable comment before assign_by_similarity_matrix.
  • E1101 (no-member on finfo.eps): Replaced np.finfo(float).eps * ... with np.spacing(...), which computes the same machine-epsilon-scaled value without accessing .eps on the finfo object.
  • R0917 (too-many-positional-arguments): Added a # pylint: disable=too-many-positional-arguments comment before associate_rois_by_iou.

@FlorianPfaff
Copy link
Copy Markdown
Owner Author

@copilot Do not use numpy, import from pyrecest.backend (as in other files)

@FlorianPfaff
Copy link
Copy Markdown
Owner Author

@copilot make the functions fail for Jax backend, use skipif for test cases (see other files)

============================
FAILED pyrecest/tests/test_roi_assignment.py::TestRoiIoU::test_pairwise_iou_masks_supports_suite2p_sparse_dicts - TypeError: JAX arrays are immutable and do not support in-place item assignment. Instead of x[idx] = y, use x = x.at[idx].set(y) or another .at[] method: https://docs.jax.dev/en/latest/_autosummary/jax.numpy.ndarray.at.html
FAILED pyrecest/tests/test_roi_assignment.py::TestSimilarityAssignment::test_assignment_keeps_match_at_exact_threshold - TypeError: JAX arrays are immutable and do not support in-place item assignment. Instead of x[idx] = y, use x = x.at[idx].set(y) or another .at[] method: https://docs.jax.dev/en/latest/_autosummary/jax.numpy.ndarray.at.html
FAILED pyrecest/tests/test_roi_assignment.py::TestSimilarityAssignment::test_assignment_maximizes_global_similarity - TypeError: JAX arrays are immutable and do not support in-place item assignment. Instead of x[idx] = y, use x = x.at[idx].set(y) or another .at[] method: https://docs.jax.dev/en/latest/_autosummary/jax.numpy.ndarray.at.html
FAILED pyrecest/tests/test_roi_assignment.py::TestRoiAssociation::test_associate_rois_by_iou_recovers_crossed_order - TypeError: JAX arrays are immutable and do not support in-place item assignment. Instead of x[idx] = y, use x = x.at[idx].set(y) or another .at[] method: https://docs.jax.dev/en/latest/_autosummary/jax.numpy.ndarray.at.html
FAILED pyrecest/tests/test_roi_assignment.py::TestRoiAssociation::test_associate_rois_by_iou_rejects_low_overlap - TypeError: JAX arrays are immutable and do not support in-place item assignment. Instead of x[idx] = y, use x = x.at[idx].set(y) or another .at[] method: https://docs.jax.dev/en/latest/_autosummary/jax.numpy.ndarray.at.html
= 5 failed, 478 passed, 502 skipped, 38 warnings, 9 subtests passed in 1056.91s (0:17:36) =

@FlorianPfaff
Copy link
Copy Markdown
Owner Author

@copilot Can you fix this error that occurs when using the pytorch backend?

=========================== short test summary info ============================
FAILED pyrecest/tests/test_roi_assignment.py::TestRoiIoU::test_roi_iou_dense_masks - ValueError: not enough values to unpack (expected 2, got 1)
FAILED pyrecest/tests/test_roi_assignment.py::TestSimilarityAssignment::test_assignment_keeps_match_at_exact_threshold - TypeError: full() received an invalid combination of arguments - got (int, int, dtype=type), but expected one of:

  • (tuple of ints size, Number fill_value, *, tuple of names names, torch.dtype dtype = None, torch.layout layout = None, torch.device device = None, bool pin_memory = False, bool requires_grad = False)
  • (tuple of ints size, Number fill_value, *, Tensor out = None, torch.dtype dtype = None, torch.layout layout = None, torch.device device = None, bool pin_memory = False, bool requires_grad = False)
    FAILED pyrecest/tests/test_roi_assignment.py::TestSimilarityAssignment::test_assignment_maximizes_global_similarity - TypeError: full() received an invalid combination of arguments - got (int, int, dtype=type), but expected one of:
  • (tuple of ints size, Number fill_value, *, tuple of names names, torch.dtype dtype = None, torch.layout layout = None, torch.device device = None, bool pin_memory = False, bool requires_grad = False)
  • (tuple of ints size, Number fill_value, *, Tensor out = None, torch.dtype dtype = None, torch.layout layout = None, torch.device device = None, bool pin_memory = False, bool requires_grad = False)
    FAILED pyrecest/tests/test_roi_assignment.py::TestRoiAssociation::test_associate_rois_by_iou_recovers_crossed_order - TypeError: full() received an invalid combination of arguments - got (int, int, dtype=type), but expected one of:
  • (tuple of ints size, Number fill_value, *, tuple of names names, torch.dtype dtype = None, torch.layout layout = None, torch.device device = None, bool pin_memory = False, bool requires_grad = False)
  • (tuple of ints size, Number fill_value, *, Tensor out = None, torch.dtype dtype = None, torch.layout layout = None, torch.device device = None, bool pin_memory = False, bool requires_grad = False)
    FAILED pyrecest/tests/test_roi_assignment.py::TestRoiAssociation::test_associate_rois_by_iou_rejects_low_overlap - ValueError: not enough values to unpack (expected 2, got 1)
    = 5 failed, 807 passed, 179 skipped, 5585436 warnings, 18 subtests passed in 2029.70s (0:33:49) =

Copilot AI and others added 2 commits April 21, 2026 06:49
Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 21, 2026

@copilot Can you fix this error that occurs when using the pytorch backend?

=========================== short test summary info ============================
...

Fixed in commit 2339aef:

  1. ValueError: not enough values to unpacktorch.nonzero() returns a 2D tensor of shape (N, 2) instead of a tuple of 1D arrays. The code now checks whether the result is a tuple (NumPy/JAX style) and falls back to column-slicing for PyTorch.

  2. TypeError: full() received an invalid combination of arguments — Two issues: (a) PyTorch's full requires a tuple for the size argument (not a scalar int), so all full(n, ...) calls are now full((n,), ...); (b) Python's built-in int/float types are not valid PyTorch dtypes, replaced throughout with int64 and float64 imported from pyrecest.backend.

@FlorianPfaff FlorianPfaff force-pushed the main branch 2 times, most recently from 7b21428 to 429a157 Compare April 21, 2026 13:50
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.

2 participants