-
Notifications
You must be signed in to change notification settings - Fork 95
✨ Define SemanticSegmentor
with the New EngineABC
#866
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev-define-engines-abc
Are you sure you want to change the base?
✨ Define SemanticSegmentor
with the New EngineABC
#866
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev-define-engines-abc #866 +/- ##
==========================================================
+ Coverage 91.77% 95.08% +3.30%
==========================================================
Files 73 73
Lines 9354 9215 -139
Branches 1224 1206 -18
==========================================================
+ Hits 8585 8762 +177
+ Misses 756 437 -319
- Partials 13 16 +3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
for more information, see https://pre-commit.ci
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
- Use `input_resolutions` instead of resolution to make engines outputs compatible with ioconfig. - Uses input resolution as a list of dictionaries on units and resolution.
- Use `input_resolutions` instead of resolution to make engines outputs compatible with ioconfig. - Uses input resolution as a list of dictionaries on units and resolution.
…mentor # Conflicts: # tests/engines/test_engine_abc.py # tests/engines/test_patch_predictor.py # tiatoolbox/models/engine/engine_abc.py # tiatoolbox/models/engine/io_config.py # tiatoolbox/models/engine/patch_predictor.py
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This pull request implements a comprehensive refactor of the TIAToolbox engine system, introducing a new abstract base class EngineABC
and implementing SemanticSegmentor
as an extension of the PatchPredictor
. The refactor modernizes the codebase with improved memory management, Dask array integration, and better separation of concerns.
Key changes include:
- New
EngineABC
base class providing unified interface for deep learning engines - Complete rewrite of
SemanticSegmentor
extendingPatchPredictor
with WSI-specific functionality - Integration of Dask arrays for memory-efficient processing and caching
- Enhanced error handling and validation with new exception types
Reviewed Changes
Copilot reviewed 29 out of 29 changed files in this pull request and generated 4 comments.
Show a summary per file
File | Description |
---|---|
tiatoolbox/utils/transforms.py | Added int type annotation to interpolation parameter |
tiatoolbox/utils/misc.py | Enhanced utility functions with Dask integration, memory optimization, and new helper functions |
tiatoolbox/utils/exceptions.py | Added DimensionMismatchError exception class |
tiatoolbox/models/models_abc.py | Updated abstract method signatures for improved type safety |
tiatoolbox/models/engine/semantic_segmentor.py | Complete rewrite implementing new EngineABC architecture |
tiatoolbox/models/engine/patch_predictor.py | Refactored to extend EngineABC with simplified interface |
tiatoolbox/models/engine/engine_abc.py | New abstract base class for all TIAToolbox engines |
tiatoolbox/models/dataset/dataset_abc.py | Enhanced dataset classes with output location tracking and validation |
Comments suppressed due to low confidence (1)
tiatoolbox/models/engine/semantic_segmentor.py:535
- Similar to the previous issue,
self.dataloader
should bedataloader
in the else clause on the following line.
canvas, count, canvas_zarr, count_zarr
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Summary of Changes
Major Additions
Dask Integration:
dask
as a dependency and integrated Dask arrays and lazy computation throughout the engine and patch predictor code.Zarr Output Support:
SemanticSegmentor Engine:
SemanticSegmentor
engine with Dask/Zarr support and new test coverage (test_semantic_segmentor.py
).semantic_segmentor
and removed the oldsemantic_segment
CLI.Enhanced CLI and Config:
Utilities and Validation:
DimensionMismatchError
).Changes to
kwarg
memory-threshold
num-loader-workers
andnum-postproc-workers
intonum-workers
cache_mode
as cache mode is automatically handled.Major Removals/Refactors
Removed Old CLI and Redundant Code:
semantic_segment.py
CLI and replaced it withsemantic_segmentor.py
.Refactored Model and Dataset APIs:
Test Cleanup:
API Consistency:
Notable File Changes
New:
tiatoolbox/cli/semantic_segmentor.py
tests/engines/test_semantic_segmentor.py
Removed:
tiatoolbox/cli/semantic_segment.py
Heavily Modified:
engine_abc.py
,patch_predictor.py
,semantic_segmentor.py
Impact