Skip to content

Efficient masked inference#1007

Closed
measty wants to merge 5 commits intodev-define-engines-abcfrom
efficient-masked-inference
Closed

Efficient masked inference#1007
measty wants to merge 5 commits intodev-define-engines-abcfrom
efficient-masked-inference

Conversation

@measty
Copy link
Copy Markdown
Collaborator

@measty measty commented Feb 25, 2026

draft masked inference PR - take any ideas that are useful from here

@codecov
Copy link
Copy Markdown

codecov Bot commented Feb 25, 2026

Codecov Report

❌ Patch coverage is 81.56028% with 26 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (dev-define-engines-abc@6ea553d). Learn more about missing BASE report.

Files with missing lines Patch % Lines
tiatoolbox/models/engine/multi_task_segmentor.py 79.68% 18 Missing and 8 partials ⚠️
Additional details and impacted files
@@                    Coverage Diff                    @@
##             dev-define-engines-abc    #1007   +/-   ##
=========================================================
  Coverage                          ?   99.21%           
=========================================================
  Files                             ?       83           
  Lines                             ?    11356           
  Branches                          ?     1503           
=========================================================
  Hits                              ?    11267           
  Misses                            ?       54           
  Partials                          ?       35           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

curr_chunk[-overlap:] += next_chunk[:overlap]
curr_count[-overlap:] += next_count[:overlap]
for i, overlap_ in enumerate(tqdm_loop):
overlap = int(overlap_)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since I shift all the coordinates to new masked coordinates, positive overlap is not required in #1006

Array of output locations for each patch.
change_indices (np.ndarray | list[np.ndarray]):
Indices indicating where to flush and merge patches.
x_offset (int | None):
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since I shift all the coordinates to new masked coordinates, x_offset is not required in #1006

output_locs: np.ndarray,
change_indices: np.ndarray | list[int],
x_offset: int | None = None,
canvas_width: int | None = None,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have incorporated this change in #1006

update_ui_on_new_annotations(ann_types)

# Clean up temp files
rmtree(tmp_save_dir)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure, why this change in this PR.

@shaneahmed shaneahmed added the enhancement New feature or request label Feb 26, 2026
@shaneahmed shaneahmed added this to the Release v2.0.0 milestone Feb 26, 2026
shaneahmed added a commit that referenced this pull request Feb 26, 2026
- Add canvas width to merge horizontal
if hasattr(dataloader.dataset, "full_outputs")
else dataloader.dataset.outputs
)
active_output_locs = _get_dataset_output_locs(dataloader.dataset)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is calculated using masked locations in #1006

canvas_np,
output_locs,
change_indices,
x_offset=canvas_x_start,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not required in #1006 due to new masked coordinates.

output_locs,
change_indices,
x_offset=canvas_x_start,
canvas_width=canvas_width,
Copy link
Copy Markdown
Member

@shaneahmed shaneahmed Feb 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Incorporated in #1006.

@shaneahmed
Copy link
Copy Markdown
Member

Thanks @measty Closing this PR after changes have been merged in #1006

@shaneahmed shaneahmed closed this Mar 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants