class ETAModel(fom.Model, fom.EmbeddingsMixin, fom.LogitsMixin): (source)
Constructor: ETAModel(config, _model)
Wrapper for running an eta.core.learning.Model model.
Parameters | |
config | an ETAModelConfig |
Class Method | from |
Builds an ETAModel for running the provided eta.core.learning.Model instance. |
Method | __enter__ |
Undocumented |
Method | __exit__ |
Undocumented |
Method | __init__ |
Undocumented |
Method | embed |
Generates an embedding for the given data. |
Method | embed |
Generates embeddings for the given iterable of data. |
Method | get |
Returns the embeddings generated by the last forward pass of the model. |
Method | predict |
Performs prediction on the given data. |
Method | predict |
Performs prediction on the given iterable of data. |
Method | preprocess |
Undocumented |
Instance Variable | config |
Undocumented |
Property | has |
Whether this instance can generate embeddings. |
Property | has |
Whether this instance can generate logits for its predictions. |
Property | media |
The media type processed by the model. |
Property | preprocess |
Whether to apply transforms during inference (True) or to assume that they have already been applied (False). |
Property | ragged |
True/False whether transforms may return tensors of different sizes. If True, then passing ragged lists of data to predict_all is not allowed. |
Property | transforms |
The preprocessing function that will/must be applied to each input before prediction, or None if no preprocessing is performed. |
Method | _ensure |
Undocumented |
Method | _parse |
Undocumented |
Instance Variable | _model |
Undocumented |
Inherited from Model
:
Property | can |
Whether this instance can generate prompt embeddings. |
Inherited from LogitsMixin
(via Model
, EmbeddingsMixin
):
Method | store |
Undocumented |
Property | store |
Whether the model should store logits in its predictions. |
Instance Variable | _store |
Undocumented |
Generates an embedding for the given data.
Subclasses can override this method to increase efficiency, but, by
default, this method simply calls predict
and then returns
get_embeddings
.
Parameters | |
arg | the data. See predict for details |
Returns | |
a numpy array containing the embedding |
Generates embeddings for the given iterable of data.
Subclasses can override this method to increase efficiency, but, by
default, this method simply iterates over the data and applies
embed
to each.
Parameters | |
args | an iterable of data. See predict_all for details |
Returns | |
a numpy array containing the embeddings stacked along axis 0 |
Returns the embeddings generated by the last forward pass of the model.
By convention, this method should always return an array whose first
axis represents batch size (which will always be 1 when predict
was last used).
Returns | |
a numpy array containing the embedding(s) |
fiftyone.core.models.Model.predict
Performs prediction on the given data.
Image models should support, at minimum, processing arg values that are uint8 numpy arrays (HWC).
Video models should support, at minimum, processing arg values that are eta.core.video.VideoReader instances.
Parameters | |
arg | the data |
Returns | |
a fiftyone.core.labels.Label instance or dict of
fiftyone.core.labels.Label instances containing the
predictions |
fiftyone.core.models.Model.predict_all
Performs prediction on the given iterable of data.
Image models should support, at minimum, processing args values that are either lists of uint8 numpy arrays (HWC) or numpy array tensors (NHWC).
Video models should support, at minimum, processing args values that are lists of eta.core.video.VideoReader instances.
Subclasses can override this method to increase efficiency, but, by
default, this method simply iterates over the data and applies
predict
to each.
Parameters | |
args | an iterable of data |
Returns | |
a list of fiftyone.core.labels.Label instances or a list
of dicts of fiftyone.core.labels.Label instances
containing the predictions |
Whether this instance can generate embeddings.
This method returns False by default. Methods that can generate
embeddings will override this via implementing the
EmbeddingsMixin
interface.
fiftyone.core.models.Model.has_logits
Whether this instance can generate logits for its predictions.
This method returns False by default. Methods that can generate
logits will override this via implementing the
LogitsMixin
interface.
fiftyone.core.models.Model.media_type
The media type processed by the model.
Supported values are "image" and "video".
fiftyone.core.models.Model.preprocess
Whether to apply transforms
during inference (True) or to
assume that they have already been applied (False).
True/False whether transforms
may return tensors of
different sizes. If True, then passing ragged lists of data to
predict_all
is not allowed.
fiftyone.core.models.Model.transforms
The preprocessing function that will/must be applied to each input before prediction, or None if no preprocessing is performed.