sdeval.controllability.bikini_plus

Overview:

Bikini plus score.

BikiniPlusMetrics

class sdeval.controllability.bikini_plus.BikiniPlusMetrics(tagger: Literal[deepdanbooru, mldanbooru, wd14_vit, wd14_convnext, wd14_convnextv2, wd14_swinv2, wd14_moat] = 'wd14_convnextv2', tagger_cfgs: Optional[dict] = None, base_num: float = 1.5, tag_blacklist: Optional[List[str]] = None, silent: bool = False)[source]

Class for evaluating the appropriateness of AI-generated images based on prompts and taggers.

The BikiniPlusMetrics class assesses the compatibility of AI-generated images with given prompts using taggers.

Parameters:
  • tagger (TaggingMethodTyping) – The tagging method to use. Default is ‘wd14_convnextv2’.

  • tagger_cfgs (Optional[dict]) – Optional configuration parameters for the chosen tagger. Default is None.

  • base_num (float) – Base number for weighting prompt tags. Default is 1.5.

  • tag_blacklist (Optional[List[str]]) – Optional list of tags to exclude from evaluation. Default is None.

  • silent (bool) – If True, suppresses progress bars and additional output during calculation. Default is False.

__init__(tagger: Literal[deepdanbooru, mldanbooru, wd14_vit, wd14_convnext, wd14_convnextv2, wd14_swinv2, wd14_moat] = 'wd14_convnextv2', tagger_cfgs: Optional[dict] = None, base_num: float = 1.5, tag_blacklist: Optional[List[str]] = None, silent: bool = False)[source]

Initialize self. See help(type(self)) for accurate signature.

score(images: Union[Tuple[PIL.Image.Image, str, str], Tuple[PIL.Image.Image, str], PIL.Image.Image, Tuple[str, str, str], Tuple[str, str], str, List[Union[Tuple[PIL.Image.Image, str, str], Tuple[PIL.Image.Image, str], PIL.Image.Image, Tuple[str, str, str], Tuple[str, str], str]]], silent: bool = False, mode: Literal[mean, seq] = 'mean') → Union[float, numpy.ndarray][source]

Calculate the average bikini plus score for a set of images.

This method computes the average bikini plus score for a set of images based on the provided prompts.

Parameters:
  • images (PromptedImagesTyping) – The set of images with associated positive and negative prompts.

  • silent (bool) – If True, suppresses progress bars and additional output during calculation. Default is False.

  • mode (Literal['mean', 'seq']) – Mode of the return value. Return a float value when mean is assigned, return a numpy array when seq is assigned. Default is mean.

Returns:

The average bikini plus score for the set of images.

Return type:

Union[float, np.ndarray]