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.
This repository features an interface similar to Hugging Face Transformers, inspired by Simple Aesthetics Predictor, making it easy to use.
Installation
pip install aesthetic-predictor-v2-5
Usage
from pathlib import Path
import torch
from aesthetic_predictor_v2_5 import convert_v2_5_from_siglip
SAMPLE_IMAGE_PATH = (
Path(__file__).resolve().parent
/ "assets"
/ "samples"
/ "sample1.jpg"
)
# 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}")
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
Close
Hashes for aesthetic_predictor_v2_5-2024.5.28.1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 79c3928d45431c535204a8ddc6a568c9977e1d3f0b2cad868af30df4a30965bf |
|
MD5 | 3d80457a2d6804c6d45e4177280b9940 |
|
BLAKE2b-256 | 8f4f99e305e829f242985e2f283fc6c4dcfd8666545cd3150c2076880d150e62 |