Skip to content

Evaluation, diagnostics, benchmarks, and additional tests · Evaluation, diagnostics, benchmarks, and additional hypothesis tests · EVA052 · Metric

CLIPScore for image–text alignment

Uses a fixed image–text encoder to evaluate caption or prompt-image compatibility.

Runs in CodeSplash (Experimental) Complete calculation CodeSplash's run and the reference's record

In CodeSplash

A CodeSplash method runs this entry in Python and R. Set it up from the method's page. The methods that run it are Experimental.

Do it in CodeSplash Run it on your own data. It's in the Experimental lane in the app.

Availability
Runs in CodeSplash (Experimental)
Code example
Complete calculation
Who ran it
CodeSplash's run and the reference's record
CodeSplash's run
The reference's example ran in Python and R here, and they agree.
The reference's record
Python: Ran in the reference's review. The report doesn't record which version of the code ran. R: Reviewed but not run: R wasn't available to the reference's authors.

Purpose

Uses a fixed image–text encoder to evaluate caption or prompt-image compatibility.

Question / hypotheses

Does the image share semantic content with the text under the chosen CLIP representation?

Architecture / computational structure

A fixed pretrained feature/evaluation model followed by the named aggregation rule. The feature extractor is part of the metric specification.

Assumptions

Use the same encoder, tokenizer, image transform, truncation policy, and score scaling. The original CLIPScore has particular scaling/clipping conventions.

Formula / computational definition

CLIPScore=cmax⁡(cos⁡(fI(I),fT(T)),0).CLIPScore=c\max(\cos(f_I(I),f_T(T)),0).

Parameters and notation

c is the declared scaling constant; encoder weights are fixed. The original recommended scaling is distinct from raw cosine similarity. Reference-augmented variants have additional definitions.

Fitting, fine-tuning, and adaptation

There is no model fine-tuning step for this evaluation procedure. Freeze the evaluated systems and evaluator before the final test. Select evaluation settings on development data; if a learned evaluator or calibration model is adapted, use separate fitting data, version it, and reassess its validity.

How to use and calibrate

Report the precise variant and complement it with object, relation, counting, and factual evaluations. Keep benchmark prompts unseen during evaluator adaptation.

Example application

Assess image captions that use valid wording absent from the references.

Interpretation / pitfalls

Watch out

High semantic similarity does not guarantee correct spatial relations, counts, or negations. Training and evaluating a generator with the same encoder can encourage metric-specific shortcuts.

Python and R code examples

Scope: Mathematical calculation on synthetic inputs; not a complete benchmark pipeline.

Validation: Python — Executed successfully on synthetic inputs. R — reviewed but not executed in this environment. Python dependencies are explicit imports; R uses base R unless a package/bridge is explicitly named.

Python and R

The reference's own programs, shown as written. A component demo shows one central piece of the method; it doesn't train a full model.

Python

Complete calculation — Mathematical calculation on synthetic inputs; not a complete benchmark pipeline. · needs numpy

import numpy as np
i=np.array([1.,.2]); t=np.array([.8,.6]); cosine=i@t/(np.linalg.norm(i)*np.linalg.norm(t))
print(2.5*max(float(cosine),0.))
R

Complete calculation — Mathematical calculation on synthetic inputs; not a complete benchmark pipeline.

i <- c(1,.2); t <- c(.8,.6); cosine <- sum(i*t)/sqrt(sum(i*i)*sum(t*t))
print(2.5*max(cosine,0))

Sources

From the CodeSplash reference, entry EVA052.