module documentation
Utilities for working with Lightning Flash.
Function | apply |
Applies the given Lightning Flash model to the samples in the collection. |
Function | compute |
Computes embeddings for the samples in the collection using the given Lightning Flash model . |
Function | _do |
Undocumented |
Function | _export |
Undocumented |
Function | _get |
Undocumented |
Constant | _MODEL |
Undocumented |
Constant | _SUPPORTED |
Undocumented |
def apply_flash_model(samples, model, label_field='predictions', confidence_thresh=None, store_logits=False, batch_size=None, num_workers=None, output_dir=None, rel_dir=None, transform_kwargs=None, trainer_kwargs=None):
(source)
¶
Applies the given
Lightning Flash model
to the samples
in the collection.
Parameters | |
samples | a fiftyone.core.collections.SampleCollection |
model | a flash:flash.core.model.Task |
label | the name of the field in which to store the model predictions. When performing inference on video frames, the "frames." prefix is optional |
confidenceNone | an optional confidence threshold to apply to any applicable labels generated by the model |
storeFalse | whether to store logits for the model predictions. This is only supported when the provided model has logits |
batchNone | an optional batch size to use. If not provided, a default batch size is used |
numNone | the number of workers for the data loader to use |
outputNone | an optional output directory in which to write segmentation images. Only applicable if the model generates segmentations. If none is provided, the segmentations are stored in the database |
relNone | an optional relative directory to strip from each input
filepath to generate a unique identifier that is joined with
output_dir to generate an output path for each segmentation
image. This argument allows for populating nested subdirectories in
output_dir that match the shape of the input paths. The path is
converted to an absolute path (if necessary) via
fiftyone.core.storage.normalize_path |
transformNone | an optional dict of transform kwargs to pass into the created data module used by some models |
trainerNone | an optional dict of kwargs used to initialize the
Trainer . These can be used to,
for example, configure the number of GPUs to use and other
distributed inference parameters |
def compute_flash_embeddings(samples, model, embeddings_field=None, batch_size=None, num_workers=None, transform_kwargs=None, trainer_kwargs=None):
(source)
¶
Computes embeddings for the samples in the collection using the given
Lightning Flash model
.
This method only supports applying an :ref:`ImageEmbedder <flash:image_embedder>` to an image collection.
If an embeddings_field is provided, the embeddings are saved to the samples; otherwise, the embeddings are returned in-memory.
Parameters | |
samples | a fiftyone.core.collections.SampleCollection |
model | a flash:flash.core.model.Task |
embeddingsNone | the name of a field in which to store the embeddings |
batchNone | an optional batch size to use. If not provided, a default batch size is used |
numNone | the number of workers for the data loader to use |
transformNone | an optional dict of transform kwargs to pass into the created data module used by some models |
trainerNone | an optional dict of kwargs used to initialize the
Trainer . These can be used to,
for example, configure the number of GPUs to use and other
distributed inference parameters |
Returns | |
one of the following |
|