image_id stringlengths 6 6 | obj1_name stringclasses 3
values | obj2_name stringclasses 3
values | true_caption stringclasses 336
values | false_caption stringclasses 336
values | attributes sequencelengths 2 2 | image_path stringlengths 21 21 | id int64 0 16.9k |
|---|---|---|---|---|---|---|---|
000000 | cylinder | sphere | red cylinder and yellow sphere | yellow cylinder and red sphere | [
"red",
"yellow"
] | CLEVR_mini_000000.png | 0 |
000000 | sphere | cylinder | yellow sphere and gray cylinder | gray sphere and yellow cylinder | [
"yellow",
"gray"
] | CLEVR_mini_000000.png | 1 |
000000 | sphere | cylinder | yellow sphere and cyan cylinder | cyan sphere and yellow cylinder | [
"yellow",
"cyan"
] | CLEVR_mini_000000.png | 2 |
000000 | sphere | cylinder | yellow sphere and purple cylinder | purple sphere and yellow cylinder | [
"yellow",
"purple"
] | CLEVR_mini_000000.png | 3 |
000000 | sphere | cylinder | yellow sphere and green cylinder | green sphere and yellow cylinder | [
"yellow",
"green"
] | CLEVR_mini_000000.png | 4 |
000001 | sphere | cube | yellow sphere and green cube | green sphere and yellow cube | [
"yellow",
"green"
] | CLEVR_mini_000001.png | 5 |
000001 | sphere | cylinder | yellow sphere and green cylinder | green sphere and yellow cylinder | [
"yellow",
"green"
] | CLEVR_mini_000001.png | 6 |
000001 | sphere | cube | yellow sphere and purple cube | purple sphere and yellow cube | [
"yellow",
"purple"
] | CLEVR_mini_000001.png | 7 |
000001 | sphere | cube | blue sphere and green cube | green sphere and blue cube | [
"blue",
"green"
] | CLEVR_mini_000001.png | 8 |
000001 | sphere | cylinder | blue sphere and green cylinder | green sphere and blue cylinder | [
"blue",
"green"
] | CLEVR_mini_000001.png | 9 |
000002 | cube | sphere | cyan cube and purple sphere | purple cube and cyan sphere | [
"cyan",
"purple"
] | CLEVR_mini_000002.png | 10 |
000002 | cube | cylinder | cyan cube and red cylinder | red cube and cyan cylinder | [
"cyan",
"red"
] | CLEVR_mini_000002.png | 11 |
000002 | cube | cylinder | cyan cube and gray cylinder | gray cube and cyan cylinder | [
"cyan",
"gray"
] | CLEVR_mini_000002.png | 12 |
000002 | cube | cylinder | cyan cube and blue cylinder | blue cube and cyan cylinder | [
"cyan",
"blue"
] | CLEVR_mini_000002.png | 13 |
000002 | cube | sphere | green cube and purple sphere | purple cube and green sphere | [
"green",
"purple"
] | CLEVR_mini_000002.png | 14 |
000003 | cube | sphere | green cube and purple sphere | purple cube and green sphere | [
"green",
"purple"
] | CLEVR_mini_000003.png | 15 |
000003 | cube | cylinder | green cube and yellow cylinder | yellow cube and green cylinder | [
"green",
"yellow"
] | CLEVR_mini_000003.png | 16 |
000003 | cube | sphere | green cube and cyan sphere | cyan cube and green sphere | [
"green",
"cyan"
] | CLEVR_mini_000003.png | 17 |
000003 | cube | sphere | blue cube and purple sphere | purple cube and blue sphere | [
"blue",
"purple"
] | CLEVR_mini_000003.png | 18 |
000003 | cube | cylinder | blue cube and yellow cylinder | yellow cube and blue cylinder | [
"blue",
"yellow"
] | CLEVR_mini_000003.png | 19 |
000004 | sphere | cylinder | green sphere and cyan cylinder | cyan sphere and green cylinder | [
"green",
"cyan"
] | CLEVR_mini_000004.png | 20 |
000004 | sphere | cylinder | green sphere and yellow cylinder | yellow sphere and green cylinder | [
"green",
"yellow"
] | CLEVR_mini_000004.png | 21 |
000004 | sphere | cylinder | cyan sphere and yellow cylinder | yellow sphere and cyan cylinder | [
"cyan",
"yellow"
] | CLEVR_mini_000004.png | 22 |
000005 | cube | cylinder | gray cube and red cylinder | red cube and gray cylinder | [
"gray",
"red"
] | CLEVR_mini_000005.png | 23 |
000005 | cube | cylinder | gray cube and brown cylinder | brown cube and gray cylinder | [
"gray",
"brown"
] | CLEVR_mini_000005.png | 24 |
000005 | cube | cylinder | gray cube and blue cylinder | blue cube and gray cylinder | [
"gray",
"blue"
] | CLEVR_mini_000005.png | 25 |
000006 | cube | sphere | green cube and brown sphere | brown cube and green sphere | [
"green",
"brown"
] | CLEVR_mini_000006.png | 26 |
000006 | cube | cylinder | green cube and gray cylinder | gray cube and green cylinder | [
"green",
"gray"
] | CLEVR_mini_000006.png | 27 |
000006 | cube | sphere | green cube and blue sphere | blue cube and green sphere | [
"green",
"blue"
] | CLEVR_mini_000006.png | 28 |
000006 | cube | cylinder | green cube and blue cylinder | blue cube and green cylinder | [
"green",
"blue"
] | CLEVR_mini_000006.png | 29 |
000006 | cube | sphere | green cube and cyan sphere | cyan cube and green sphere | [
"green",
"cyan"
] | CLEVR_mini_000006.png | 30 |
000007 | sphere | cylinder | green sphere and red cylinder | red sphere and green cylinder | [
"green",
"red"
] | CLEVR_mini_000007.png | 31 |
000007 | sphere | cylinder | green sphere and yellow cylinder | yellow sphere and green cylinder | [
"green",
"yellow"
] | CLEVR_mini_000007.png | 32 |
000007 | sphere | cylinder | green sphere and gray cylinder | gray sphere and green cylinder | [
"green",
"gray"
] | CLEVR_mini_000007.png | 33 |
000007 | sphere | cube | green sphere and gray cube | gray sphere and green cube | [
"green",
"gray"
] | CLEVR_mini_000007.png | 34 |
000007 | sphere | cylinder | green sphere and brown cylinder | brown sphere and green cylinder | [
"green",
"brown"
] | CLEVR_mini_000007.png | 35 |
000008 | cube | cylinder | blue cube and yellow cylinder | yellow cube and blue cylinder | [
"blue",
"yellow"
] | CLEVR_mini_000008.png | 36 |
000008 | cube | cylinder | blue cube and red cylinder | red cube and blue cylinder | [
"blue",
"red"
] | CLEVR_mini_000008.png | 37 |
000008 | cube | cylinder | blue cube and brown cylinder | brown cube and blue cylinder | [
"blue",
"brown"
] | CLEVR_mini_000008.png | 38 |
000008 | cube | cylinder | blue cube and purple cylinder | purple cube and blue cylinder | [
"blue",
"purple"
] | CLEVR_mini_000008.png | 39 |
000008 | cube | sphere | blue cube and red sphere | red cube and blue sphere | [
"blue",
"red"
] | CLEVR_mini_000008.png | 40 |
000009 | sphere | cube | purple sphere and red cube | red sphere and purple cube | [
"purple",
"red"
] | CLEVR_mini_000009.png | 41 |
000009 | sphere | cube | purple sphere and cyan cube | cyan sphere and purple cube | [
"purple",
"cyan"
] | CLEVR_mini_000009.png | 42 |
000009 | sphere | cube | brown sphere and red cube | red sphere and brown cube | [
"brown",
"red"
] | CLEVR_mini_000009.png | 43 |
000009 | sphere | cube | brown sphere and cyan cube | cyan sphere and brown cube | [
"brown",
"cyan"
] | CLEVR_mini_000009.png | 44 |
000009 | sphere | cube | brown sphere and purple cube | purple sphere and brown cube | [
"brown",
"purple"
] | CLEVR_mini_000009.png | 45 |
000010 | sphere | cylinder | cyan sphere and green cylinder | green sphere and cyan cylinder | [
"cyan",
"green"
] | CLEVR_mini_000010.png | 46 |
000010 | sphere | cylinder | cyan sphere and blue cylinder | blue sphere and cyan cylinder | [
"cyan",
"blue"
] | CLEVR_mini_000010.png | 47 |
000010 | sphere | cube | cyan sphere and yellow cube | yellow sphere and cyan cube | [
"cyan",
"yellow"
] | CLEVR_mini_000010.png | 48 |
000010 | sphere | cylinder | cyan sphere and yellow cylinder | yellow sphere and cyan cylinder | [
"cyan",
"yellow"
] | CLEVR_mini_000010.png | 49 |
000010 | cylinder | sphere | green cylinder and yellow sphere | yellow cylinder and green sphere | [
"green",
"yellow"
] | CLEVR_mini_000010.png | 50 |
000012 | cylinder | cube | yellow cylinder and purple cube | purple cylinder and yellow cube | [
"yellow",
"purple"
] | CLEVR_mini_000012.png | 51 |
000012 | cylinder | sphere | yellow cylinder and purple sphere | purple cylinder and yellow sphere | [
"yellow",
"purple"
] | CLEVR_mini_000012.png | 52 |
000012 | cylinder | sphere | yellow cylinder and red sphere | red cylinder and yellow sphere | [
"yellow",
"red"
] | CLEVR_mini_000012.png | 53 |
000012 | cylinder | sphere | yellow cylinder and cyan sphere | cyan cylinder and yellow sphere | [
"yellow",
"cyan"
] | CLEVR_mini_000012.png | 54 |
000012 | cylinder | cube | red cylinder and purple cube | purple cylinder and red cube | [
"red",
"purple"
] | CLEVR_mini_000012.png | 55 |
000013 | cylinder | cube | gray cylinder and blue cube | blue cylinder and gray cube | [
"gray",
"blue"
] | CLEVR_mini_000013.png | 56 |
000013 | cylinder | sphere | gray cylinder and blue sphere | blue cylinder and gray sphere | [
"gray",
"blue"
] | CLEVR_mini_000013.png | 57 |
000013 | cylinder | sphere | gray cylinder and brown sphere | brown cylinder and gray sphere | [
"gray",
"brown"
] | CLEVR_mini_000013.png | 58 |
000013 | cylinder | sphere | gray cylinder and purple sphere | purple cylinder and gray sphere | [
"gray",
"purple"
] | CLEVR_mini_000013.png | 59 |
000013 | cylinder | cube | gray cylinder and cyan cube | cyan cylinder and gray cube | [
"gray",
"cyan"
] | CLEVR_mini_000013.png | 60 |
000014 | sphere | cylinder | blue sphere and red cylinder | red sphere and blue cylinder | [
"blue",
"red"
] | CLEVR_mini_000014.png | 61 |
000014 | sphere | cube | blue sphere and gray cube | gray sphere and blue cube | [
"blue",
"gray"
] | CLEVR_mini_000014.png | 62 |
000014 | sphere | cylinder | blue sphere and purple cylinder | purple sphere and blue cylinder | [
"blue",
"purple"
] | CLEVR_mini_000014.png | 63 |
000014 | sphere | cube | blue sphere and yellow cube | yellow sphere and blue cube | [
"blue",
"yellow"
] | CLEVR_mini_000014.png | 64 |
000014 | cylinder | sphere | red cylinder and purple sphere | purple cylinder and red sphere | [
"red",
"purple"
] | CLEVR_mini_000014.png | 65 |
000015 | cylinder | cube | gray cylinder and yellow cube | yellow cylinder and gray cube | [
"gray",
"yellow"
] | CLEVR_mini_000015.png | 66 |
000015 | cylinder | cube | gray cylinder and green cube | green cylinder and gray cube | [
"gray",
"green"
] | CLEVR_mini_000015.png | 67 |
000015 | cylinder | cube | green cylinder and yellow cube | yellow cylinder and green cube | [
"green",
"yellow"
] | CLEVR_mini_000015.png | 68 |
000015 | cylinder | sphere | green cylinder and gray sphere | gray cylinder and green sphere | [
"green",
"gray"
] | CLEVR_mini_000015.png | 69 |
000015 | cube | cylinder | yellow cube and blue cylinder | blue cube and yellow cylinder | [
"yellow",
"blue"
] | CLEVR_mini_000015.png | 70 |
000016 | cube | sphere | brown cube and cyan sphere | cyan cube and brown sphere | [
"brown",
"cyan"
] | CLEVR_mini_000016.png | 71 |
000016 | cube | cylinder | brown cube and gray cylinder | gray cube and brown cylinder | [
"brown",
"gray"
] | CLEVR_mini_000016.png | 72 |
000016 | cube | sphere | brown cube and red sphere | red cube and brown sphere | [
"brown",
"red"
] | CLEVR_mini_000016.png | 73 |
000016 | sphere | cylinder | cyan sphere and gray cylinder | gray sphere and cyan cylinder | [
"cyan",
"gray"
] | CLEVR_mini_000016.png | 74 |
000016 | sphere | cylinder | brown sphere and gray cylinder | gray sphere and brown cylinder | [
"brown",
"gray"
] | CLEVR_mini_000016.png | 75 |
000017 | cylinder | sphere | red cylinder and purple sphere | purple cylinder and red sphere | [
"red",
"purple"
] | CLEVR_mini_000017.png | 76 |
000017 | sphere | cylinder | purple sphere and green cylinder | green sphere and purple cylinder | [
"purple",
"green"
] | CLEVR_mini_000017.png | 77 |
000018 | sphere | cube | blue sphere and yellow cube | yellow sphere and blue cube | [
"blue",
"yellow"
] | CLEVR_mini_000018.png | 78 |
000018 | cube | sphere | blue cube and red sphere | red cube and blue sphere | [
"blue",
"red"
] | CLEVR_mini_000018.png | 79 |
000018 | cylinder | sphere | blue cylinder and red sphere | red cylinder and blue sphere | [
"blue",
"red"
] | CLEVR_mini_000018.png | 80 |
000018 | cylinder | cube | blue cylinder and yellow cube | yellow cylinder and blue cube | [
"blue",
"yellow"
] | CLEVR_mini_000018.png | 81 |
000018 | sphere | cube | red sphere and yellow cube | yellow sphere and red cube | [
"red",
"yellow"
] | CLEVR_mini_000018.png | 82 |
000019 | cube | cylinder | yellow cube and red cylinder | red cube and yellow cylinder | [
"yellow",
"red"
] | CLEVR_mini_000019.png | 83 |
000019 | cube | sphere | yellow cube and brown sphere | brown cube and yellow sphere | [
"yellow",
"brown"
] | CLEVR_mini_000019.png | 84 |
000019 | cube | cylinder | yellow cube and purple cylinder | purple cube and yellow cylinder | [
"yellow",
"purple"
] | CLEVR_mini_000019.png | 85 |
000019 | cube | cylinder | yellow cube and green cylinder | green cube and yellow cylinder | [
"yellow",
"green"
] | CLEVR_mini_000019.png | 86 |
000019 | cylinder | sphere | red cylinder and brown sphere | brown cylinder and red sphere | [
"red",
"brown"
] | CLEVR_mini_000019.png | 87 |
000020 | cube | sphere | brown cube and gray sphere | gray cube and brown sphere | [
"brown",
"gray"
] | CLEVR_mini_000020.png | 88 |
000020 | cube | sphere | blue cube and gray sphere | gray cube and blue sphere | [
"blue",
"gray"
] | CLEVR_mini_000020.png | 89 |
000021 | sphere | cylinder | red sphere and purple cylinder | purple sphere and red cylinder | [
"red",
"purple"
] | CLEVR_mini_000021.png | 90 |
000021 | sphere | cube | red sphere and purple cube | purple sphere and red cube | [
"red",
"purple"
] | CLEVR_mini_000021.png | 91 |
000021 | sphere | cylinder | red sphere and green cylinder | green sphere and red cylinder | [
"red",
"green"
] | CLEVR_mini_000021.png | 92 |
000021 | cube | cylinder | purple cube and green cylinder | green cube and purple cylinder | [
"purple",
"green"
] | CLEVR_mini_000021.png | 93 |
000021 | cylinder | sphere | green cylinder and purple sphere | purple cylinder and green sphere | [
"green",
"purple"
] | CLEVR_mini_000021.png | 94 |
000022 | cube | sphere | green cube and brown sphere | brown cube and green sphere | [
"green",
"brown"
] | CLEVR_mini_000022.png | 95 |
000022 | cube | cylinder | green cube and blue cylinder | blue cube and green cylinder | [
"green",
"blue"
] | CLEVR_mini_000022.png | 96 |
000022 | cube | cylinder | green cube and yellow cylinder | yellow cube and green cylinder | [
"green",
"yellow"
] | CLEVR_mini_000022.png | 97 |
000022 | sphere | cylinder | brown sphere and blue cylinder | blue sphere and brown cylinder | [
"brown",
"blue"
] | CLEVR_mini_000022.png | 98 |
000022 | sphere | cylinder | brown sphere and yellow cylinder | yellow sphere and brown cylinder | [
"brown",
"yellow"
] | CLEVR_mini_000022.png | 99 |
CLEVR-Per Dataset README
Overview
CLEVR-Per is a cross-modal dataset integrating images, baseline (true) captions, and permuted (false) captions to facilitate research on "compositional understanding" tasks in vision-language models. The dataset is designed to explore VLMs' ability to understand semantic changes in vision and textual entities by swapping attributes vocabulary, creating different semantic expressions. CLEVR-Per contains three subsets: ColPer (color semantics permutation), CntPer (quantity semantics permutation), and MatPer (material semantics permutation), each focusing on specific types of semantic transformations.
Supported Tasks
CLEVR-Per is suitable for the following tasks:
- Compositional Understanding Evaluation: Assessing the model's ability to understand semantic changes. The model selects the most relevant description from baseline caption and permuted caption for a given image, testing its compositional understanding.
- Adversarial Sample Generation: Researchers can generate diverse adversarial samples using baseline and permuted caption for contrastive training, improving the model's ability to detect erroneous semantics.
Data Source and Statistics
The CLEVR-Per dataset is derived from CLEVR [1], with all baseline and permuted captions generated based on predefined rules and templates.
Dataset Statistics and Example
| Subset | Number of Images | Baseline Captions | Permuted Captions |
|---|---|---|---|
| ColPer | 4000 | 16905 | 16905 |
| CntPer | 4000 | 7292 | 7292 |
| MatPer | 4000 | 10589 | 10589 |
Data Structure
| Field Name | Data Type | Description |
|---|---|---|
| image_id | string | Identifier for the image sample |
| image_path | string | Path or URL of the image sample |
| obj1_name | string | Name of the first entity in caption |
| obj2_name | string | Name of the second entity in caption |
| true_caption | string | Baseline caption describing the image |
| false_caption | string | Caption formed by swapping attributes in the baseline caption |
| attributes | list | List of attributes related to both entities |
| id | int | Unique Identifier for the sample |
Example
| Field Name | Data Type | Description |
|---|---|---|
| image_id | string | 000001 |
| image_path | string | CLEVR_mini_000001.png |
| obj1_name | string | sphere |
| obj2_name | string | cube |
| true_caption | string | "yellow sphere and purple cube." |
| false_caption | string | "purple sphere and yellow cube." |
| attributes | list | ["yellow", "purple"] |
| id | int | 100 |
Build Your Dataset with Simple Code
Using simple code, you can build your richer and more diverse negative sample dataset obased on CLEVR-Per.
For example:
- "is This a test true caption"
- "caption This is a true test"
- "a test This is true caption"
import random
def generate_negative_samples(true_caption, num_samples=3):
"""
Efficiently generates negative samples by shuffling the word order of a given caption.
Args:
true_caption (str): The original caption.
num_samples (int): The number of negative samples to generate (default: 3).
Returns:
list: A list of generated negative samples.
"""
words = true_caption.split()
word_count = len(words)
# Limit the number of unique permutations to the factorial of word count if needed
max_unique_permutations = min(num_samples, len(set(random.sample(words, word_count)) for _ in range(num_samples)))
# Use a set to avoid duplicates
negative_samples = {
' '.join(random.sample(words, word_count))
for _ in range(max_unique_permutations * 10) # Extra sampling to reduce duplicates
}
# Convert to list and limit the final count
return list(negative_samples)[:num_samples]
# Example usage
true_caption = "This is a test true caption"
negative_samples = generate_negative_samples(true_caption)
print(negative_samples)
For example:
import random
from PIL import Image
import os
def generate_shuffled_images(image_path, grid_size=(4, 4), num_images=3, output_dir="shuffled_images"):
"""
Efficiently generates multiple images by shuffling blocks of the original image.
Args:
image_path (str): Path to the input image.
grid_size (tuple): Number of rows and columns to split the image (e.g., (4, 4)).
num_images (int): Number of shuffled images to generate.
output_dir (str): Directory to save the generated images.
Returns:
None
"""
# Load the image and determine dimensions
image = Image.open(image_path)
img_width, img_height = image.size
rows, cols = grid_size
block_width, block_height = img_width // cols, img_height // rows
# Ensure output directory exists
os.makedirs(output_dir, exist_ok=True)
# Pre-split the image into blocks (avoiding redundant operations)
blocks = [
image.crop((c * block_width, r * block_height, (c + 1) * block_width, (r + 1) * block_height))
for r in range(rows) for c in range(cols)
]
# Generate shuffled images
for i in range(num_images):
random.shuffle(blocks) # In-place shuffle for better efficiency
shuffled_image = Image.new('RGB', (img_width, img_height))
for idx, block in enumerate(blocks):
r, c = divmod(idx, cols)
shuffled_image.paste(block, (c * block_width, r * block_height))
# Save the shuffled image
output_path = os.path.join(output_dir, f"shuffled_image_{i + 1}.png")
shuffled_image.save(output_path)
print(f"Generated: {output_path}")
# Example usage
input_image_path = "/mnt/data/2276b7b0-17f8-458c-bbc0-24abf62ab34b.png"
generate_shuffled_images(image_path=input_image_path, grid_size=(4, 4), num_images=3)
References
[1]. CLEVR. CLEVR: A Diagnostic Dataset for Compositional Language and Elementary Visual Reasoning. Justin Johnson, 2017. https://cs.stanford.edu/people/jcjohns/clevr/.
If you use this dataset, please cite it as follows. My homepage https://tongli97.github.io/.
@misc{cleverper_dataset,
author = {Tong Li, Guodao Sun*, Xueqian Zheng, Qi Jiang, Wang Xia, Xu Tan, Haidong Gao, Jingwei Tang, Yunchao Wang, Haixia Wang, Ronghua Liang},
title = {CompoVis: Is Cross-modal Semantic Alignment of CLIP Optimal? A Visual Analysis Attempt},
year = {2026},
publisher = {IEEE Transactions on Multimedia},
DOI = {10.1109/TMM.2026.3660158}
howpublished = {\url{https://huggingface.co/datasets/guodaosun/CompoVIS}},
}
Contact Information
- Author: Tong Li (李童)
- Email: litong@zjut.edu.cn
- Project Page: https://tongli97.github.io/
- Downloads last month
- 57


