Skip to content

classify-ad-assets

Use when classifying images for ad platform eligibility using a 3-stage pipeline — rule-based filtering, face detection, and Gemini Vision AI assessment. Produces quality scores and platform-specific eligibility for Meta, Pinterest, and Google ads.

ModelSource
sonnetpack: ad-assets
Full Reference

3-stage classification pipeline for ad asset eligibility. Stage 1 filters disqualified images instantly via rule-based checks with no AI cost. Stage 2 detects face presence via Gemini humanElement score or client-side face-api.js. Stage 3 sends qualifying assets through Gemini Vision for multi-criteria quality scoring, producing platform-specific eligibility flags for Meta, Pinterest, and Google.

FactValue
Gemini Vision modelgemini-2.5-flash
Cost per image~$0.0007–$0.001
Cost per 1,000 images~$0.70–$1.00
Required env varGEMINI_API_KEY
Stage 1 min dimensions600x314px
Stage 3 concurrency default5 parallel requests
Overall score threshold (strong)>= 0.70
Overall score threshold (marginal)>= 0.55
I want to…File
Set up env vars, Zod schemas, and the full config objectsetup.md
Filter images by dimensions, format, file size, and excluded folders (Stage 1)rule-filter.md
Detect faces with Gemini proxy, face-api.js, or TensorFlow.js fallback (Stage 2)face-detection.md
Score images with Gemini Vision — prompt, API call, retry logic, cost (Stage 3)gemini-vision.md
Compute weighted scores, platform thresholds, and eligibility flagsscoring-eligibility.md
Classify a single asset or run a concurrent batch with CLI and output shapesbatch-processing.md

Usage: Read the reference file matching your current task from the index above. Each file is self-contained with code examples and inline gotchas.


┏━ 🏷 classify-ad-assets ━━━━━━━━━━━━━━━━━━━━━━━━━┓ ┃ Score and flag ad images for Meta, Pinterest, and Google eligibility ┃ ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛