towhee.models.visualization.clip_visualization.get_clip_relevance

towhee.models.visualization.clip_visualization.get_clip_relevance(model: ~torch.nn.modules.module.Module, pil_img: <module 'PIL.Image' from '/home/docs/checkouts/readthedocs.org/user_builds/towhee/envs/branch0.9.0/lib/python3.9/site-packages/PIL/Image.py'>, text_list: ~typing.List[str], device: str, vis_start_layer: int = 11, text_start_layer: int = 11, transform: ~typing.Optional[~typing.Callable] = None, tokenize: ~typing.Optional[~typing.Callable] = None) Tuple[source]

Get text relevance and image relevance from CLIP model. :param model: CLIP model to visualize. :type model: nn.Module :param pil_img: Input image. :type pil_img: Image :param text_list: List of text str. :type text_list: List[str] :param device: Device to use. :type device: str :param vis_start_layer: Start layer for visualization. :type vis_start_layer: int :param text_start_layer: Start layer for text. :type text_start_layer: int :param transform: Transform function for image. :type transform: Callable :param tokenize: Tokenize function for text. :type tokenize: Callable

Returns:

text_relevance, image_relevance, text_tokens, img_tensor

Return type:

(Tuple)