|
@@ -18,6 +18,20 @@ class BaseAnnotations(abc.ABC):
|
|
|
|
|
|
FEATURE_PHONY = dict(train=["train"], test=["test", "val"])
|
|
|
|
|
|
+ @classmethod
|
|
|
+ def new(cls, opts, **additional_kwargs):
|
|
|
+ kwargs = dict(
|
|
|
+ root_or_infofile=opts.data,
|
|
|
+ parts=getattr(opts, "parts", None),
|
|
|
+ load_strict=getattr(opts, "load_strict", False),
|
|
|
+ feature_model=getattr(opts, "feature_model", False),
|
|
|
+ )
|
|
|
+
|
|
|
+ kwargs.update(additional_kwargs)
|
|
|
+
|
|
|
+ return cls(**kwargs)
|
|
|
+
|
|
|
+
|
|
|
def __init__(self, *, root_or_infofile, feature_model=None, load_strict=True, **kwargs):
|
|
|
super(BaseAnnotations, self).__init__(**kwargs)
|
|
|
self.feature_model = feature_model
|