Shortcuts

ImageEmbedder

class flash.image.embedding.model.ImageEmbedder(training_strategy, head, pretraining_transform, backbone='resnet', pretrained=False, optimizer='Adam', lr_scheduler=None, learning_rate=None, backbone_kwargs=None, training_strategy_kwargs=None, pretraining_transform_kwargs=None)[source]

The ImageEmbedder is a Task for obtaining feature vectors (embeddings) from images. For more details, see Image Embedder.

Parameters
  • training_strategy (str) – Training strategy from VISSL, select between ‘simclr’, ‘swav’, ‘dino’, ‘moco’, or ‘barlow_twins’.

  • head (str) – projection head used for task, select between ‘simclr_head’, ‘swav_head’, ‘dino_head’, ‘moco_head’, or ‘barlow_twins_head’.

  • pretraining_transform (str) – transform applied to input image for pre-training SSL model. Select between ‘simclr_transform’, ‘swav_transform’, ‘dino_transform’, ‘moco_transform’, or ‘barlow_twins_transform’.

  • backbone (str) – VISSL backbone, defaults to resnet.

  • pretrained (bool) – Use a pretrained backbone, defaults to False.

  • optimizer (TypeVar(OPTIMIZER_TYPE, str, Callable, Tuple[str, Dict[str, Any]], None)) – Optimizer to use for training.

  • lr_scheduler (Optional[TypeVar(LR_SCHEDULER_TYPE, str, Callable, Tuple[str, Dict[str, Any]], Tuple[str, Dict[str, Any], Dict[str, Any]], None)]) – The LR scheduler to use during training.

  • learning_rate (Optional[float]) – Learning rate to use for training, defaults to 1e-3.

  • backbone_kwargs (Optional[Dict[str, Any]]) – arguments to be passed to VISSL backbones, i.e. vision_transformer and resnet.

  • training_strategy_kwargs (Optional[Dict[str, Any]]) – arguments passed to VISSL loss function, projection head and training hooks.

  • pretraining_transform_kwargs (Optional[Dict[str, Any]]) – arguments passed to VISSL transforms.

classmethod available_finetuning_strategies(cls)

Returns a list containing the keys of the available Finetuning Strategies.

Return type

List[str]

classmethod available_lr_schedulers(cls)

Returns a list containing the keys of the available LR schedulers.

Return type

List[str]

classmethod available_optimizers(cls)

Returns a list containing the keys of the available Optimizers.

Return type

List[str]

classmethod available_outputs(cls)

Returns the list of available outputs (that can be used during prediction or serving) for this Task.

Examples

..testsetup:

>>> from flash import Task
>>> print(Task.available_outputs())
['preds', 'raw']
Return type

List[str]

classmethod available_training_strategies(cls)[source]

Get the list of available training strategies (passed to the training_strategy argument) for this task.

Examples

>>> from flash.image import ImageEmbedder
>>> ImageEmbedder.available_training_strategies()  
['barlow_twins', ..., 'swav']
Return type

List[str]

Read the Docs v: 0.7.2
Versions
latest
stable
0.7.2
0.7.1
0.7.0
0.6.0
0.5.2
0.5.1
0.5.0
0.4.0
0.3.2
0.3.1
0.3.0
0.2.3
0.2.2
0.2.1
0.2.0
0.1.0post1
docs-fix_typing
Downloads
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.