Skip to content
This repository has been archived by the owner on Mar 17, 2021. It is now read-only.

Straightforward way to re-use model (from zoo) in python #99

Open
michaelschwier opened this issue May 17, 2018 · 2 comments
Open

Straightforward way to re-use model (from zoo) in python #99

michaelschwier opened this issue May 17, 2018 · 2 comments

Comments

@michaelschwier
Copy link

Maybe I missed it (if so please give me a hint), but it would be nice if there was a straight forward way to load a pre-trained model from the model zoo and then feed it input data (e.g. as numpy array) via python, run it, and get the results directly in python (e.g. again as numpy array).

If I understand it correctly, such an easy interface is only available via command line?

@wyli
Copy link
Member

wyli commented May 18, 2018

Yes this is a high priority task on the to-do list, I'm copying @eligibson's ticket here:

It is currently not trivial to run NiftyNet as part of a separate python script. It would be nice to have an alternative to run_application() that let you do the following:

import niftynet
nn = ApplicationDriver()
nn.initialise_application(system_param, input_data_param)
my_output_data_dict = nn.process_image(my_input_data_dict)

This would enable NN to be used more easily in complex pipelines, and integrated more easily into interactive systems.

This would require a few modifications:

  1. a process_image function that takes in a dictionary of data (matching what you would get from a reader?), processes it as if it had been read from a file, and returns the results as would be written to a file.
  2. to facilitate this, the reading/writing to files would need to be decoupled from the preprocessing and the sampler systems.

(FYI @crousseau)

@michaelschwier
Copy link
Author

Great to know you are working on it. Let me know when you get there :) I also think this will make a big difference in terms of integrating niftynet into applications.

Thanks @wyli for your quick answers and very nice work on NN!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants