skills/cv/clip-aesthetic-scoring/SKILL.md
Scores image aesthetic quality by passing L2-normalized CLIP ViT-L/14 embeddings through a trained MLP regressor head.
npx skillsauth add wenmin-wu/ds-skills cv-clip-aesthetic-scoringInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
CLIP embeddings capture semantic content but don't directly measure visual quality. The LAION aesthetic predictor adds a small MLP (trained on the SAC+AVA aesthetic datasets) on top of CLIP ViT-L/14 embeddings to predict a 1-10 aesthetic score. This gives a differentiable, batch-friendly quality metric that correlates with human aesthetic judgments. Useful for filtering generated images, ranking candidates, or as a reward signal in RLHF pipelines for image generation.
import torch
import torch.nn as nn
import clip
class AestheticScorer:
def __init__(self, clip_model_name='ViT-L/14', mlp_path='aesthetic_mlp.pth'):
self.clip_model, self.preprocess = clip.load(clip_model_name, device='cuda')
self.mlp = nn.Sequential(
nn.Linear(768, 1024), nn.Dropout(0.2),
nn.Linear(1024, 128), nn.Dropout(0.2),
nn.Linear(128, 64), nn.Dropout(0.1),
nn.Linear(64, 16),
nn.Linear(16, 1)
).to('cuda')
self.mlp.load_state_dict(torch.load(mlp_path))
self.mlp.eval()
@torch.no_grad()
def score(self, image):
img_tensor = self.preprocess(image).unsqueeze(0).to('cuda')
features = self.clip_model.encode_image(img_tensor)
features /= features.norm(dim=-1, keepdim=True)
return self.mlp(features.float()).item() / 10.0
scorer = AestheticScorer()
quality = scorer.score(pil_image) # 0.0-1.0
sac+logos+ava1-l14-linearMSE.pth or fine-tune on your domaindata-ai
Scaled Pinball Loss (SPL) metric for evaluating quantile forecasts, normalized by mean absolute successive differences of training data
data-ai
Walk backward through a time series and multiplicatively rescale segments when jumps exceed a fraction of the running mean to correct data collection anomalies
testing
Transform forecasting target to next/current ratio minus one so that optimizing MAE or squared error implicitly minimizes SMAPE
tools
Convert point forecasts to prediction intervals by scaling with logit-transformed quantile ratios passed through a Normal CDF