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.12.18.1.tar.gz (5.6 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

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

Uploaded Python 2Python 3

File details

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

File metadata

File hashes

Hashes for aesthetic_predictor_v2_5-2024.12.18.1.tar.gz
Algorithm Hash digest
SHA256 3e9ce37aa38061c633fd024a94ce3ee393562b5f328b8d6daa3c8623331956c8
MD5 5c73b76cf80df15d3714a7ae1cc56ed4
BLAKE2b-256 ae21cff7a0cae389a4e6ab1167ad4c3df317963034e31bc4ad958f1bfc8226dc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for aesthetic_predictor_v2_5-2024.12.18.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 7b99b52ed896e46f0edbbac6d01ec32695f6f9919fcde853cfb0936656782638
MD5 addcbe0bfa7531e83a7a09d73d4ca1e8
BLAKE2b-256 1d003a7d1a4fa9edca866b52805369bdbb2a4c71cf90cd56792c6921054ebc4f

See more details on using hashes here.

Supported by

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