pyiqa.archs.laion_aes_arch

LAION-Aesthetics Predictor

Introduced by: https://github.com/christophschuhmann/improved-aesthetic-predictor

Module Contents

pyiqa.archs.laion_aes_arch.default_model_urls[source]
class pyiqa.archs.laion_aes_arch.MLP(input_size, xcol='emb', ycol='avg_rating')[source]

Bases: torch.nn.Module

Regression head used by LAION-Aesthetics predictor.

forward(x)[source]

Predict scalar aesthetics score from normalized image embeddings.

class pyiqa.archs.laion_aes_arch.LAIONAes(pretrained=True, pretrained_model_path=None)[source]

Bases: torch.nn.Module

LAION-Aesthetics predictor based on CLIP ViT-L/14 embeddings.

Parameters:
  • pretrained (bool) – Whether to load pretrained MLP weights.

  • pretrained_model_path (str | None) – Optional local checkpoint path.

forward(x)[source]

Predict aesthetics score.

Parameters:

x (torch.Tensor) – Input tensor with shape (N, 3, H, W).

Returns:

Predicted score tensor with shape (N, 1).

Return type:

torch.Tensor