Skip to main content

Aesthetic predictor v2.5

Project description

Aesthetic Predictor V2.5

Aesthetic Predictor V2.5 is a SigLIP-based predictor that evaluates the aesthetics of an image on a scale from 1 to 10.

Compared to Aesthetic Predictor V2, it has been improved to evaluate a wider range of image domains such as illustrations.

Unlike V2, 5.5+ is considered to be a great aesthetic score.

You can try Aesthetic Predictor V2.5 at Hugging Face Spaces!

Hugging Face Spaces

Installation

pip install aesthetic-predictor-v2-5

Usage

This repository features an interface similar to Hugging Face Transformers, almost same as Simple Aesthetics Predictor, making it easy to use.

from pathlib import Path

import torch
from aesthetic_predictor_v2_5 import convert_v2_5_from_siglip
from PIL import Image

SAMPLE_IMAGE_PATH = Path("path/to/image")

# load model and preprocessor
model, preprocessor = convert_v2_5_from_siglip(
    low_cpu_mem_usage=True,
    trust_remote_code=True,
)
model = model.to(torch.bfloat16).cuda()

# load image to evaluate
image = Image.open(SAMPLE_IMAGE_PATH).convert("RGB")

# preprocess image
pixel_values = (
    preprocessor(images=image, return_tensors="pt")
    .pixel_values.to(torch.bfloat16)
    .cuda()
)

# predict aesthetic score
with torch.inference_mode():
    score = model(pixel_values).logits.squeeze().float().cpu().numpy()

# print result
print(f"Aesthetics score: {score:.2f}")

With ComfyUI, you can use this custom node.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aesthetic_predictor_v2_5-2024.10.22.1.tar.gz (5.6 MB view details)

Uploaded Source

Built Distribution

aesthetic_predictor_v2_5-2024.10.22.1-py2.py3-none-any.whl (28.1 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file aesthetic_predictor_v2_5-2024.10.22.1.tar.gz.

File metadata

File hashes

Hashes for aesthetic_predictor_v2_5-2024.10.22.1.tar.gz
Algorithm Hash digest
SHA256 3eef09865f3a530574d1466c58353637fea25cf1bee93fc1385429b5c86abdde
MD5 84ff385bc9976d321f121a9d562b67b9
BLAKE2b-256 134d14c164c2a3c949cc3fe4b382855f2ffb4a84527cd75ad45278644252ea36

See more details on using hashes here.

File details

Details for the file aesthetic_predictor_v2_5-2024.10.22.1-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for aesthetic_predictor_v2_5-2024.10.22.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 fa5c017742ec3b3a525c2702b118c321f2405ab7e9161a8b3ba56f333402388f
MD5 9896cd68496b850fd6f731d5b6b1b48d
BLAKE2b-256 a3badc95eb900571c1c86610ea58a0e86ffe1b3db4c27668665b61380f6bcdac

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page