relaion2b-natural / README.md
andropar's picture
Upload README.md with huggingface_hub
a378c89 verified
|
Raw
History Blame Contribute Delete
10.8 kB
metadata
license: cc-by-4.0
pretty_name: LAION-Natural
task_categories:
  - image-classification
language:
  - en
tags:
  - laion
  - laion-natural
  - laion-2b
  - relaion
  - relaion2b
  - laion2b-en
  - natural-images
  - natural-scores
  - image-quality
  - image-filtering
  - photograph-detection
  - ccn2025
  - visual-neuroscience
  - clip
size_categories:
  - 1B<n<10B

LAION-Natural

LAION-Natural: Naturalness Scores for ReLAION-2B (CCN 2025, Roth & Hebart)

LAION-Natural is a large-scale naturalness scoring dataset covering 2.1 billion images from ReLAION-2B-en-research-safe. Each image receives a score predicting how "natural" or "photographic" it looks versus artificial/rendered content. At the recommended threshold of 0.7, the dataset identifies ~500 million natural photographs suitable for vision research, cognitive science, and model training.

Also known as: LAION-Natural · LAION natural · ReLAION-Natural · ReLAION-2B-Natural · LAION-2B-Natural

Introduced in: How to sample the world for understanding the visual system (Roth & Hebart, CCN 2025)

Looking for embeddings? Pre-computed CLIP ViT-H/14 embeddings for the ~500M natural photographs are available at LAION-Natural Embeddings.

Quick Start

from datasets import load_dataset

# Load the dataset (streaming recommended due to size)
ds = load_dataset("andropar/relaion2b-natural", streaming=True)

# Filter to natural images only
for row in ds['train']:
    if row['natural_score'] and row['natural_score'] > 0.7:
        print(row['url'])  # Natural photograph URL

Overview

Total rows ~2.1 billion
Score range 0.0 (artificial) to 1.0 (natural)
Recommended threshold > 0.7 for natural photographs
Format Parquet (Snappy compressed)
Source ReLAION-2B-en-research-safe

Example Images

Examples of images at different natural score ranges:

Non-natural (score < 0.3): Graphics, logos, text overlays, screenshots Non-natural examples

Low (score 0.3 - 0.5): Mixed content, product images, some editing Low score examples

Medium (score 0.5 - 0.7): Mostly natural with some artifacts Medium score examples

High (score 0.7 - 0.85): Natural photographs High score examples

Very high (score 0.85 - 1.0): Clean natural photographs Very high score examples

Thumbnails shown solely to illustrate dataset characteristics. Source: ReLAION-2B-en-research-safe (Apache 2.0). Underlying images remain under the copyright of their original creators.

Dataset Structure

Column Type Description
url string Image URL from ReLAION-2B
natural_score float32 Naturalness prediction (0-1), null if no match found in original LAION-2B-en

Files are named relaion2b_natural_part-*.snappy.parquet.

How the Scores Were Created

  1. Manual labeling: About 26k images were labeled via active learning over a pool of roughly 200k candidates from LAION-2B-en (21k usable after filtering broken URLs). Selection criteria for "natural" images:

    • No watermarks, logos, or banners
    • No heavy editing (B&W filters, high saturation, photoshopping)
    • Must be a real-world scene or object
  2. Classifier training: A logistic regression classifier was trained on CLIP ViT-L/14 image embeddings (768-dim). This simple linear model was chosen deliberately - we verified that nonlinear models (MLPs) do not improve over logistic regression on these features, indicating that the linear classifier efficiently captures the available signal.

  3. Scoring: The classifier was applied to pre-computed CLIP ViT-L/14 embeddings for all of LAION-2B-en (~2.1B images).

  4. Matching: Predicted scores were matched to ReLAION-2B-en-research-safe by URL. Some URLs have null scores where no match was found in the original dataset.

Classifier

The trained classifier is included in the classifier/ directory and can be used to score new images. Since it operates on standard CLIP ViT-L/14 features, it can be applied to any image that can be embedded with CLIP.

Performance

Metric Value
ROC AUC 0.89
Average Precision 0.89
Precision @ threshold 0.7 0.89
Recall @ threshold 0.7 0.59
Accuracy @ threshold 0.5 0.80

The classifier was evaluated on a held-out test set of 4,200 labeled images. At the recommended threshold of 0.7, precision is high (89%). The tradeoff is lower recall (59%), meaning some natural images will be missed, but we decided that this trade-off was acceptable for our use case.

Detailed diagnostics (click to expand)

ROC and Precision-Recall curves:

ROC curve PR curve

Score distributions by true label:

Score distributions

Confusion matrices:

Threshold = 0.5 Threshold = 0.7
CM 0.5 CM 0.7

Typical errors - most misclassifications occur on genuinely ambiguous images:

False positives (predicted natural, actually non-natural) False negatives (predicted non-natural, actually natural)
FP FN

False positives tend to be product or studio photography with subtle watermarks/overlays. False negatives tend to be natural scenes with text, heavy cropping, or unusual framing.

Files

File Description
classifier/classifier_weights.json Portable weights (JSON) - use this for framework-agnostic inference
classifier/classifier_weights.npz Weights as numpy arrays (coef + intercept)
classifier/laion_natural_img_clf_vitl14.pkl Original scikit-learn pickle
classifier/diagnostics.json Full evaluation metrics

Usage

Option 1: Framework-agnostic (recommended)

import json
import numpy as np

# Load weights
with open("classifier/classifier_weights.json") as f:
    weights = json.load(f)

coef = np.array(weights["coef"], dtype=np.float32)
intercept = weights["intercept"]

def predict_natural_score(clip_embedding):
    """Score a CLIP ViT-L/14 embedding (768-dim, L2-normalized)."""
    logit = np.dot(clip_embedding, coef) + intercept
    return 1.0 / (1.0 + np.exp(-logit))

# Example: extract features with CLIP and score
import clip, torch
from PIL import Image

model, preprocess = clip.load("ViT-L/14")
image = preprocess(Image.open("photo.jpg")).unsqueeze(0)
with torch.no_grad():
    embedding = model.encode_image(image)
    embedding /= embedding.norm(dim=-1, keepdim=True)
    embedding = embedding.cpu().numpy().squeeze()

score = predict_natural_score(embedding)
print(f"Natural score: {score:.3f}")  # > 0.7 = likely a natural photograph

Option 2: scikit-learn

import pickle

with open("classifier/laion_natural_img_clf_vitl14.pkl", "rb") as f:
    clf = pickle.load(f)

# clf.predict_proba(embeddings)[:, 1] gives natural scores

Usage Examples

Filter a subset with pandas:

import pandas as pd

df = pd.read_parquet("relaion2b_natural_part-000.snappy.parquet")

# High-quality natural images
natural = df[df['natural_score'] > 0.7]
print(f"Found {len(natural):,} natural images")

# Very high confidence
very_natural = df[df['natural_score'] > 0.9]

Load all files:

from datasets import load_dataset

# Full dataset (streaming)
ds = load_dataset("andropar/relaion2b-natural", streaming=True)

# Or load specific files
import glob
files = glob.glob("relaion2b_natural_part-*.snappy.parquet")
df_all = pd.concat([pd.read_parquet(f) for f in files])

Combine with image downloading:

import requests
from PIL import Image
from io import BytesIO

def download_image(url):
    resp = requests.get(url, timeout=10)
    return Image.open(BytesIO(resp.content))

# Get natural image URLs and download
natural_urls = df[df['natural_score'] > 0.8]['url'].tolist()
images = [download_image(url) for url in natural_urls[:100]]

Use Cases

  • Dataset filtering: Remove non-photographic content from web-scraped image datasets
  • Quality assessment: Score images for naturalness before model training
  • Research: Study distribution of natural vs. artificial images on the web
  • Preprocessing: Filter training data for vision models that need natural photographs

Related Datasets

Licensing / Content

This repository contains only metadata (URLs and natural scores). No images are distributed.

  • The underlying images are hosted by third-party websites and remain under their original copyrights and terms of use.
  • Our additions (naturalness scores, classifier, documentation) are released under CC-BY 4.0.
  • This dataset is based on ReLAION-2B-en-research-safe, which is licensed under Apache 2.0.
  • Please check license compatibility for any commercial usage.

Limitations

  • "Naturalness" reflects our specific labeling criteria - may not match your definition
  • These are ML predictions, not ground truth labels
  • The classifier was trained on CLIP ViT-L/14 features; performance may differ with other embedding models
  • Some URLs may be broken or point to different/removed images
  • Null scores indicate URLs not found in original LAION-2B-en dataset

Citation

@inproceedings{
  roth2025how,
  title={How to sample the world for understanding the visual system},
  author={Johannes Roth and Martin N Hebart},
  booktitle={8th Annual Conference on Cognitive Computational Neuroscience},
  year={2025},
  url={https://openreview.net/forum?id=T9k6KkZoca}
}

Questions or issues? Open a discussion!

This dataset is intended for research purposes. Verify license compatibility before commercial use.