Dataset Viewer
Auto-converted to Parquet Duplicate
Search is not available for this dataset
The dataset viewer is not available for this split.
Server error while post-processing the rows. This occured on row 1. Please report the issue.
Error code:   RowsPostProcessingError

Need help to make the dataset viewer work? Make sure to review how to configure the dataset viewer, and open a discussion for direct support.

MNIST-VQA Dataset

Dataset Summary

MNIST-VQA is a synthetic Visual Question Answering (VQA) dataset generated from MNIST digits placed on a 3x3 grid. It is designed to test spatial reasoning, object localization, counting, and existence verification capabilities of VQA models.

The dataset comes in three variations with increasing difficulty, characterized by the number of digits present in each image (Density Constraint):

  1. MNIST-VQA 2-4: Images contain 2 to 4 digits.
  2. MNIST-VQA 2-6: Images contain 2 to 6 digits.
  3. MNIST-VQA 2-9: Images contain 2 to 9 digits.

All variations strictly adhere to the following rules:

  • Unique Entities: No duplicate digits in a single image.
  • Label Balancing: The ratio of "empty"/"no" answers is strictly controlled (max 10-25% depending on the split/group).
  • Curriculum Density: The difficulty (number of digits) progressively increases from Train -> Val -> Test splits.

Sample Image

Sample Image (Note: Add sample.png to your repository)

Dataset Structure

Data Instances

Each instance in the dataset consists of an image, a question, an answer, and the question group.

Example from dataset.json:

[
  {
    "image": "images/img_000000.png",
    "question": "What is the digit at the center-right?",
    "answer": "7",
    "group": 1,
    "n_digits": 6
  },
  {
    "image": "images/img_000000.png",
    "question": "Identify the digit located above the digit 5.",
    "answer": "7",
    "group": 3,
    "n_digits": 6
  },
  {
    "image": "images/img_000000.png",
    "question": "Is the number 0 present in this image?",
    "answer": "yes",
    "group": 5,
    "n_digits": 6
  },
  ...
]

Data Splits

For all three variations, the dataset provides the following standard splits:

  • Train: 50,000 images
  • Validation (Val): 5,000 images
  • Test: 5,000 images

Question Groups

The dataset generates 5 distinct groups of questions to evaluate different capabilities:

  • Group 1 - Absolute Position: e.g., "What is the digit at the top-left?"
  • Group 2 - Object Localization: e.g., "Where is the digit 7?"
  • Group 3 - Relative Position (Spatial Reasoning): e.g., "What is the digit to the right of the digit 3?"
  • Group 4 - Existence / Yes-No: e.g., "Is there a digit at the center?" or "Is the digit 2 above the digit 9?"
  • Group 5 - Counting & Identification: e.g., "How many digits are there in the image?" or "Is the digit 8 in the image?"

Dataset Creation & Usage

You can generate the dataset from scratch using the provided python scripts: generate_dataset_24.py, generate_dataset_26.py, and generate_dataset_29.py.

Generating the Dataset

To generate the dataset, run any of the generation scripts. For example:

python generate_dataset_26.py --output_dir mnist_vqa_26 --n_train 50000 --n_val 5000 --n_test 5000 --q_per_image 4

Command Line Arguments

All generator scripts share the following arguments:

  • --output_dir (default: mnist_vqa_dataset): Output directory where images and JSONs will be saved.
  • --n_train (default: 50000): Number of training images.
  • --n_val (default: 5000): Number of validation images.
  • --n_test (default: 5000): Number of test images.
  • --q_per_image (default: 4): Base number of questions generated per image.
  • --cache_dir (default: mnist_cache): Directory to cache downloaded MNIST original data.
  • --seed (default: 42): Random seed for reproducibility.
  • -t: Use random seed from the current timestamp (overrides --seed).
  • --mini: Quick run mode (generates only 500 train, 50 val, and 50 test images for quick pipeline testing).
  • --random_image PATH: Generate 1 random image saved to PATH, print its QA pairs, and exit.

Density Constraints by Variation

MNIST-VQA 2-4

  • Digits per image: 2, 3, or 4
  • Ratio (Train): 40% / 40% / 20%

MNIST-VQA 2-6

  • Digits per image: 2 to 6
  • Ratio (Train): 10% / 25% / 30% / 25% / 10% (balanced, diverse)
  • Ratio (Val): 5% / 15% / 30% / 30% / 20% (skewed towards more digits)
  • Ratio (Test): 5% / 15% / 25% / 35% / 20% (hardest, many 5-6 digits)

MNIST-VQA 2-9

  • Digits per image: 2 to 9
  • Ratio (Train): 5% / 10% / 15% / 20% / 20% / 15% / 10% / 5% (bell-curve, diverse)
  • Ratio (Val): 3% / 5% / 10% / 15% / 20% / 20% / 15% / 12% (skewed towards more digits)
  • Ratio (Test): 2% / 3% / 8% / 12% / 18% / 22% / 20% / 15% (hardest, many 7-9 digits)
Downloads last month
-