-
Notifications
You must be signed in to change notification settings - Fork 72
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
π§βπ» Define PatchPredictor
#783
base: dev-define-engines-abc
Are you sure you want to change the base?
Conversation
shaneahmed
commented
Feb 9, 2024
•
edited
Loading
edited
- 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.
for more information, see https://pre-commit.ci
β¦geAnalytics/tiatoolbox into dev-update-engine-abc-wsi
β¦ImageAnalytics/tiatoolbox into dev-update-engine-abc-wsi
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
β¦ImageAnalytics/tiatoolbox into dev-update-engine-abc-wsi
for more information, see https://pre-commit.ci
β¦ImageAnalytics/tiatoolbox into dev-update-engine-abc-wsi
β¦ImageAnalytics/tiatoolbox into dev-update-engine-abc-wsi
for more information, see https://pre-commit.ci
β¦ImageAnalytics/tiatoolbox into dev-update-engine-abc-wsi
for more information, see https://pre-commit.ci
β¦ls.misc.dict_to_store() method
for more information, see https://pre-commit.ci
- Logger filters need to be reset at the start of run. This is required if a failed test with logs is run in another pytest. - This PR fixes [failed tests](https://github.com/TissueImageAnalytics/tiatoolbox/actions/runs/9414105193/job/25932262521) in #783.
Thank you @shaneahmed and toolbox team for committing such a good revamp of PatchPredictor. I left only minor feedback. |
for more information, see https://pre-commit.ci
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.
I have done an initial review and commented a few things that need changing.
A few other notes as well: this is awkward to review as some changes are wrapped up in the branch this merges into - some of the issues I have found don't show up in the code changed for this PR cause the actual change is in the dev-update-engine-abc branch.
There will need to be a review of the notebooks before this gets merged, as this will at the very least break the patch-prediction notebook and perhaps others.
Also, is the change of behaviour for a model like "resnet18-kather100k" intentional? previously it would return hard class predictions also, now it does not
@@ -1203,10 +1203,10 @@ def add_from_dat( | |||
|
|||
|
|||
def patch_predictions_as_annotations( | |||
preds: list, | |||
preds: list | np.ndarray, |
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.
If preds can be empty list this function wont work. Need to iterate over coords instead which always must be there, and save preds only if they exist. At the moment using patch predictor on a WSI with save_type="AnnotationStore" just saves an empty store
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.
Addressed in this commit 5085035
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.
There is still some issues with how it is being saved.
- the correct filename isn't being passed to engine.save_predictions, so the saved .db is just called the default output.db. It is being set in:
tiatoolbox/tiatoolbox/models/engine/engine_abc.py
Line 1041 in 45a339b
out = {image: save_dir / (str(image.stem) + suffix) for image in self.images}
but this is not being used anywhere. - The scale_factor is not being set and passed to save_predictions, so the patches are currently saved and can be visualized, but appear wrongly scaled. The scale factor needs to be calculated as model_mpp (from io config) / slide_mpp somewhere in the pipeline and added to kwargs.
Signed-off-by: Shan E Ahmed Raza <[email protected]>
Signed-off-by: Shan E Ahmed Raza <[email protected]>
Signed-off-by: Shan E Ahmed Raza <[email protected]>
Signed-off-by: Shan E Ahmed Raza <[email protected]>