Image Embedding module — Orange3 Image Analytics documentation

# Image Embedding module

class orangecontrib.imageanalytics.image_embedder.ImageEmbedder(model: str = 'inception-v3', server_url: str = 'https://api.garaza.io/')

  Client side functionality for accessing a remote image embedding backend.

  model

    Name of the model, must be one from MODELS dictionary

  server_url

    The url of the server with embedding backend.

  Examples

      >>> import Orange
      >>> from orangecontrib.imageanalytics.image_embedder import ImageEmbedder

      >>> # embedding from list of paths
      >>> image_file_paths = ['image001.jpg', 'image001.jpg']
      >>> with ImageEmbedder(model='model_name') as emb:
      ...    embeddings = emb(image_file_paths)

      >>> # embedding from orange tabl
      >>> table = Orange.data.Table('Table_with_image_path.csv')
      >>> with ImageEmbedder(model='model_name') as emb:
      ...    embeddings = emb(table, col="image_path_column")

  clear_cache() → None

    Function clear cache for the selected embedder. If embedder is loaded cache is cleaned from its dict otherwise we load cache and clean it from file.

  static construct_output_data_table(embedded_images: Table, embeddings_: ndarray) → Table

    Join the orange table with embeddings.

    Parameters

      - embedded_images – Table with images that were successfully embedded

      - embeddings – Embeddings for images from table

    Return type

      Table with added embeddings to data.

  from_table(data: Table, col: Union[str, Variable] = 'image', callback: Optional[Callable] = None) → Tuple[Table, Table, int]

    Calls embedding when data are provided as a Orange Table.

    Parameters

      - data – Data table with image paths

      - col – The column with image paths

      - callback – Optional callback - function that is called for every embedded image and is used to report the progress.

  is_local_embedder() → bool

    Tells whether selected embedder is local or not.

  static prepare_output_data(input_data: Table, embeddings_: List[List[float]]) → Tuple[Table, Table, int]

    Prepare output data when data table on input.

    Parameters

      - input_data – The table with original data that are joined with embeddings

      - embeddings – List with embeddings

    Returns

      - Tuple where first parameter is table with embedded images, the second

      - table with skipped images and third the number of skipped images.