xpark.dataset.ImageAestheticScore#
- class xpark.dataset.ImageAestheticScore(_local_model: str = 'shunk031/aesthetics-predictor-v2-sac-logos-ava1-l14-linearMSE', normalized: bool = False)[source]#
Image aesthetic score calculation processor for CPU, GPU. Image aesthetic score is a value between 0 and 10, with higher scores indicating better image quality.
- Parameters:
_local_model – The CLIP base aesthetic model name for CPU or GPU. default model is “shunk031/aesthetics-predictor-v2-sac-logos-ava1-l14-linearMSE” available models: [‘shunk031/aesthetics-predictor-v2-sac-logos-ava1-l14-linearMSE’, ‘shunk031/aesthetics-predictor-v1-vit-large-patch14’]
normalized – Whether to normalize the score to [0, 1], default is False
Examples
from xpark.dataset.expressions import col from xpark.dataset import ImageAestheticScore, from_items import numpy as np ds = from_items([ {"image": np.random.randint(0, 255, (256, 256, 3)).astype(np.uint8), "path": "test.jpg"} ]) ds = ds.with_column( "image_score", ImageAestheticScore() .options(num_workers={"CPU": 4}, batch_size=1) .with_column(col("image")), ) print(ds.take(1))
Methods
__call__(images)Call self as a function.
options(**kwargs)with_column(images)- __call__(images: pa.ChunkedArray) pa.Array#
Call self as a function.
- options(**kwargs: Unpack[ExprUDFOptions]) Self#
- with_column(images: pa.ChunkedArray) pa.Array#