Skip to content

Commit 50ee360

Browse files
committed
feat(Admin > Walk): Display aesthetic score per thumb
1 parent bacfa27 commit 50ee360

File tree

7 files changed

+573
-511
lines changed

7 files changed

+573
-511
lines changed

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ build-ai-api:
3131
docker build -f apps/api/Dockerfile -t ai-api .
3232

3333
ai-api:
34-
docker run --name ai-api-run -p 8080:8080 ai-api > api.log 2>&1 || true
35-
cat api.log
36-
docker rm ai-api-run || true
34+
# OpenAI model stores in ~/.cache/clip
35+
docker run --rm --name ai-api -p 8080:8080 \
36+
-v $(HOME)/.cache/clip:/root/.cache/clip
3737

3838
build-test:
3939
docker build -f apps/api/Dockerfile --build-arg INSTALL_TEST=true -t ai-api-test .

apps/api/README.md

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,21 @@ This project serves a high-accuracy image classification API using a **Vision Tr
2929

3030
# Aesthetic Scoring
3131

32-
## Model details
33-
34-
- **[OpenCLIP](https://github.com/mlfoundations/open_clip) ViT-L/14** model (CLIP architecture)
35-
- **Checkpoint** laion2B-s32B-b82K
36-
- **Aesthetic scoring** using a trained multilayer perceptron (MLP)
37-
- Deterministic evaluation
38-
- A custom regression MLP head trained on:
39-
- [AVA dataset (aesthetics annotated)](https://github.com/microsoft/LMOps/blob/main/promptist/aesthetic/ava%2Blogos-l14-linearMSE.pth)
40-
- Logos subset (for composition)
41-
- [Code sample](https://github.com/christophschuhmann/improved-aesthetic-predictor/tree/main)
32+
This project provides an API for **aesthetic scoring** of images using a regression head trained on top of OpenAI's CLIP ViT-B/16 backbone.
33+
34+
---
35+
36+
## 🧠 Model Details
37+
38+
- **Backbone:** OpenAI CLIP ViT-B/16
39+
- **Regression Head:** Multilayer Perceptron (MLP) trained for aesthetic prediction
40+
- **Head Weights:** `models/aesthetic/sa_0_4_vit_b_16_linear.pth`
41+
- **Feature Dimension:** 512
42+
43+
44+
## Local setup
45+
46+
1. Download the regression head:
47+
[sa_0_4_vit_b_16_linear.pth](https://github.com/LAION-AI/aesthetic-predictor/blob/main/sa_0_4_vit_b_16_linear.pth)
48+
1. Place it in `models/aesthetic/sa_0_4_vit_b_16_linear.pth`
49+
1. The OpenAI CLIP backbone weights for ViT-B/16 will be downloaded automatically on first run `make ai-api`

apps/api/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
# Setup logging once
1010
logging.basicConfig(stream=sys.stdout, level=logging.DEBUG)
1111
logger = logging.getLogger("uvicorn")
12-
logger.setLevel(logging.ERROR)
12+
logger.setLevel(logging.DEBUG)
1313

1414
logger.debug("FastAPI is initializing...")
1515

apps/load-weights/README.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,4 @@ Hugging Face timm https://huggingface.co/timm/convnext_large_mlp.laion2b_ft_augr
1010

1111
## Aesthetic Scorer
1212

13-
`make load-weights MODEL_REPO=LAION/CLIP-based-Aesthetic-Predictor FILENAMES="ava+logos-l14-linearMSE.pth"`
14-
15-
https://github.com/LAION-AI/aesthetic-predictor/blob/main/sa_0_4_vit_b_16_linear.pth
13+
No longer uses weights loader

0 commit comments

Comments
 (0)