Summary in table#

We are already pretty familiar with summary(), which prints a table of summary for DocumentArray and its attributes:

from docarray import DocumentArray

da = DocumentArray.empty(3)

        Documents Summary         
  Length                 3        
  Homogenous Documents   True     
  Common Attributes      ('id',)  
                     Attributes Summary                     
  Attribute   Data type   #Unique values   Has empty value  
  id          ('str',)    3                False            

Image sprites#

If a DocumentArray contains all image Documents, you can plot all images in one sprite image using plot_image_sprites().

from docarray import DocumentArray

docs = DocumentArray.from_files('*.jpg')

Plot Matches#

If an image Document contains the matching images in its .matches attribute, you can visualise the matching results using plot_matches_sprites().

import numpy as np
from docarray import DocumentArray

da = DocumentArray.from_files('*.jpg')
da.embeddings = np.random.random([len(da), 10])
da[0].plot_matches_sprites(top_k=5, channel_axis=-1, inv_normalize=False)

Embedding projector#


This feature requires fastapi dependency. You can do pip install "docarray[full]" to install it.

If a DocumentArray has .embeddings, you can visualize the embeddings interactively using plot_embeddings().

import numpy as np
from docarray import DocumentArray

docs = DocumentArray.empty(1000)
docs.embeddings = np.random.random([len(docs), 256])


For image DocumentArray, you can do one step more to attach the image sprite on to the visualization points.