Closed hvgazula closed 8 months ago
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.
Fixed.
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.
It will be a class method
list_available_methods(self)
.