sdeval.corrupt.aicorrupt¶
- Overview:
AI image corrupt evaluation metrics.
get_ai_corrupted¶
-
sdeval.corrupt.aicorrupt.
get_ai_corrupted
(image: Union[str, os.PathLike, bytes, bytearray, BinaryIO, PIL.Image.Image], model_name: str = 'caformer_s36_v0_focal') → Mapping[str, float][source]¶ Get AI image corrupted detection scores for an image.
This function calculates AI image corrupted detection scores for a given image using the specified model.
- Parameters:
image (ImageTyping) – The input image.
model_name (str) – The name of the AI image corrupted detection model. Default is ‘caformer_s36_v0_focal’.
- Returns:
A dictionary containing the corrupted score.
- Return type:
Mapping[str, float]
AICorruptMetrics¶
-
class
sdeval.corrupt.aicorrupt.
AICorruptMetrics
(model_name: str = 'caformer_s36_v0_focal', silent: bool = False, tqdm_desc: str = None)[source]¶ Class for calculating an AI image corruptness score.
The AICorruptMetrics class allows you to calculate an AI image corruptness score using the AI image corrupted detection model.
- Parameters:
model_name (str) – The name of the AI image corrupted detection model. Default is ‘caformer_s36_v0_focal’.
silent (bool) – If True, suppresses progress bars and additional output during calculation.
tqdm_desc (str) – Description for the tqdm progress bar during calculation.
-
__init__
(model_name: str = 'caformer_s36_v0_focal', silent: bool = False, tqdm_desc: str = None)[source]¶ Initialize self. See help(type(self)) for accurate signature.
-
score
(images: Union[PIL.Image.Image, str, List[Union[PIL.Image.Image, str]]], silent: bool = None)[source]¶ Calculate the AI image corruptness score for a set of images.
This method calculates the AI image corruptness score for a set of input images using the AI image corrupted detection model.
- Parameters:
images (ImagesTyping) – The set of input images for calculating the AI image corruptness score.
silent (bool) – If True, suppresses progress bars and additional output during calculation.
- Returns:
The AI image corruptness score.
- Return type:
float