Skip to content
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

⚡ Improve Engine Performance and Implementation #578

Draft
wants to merge 123 commits into
base: develop
Choose a base branch
from

Conversation

shaneahmed
Copy link
Member

@shaneahmed shaneahmed commented Mar 31, 2023

  • Improve Engines performance and implementation
  • Redesigns PatchPredictor engine using the new EngineABC base class.
  • The WSIs are now processed using the same code as for the processing the patches using WSI based dataloader.
  • The intermediate output is saved as zarr for the WSIs to resolve memory issues.
  • The output of model architectures should now be a dictionary.
  • The output can be specified as AnnotationStore for visualisation using TIAViz.
  • Fix mypy Type Checks for cli/common.py
  • Redesigns PatchPredictor engine using the new EngineABC base class.
  • The WSIs are now processed using the same code as for the processing the patches using WSI based dataloader.
  • The intermediate output is saved as zarr for the WSIs to resolve memory issues.
  • The output of model architectures should now be a dictionary.
  • The output can be specified as AnnotationStore for visualisation using TIAViz.
  • Add PatchPredictor Engine based on EngineABC
  • Add return_probabilities option to Params
  • Removes merge_predictions option in PatchPredictor engine.
  • Defines post_process_cache_mode which allows running the algorithm on WSI
  • Add infer_wsi for WSI inference
  • Removes save_wsi_output as this is not required after post processing.
  • Removes merge_predictions and fixes docstring in EngineABCRunParams
  • compile_model is now moved to EngineABC init
  • Fixes bug with _calculate_scale_factor
  • Fixes a bug in class_dict definition.
  • _get_zarr_array is now a public function get_zarr_array in misc
  • patch_predictions_as_annotations runs the loop on patch_coords instead of class_probs

@shaneahmed shaneahmed self-assigned this Mar 31, 2023
@shaneahmed shaneahmed added the enhancement New feature or request label Mar 31, 2023
@codecov
Copy link

codecov bot commented Mar 31, 2023

Codecov Report

Attention: Patch coverage is 83.48348% with 110 lines in your changes missing coverage. Please review.

Project coverage is 91.53%. Comparing base (4a1940d) to head (f6ba41f).

Files with missing lines Patch % Lines
tiatoolbox/models/dataset/dataset_abc.py 70.99% 38 Missing ⚠️
tiatoolbox/models/engine/io_config.py 56.16% 32 Missing ⚠️
tiatoolbox/utils/misc.py 57.81% 26 Missing and 1 partial ⚠️
tiatoolbox/models/engine/semantic_segmentor.py 29.41% 12 Missing ⚠️
tiatoolbox/cli/nucleus_instance_segment.py 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #578      +/-   ##
===========================================
- Coverage    99.90%   91.53%   -8.38%     
===========================================
  Files           69       71       +2     
  Lines         8715     8930     +215     
  Branches      1149     1184      +35     
===========================================
- Hits          8707     8174     -533     
- Misses           3      742     +739     
- Partials         5       14       +9     

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

- Refactor engines_abc.py
@shaneahmed shaneahmed changed the title ⚡ Improve Engines Performance and Implementation ⚡ Improve Engine Performance and Implementation Apr 28, 2023
shaneahmed and others added 9 commits September 18, 2024 12:43
- Redesigns PatchPredictor engine using the new EngineABC base class.
- The WSIs are now processed using the same code as for the processing the patches using WSI based dataloader.
- The intermediate output is saved as zarr for the WSIs to resolve memory issues.
- The output of model architectures should now be a dictionary.
- The output can be specified as AnnotationStore for visualisation using TIAViz.

---------

Co-authored-by: abishekrajvg <abishekraj6797@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
- Fix `mypy` Type Checks for `cli/common.py`
shaneahmed and others added 5 commits November 15, 2024 18:04
-  Add `PatchPredictor` Engine based on `EngineABC`
- Add `return_probabilities` option to Params
- Removes `merge_predictions` option in `PatchPredictor` engine.
- Defines `post_process_cache_mode` which allows running the algorithm on `WSI`
- Add `infer_wsi` for WSI inference
- Removes `save_wsi_output` as this is not required after post processing.
- Removes `merge_predictions` and fixes docstring in EngineABCRunParams
- `compile_model` is now moved to EngineABC init
- Fixes bug with `_calculate_scale_factor`
- Fixes a bug in `class_dict` definition.
- `_get_zarr_array` is now a public function `get_zarr_array` in `misc`
- `patch_predictions_as_annotations` runs the loop on `patch_coords` instead of `class_probs`

---------

Co-authored-by: Mark Eastwood <20169086+measty@users.noreply.github.com>
Co-authored-by: Mostafa Jahanifar <74412979+mostafajahanifar@users.noreply.github.com>
Co-authored-by: Adam Shephard <39619155+adamshephard@users.noreply.github.com>
Co-authored-by: Jiaqi-Lv <60471431+Jiaqi-Lv@users.noreply.github.com>
shaneahmed added a commit that referenced this pull request Nov 21, 2024
- Merge changes from #578 which will improve the performance of main branch.
- It will also help simplify #578
shaneahmed added a commit that referenced this pull request Nov 21, 2024
- Add changes from New engine design #578. This will not only simplify the PR but also keep the main repo up to date.
- Refactor `model_to` to `model_abc`
- Instead of `on_gpu` use `device` as an input in line with `PyTorch`.
- `infer_batch` uses `device` as an input instead of `on_gpu`
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
2 participants