Downloads · 30 days
0
npnkhoi/meme-template-recovery-clip
meme-template-recovery-clip is a machine learning model from npnkhoi. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as mit.
This model projects meme images into a $256$-dimensional metric embedding space where images originating from the same base meme template cluster closely together, and images from different templates are pushed far ap…
Downloads · 30 days
0
Access
Public
Updated Jun 19, 2026
Repo size
352 MB
Likes
0
Public
Click a slice to open those files.
.pt352 MB · 100%
From the Hugging Face model README
This model projects meme images into a $256$-dimensional metric embedding space where images originating from the same base meme template cluster closely together, and images from different templates are pushed far apart.
It is designed for matching macro meme instances back to their original blank meme backgrounds.
openai/clip-vit-base-patch32).Evaluated on the held-out open-set test split of unseen Know Your Meme Knowledge Base (KYMKB) templates:
| Metric | Accuracy | Description |
|---|---|---|
| Rank-1 | 29.71% | Correct base template returned as the #1 match |
| Rank-5 | 39.55% | Correct base template within top-5 matches |
| Rank-10 | 43.34% | Correct base template within top-10 matches |
| MRR | 0.3450 | Mean Reciprocal Rank |
Ensure you have the required dependencies installed:
pip install torch torchvision transformers huggingface_hub pillow
Download model.py and infer.py from this repository, and execute inference:
from infer import load_meme_model, get_image_embedding
# Load model and device
model, device = load_meme_model(repo_id="npnkhoi/meme-template-recovery-clip")
# Extract embedding for an image
embedding = get_image_embedding(model, "path/to/your/query_meme.jpg", device)
print("Successfully extracted L2-normalized 256-D embedding:", embedding.shape)