Skip to content

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

❌ Patch coverage is 83.62832% with 111 lines in your changes missing coverage. Please review.
✅ Project coverage is 91.19%. Comparing base (3fa051f) to head (56867fc).

Files with missing lines Patch % Lines
tiatoolbox/models/dataset/dataset_abc.py 72.85% 38 Missing ⚠️
tiatoolbox/models/engine/io_config.py 56.75% 32 Missing ⚠️
tiatoolbox/utils/misc.py 57.14% 26 Missing and 1 partial ⚠️
tiatoolbox/models/engine/semantic_segmentor.py 33.33% 12 Missing ⚠️
tiatoolbox/cli/nucleus_instance_segment.py 0.00% 1 Missing ⚠️
tiatoolbox/cli/semantic_segment.py 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #578      +/-   ##
===========================================
- Coverage    99.09%   91.19%   -7.90%     
===========================================
  Files           71       73       +2     
  Lines         9161     9374     +213     
  Branches      1196     1230      +34     
===========================================
- Hits          9078     8549     -529     
- Misses          59      792     +733     
- Partials        24       33       +9     

☔ 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.

- 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 30 commits February 5, 2025 12:03
…917)

* ♻️ Use `input_resolutions` instead of 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.

* ♻️ Use `input_resolutions` instead of 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.

* ✅ Add test to cli.
# Conflicts:
#	tiatoolbox/models/engine/patch_predictor.py
# Conflicts:
#	tiatoolbox/utils/misc.py
# Conflicts:
#	tests/models/test_feature_extractor.py
#	tiatoolbox/models/models_abc.py
# Conflicts:
#	tiatoolbox/cli/common.py
#	tiatoolbox/cli/nucleus_instance_segment.py
#	tiatoolbox/cli/patch_predictor.py
#	tiatoolbox/models/engine/semantic_segmentor.py
* ⚡ Make WSIPatchDataset Pickleable to Support Windows Multithreading (#947)

This PR makes the WSIPatchDataset class picklable by delaying the creation of the reader object until the first call to `__getitem__`. This enables the use of multiple loader workers on Windows without errors and provides significant performance improvements.

- Delays reader object instantiation to the first `__getitem__` call instead of during initialization
- Extracts reader creation logic into a separate `_get_reader` method
- Stores image path and mode as instance variables for lazy initialization

Speedup for the WSI prediction cell of the patch_prediction example notebook: 
2min 48 sec with 0 loader workers -> 1min 13 sec with 4 workers.

Note: this PR doesn't have any effect for Linux as the multi-threading already works fine there because Linux multithreading doesn't require things to be pickleable

* 🔀 Merge branch develop into dev-engine-abc

* 🐛 Fix reader_info read

---------

Co-authored-by: Mark Eastwood <[email protected]>
# Conflicts:
#	tiatoolbox/models/dataset/classification.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment