NKI-AI / ahcore

Ahcore is the AI for Oncology core computational pathology toolkit
Apache License 2.0
15 stars 1 forks source link

Set precision while writing H5 files. #52

Closed AjeyPaiK closed 7 months ago

AjeyPaiK commented 8 months ago

This PR makes the following changes:

  1. We can now reduce the precision of tensors while writing them to disc using H5FileImageWriter.
  2. The utility functions used by callbacks are now moved to ahcore.utils under callbacks.
  3. The model outputs are logits of type float32 and hence dumping them into disc creates large h5 files. This is optimised by adding an optional normalization function (one of softmax, sigmoid) to scale the logits appropriately. The user can also set a precision of their choice (either float32, float16 or uint8).
  4. Some minor changes has been made to pre transfroms to handle empty tiles better.
  5. These changes fix #50 and #51 and #48.
AjeyPaiK commented 7 months ago

@moerlemans Thanks for the comment. I added NormalizationTypes to leave this up to the user. I agree that passing all outputs through sigmoid may not be the best way to go.