core-bioimage-io-python icon indicating copy to clipboard operation
core-bioimage-io-python copied to clipboard

Improve TF Model Adapter

Open FynnBe opened this issue 2 years ago • 0 comments

We should improve the TF Model Adapter to be more robust.

I can't improve this right now, but here are some notes from looking into it briefly, if someone else wants to tackle it already:

We should improve the TF Moder adapter here: https://github.com/bioimage-io/core-bioimage-io-python/blob/bc25746cad127e6a54d0885c2212aa8f50a049f8/bioimageio/core/prediction_pipeline/_model_adapters/_tensorflow_model_adapter.py#L65-L66

here weight_file is a folder in which we should look for the expected saved_model.pb file and possibly add the nested folder to its path.

We potentially unzip nested zip files (calling self.require_unzipped twice, which we probably shouldn't)

We also implicitly assume the use of tensorflow 1: https://github.com/bioimage-io/core-bioimage-io-python/blob/bc25746cad127e6a54d0885c2212aa8f50a049f8/bioimageio/core/prediction_pipeline/_model_adapters/_tensorflow_model_adapter.py#L34-L35

Maybe https://www.tensorflow.org/api_docs/python/tf/saved_model/save is a relevant reference for updating this part.

Originally posted by @FynnBe in https://github.com/bioimage-io/core-bioimage-io-python/issues/317#issuecomment-1331904114

FynnBe avatar Nov 30 '22 10:11 FynnBe