Skip to content
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

Add feature to list available models in Segmentation #303

Closed
hvgazula opened this issue Mar 20, 2024 · 3 comments · Fixed by #295
Closed

Add feature to list available models in Segmentation #303

hvgazula opened this issue Mar 20, 2024 · 3 comments · Fixed by #295
Assignees

Comments

@hvgazula
Copy link
Contributor

It will be a class method list_available_methods(self).

@hvgazula hvgazula self-assigned this Mar 20, 2024
@hvgazula hvgazula added this to Harsha Mar 20, 2024
@hvgazula hvgazula moved this to Todo in Harsha Mar 20, 2024
@hvgazula hvgazula linked a pull request Mar 21, 2024 that will close this issue
Merged
hvgazula added a commit that referenced this issue Mar 22, 2024
@hvgazula
Copy link
Contributor Author

hvgazula commented Mar 22, 2024

Added a class method list_available_models() to Segmentation. However, the problem with this fix is, a model has to be loaded first. For example-

from nobrainer.processing import Segmentation
from nobrainer.models import unet

test1 = Segmentation()   # fails because needs a `base_model` to initialize
model = unet  # "unet"
test2 = Segmentation(model)  # will work fine

test1.list_available_models()  # will not work
test2.list_available_models()  # will work

A more cleaner way to do things will be

test = Segmentation()
test.list_available_models()
test.add_model("unet")  # or `load_model`

In short, need to rewriteSegmentation.__init__() to reconcile both test = Segmentation() and test = Segmentation(model) such that the class method will work no matter what.

hvgazula added a commit that referenced this issue Mar 22, 2024
@hvgazula
Copy link
Contributor Author

Fixed.

@hvgazula hvgazula moved this from Todo to Done in Harsha Mar 22, 2024
@satra
Copy link
Contributor

satra commented Mar 22, 2024

one can have a classmethod instead of just a method, so init does not need to be called. see the base class for some example classmethods.

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

Successfully merging a pull request may close this issue.

2 participants