Skip to main content

A Python library for automated visual question answering data generation.

Project description

AutoVQA

A Python library for automated visual question answering data generation.

Paper Dataset


Installation

pip install autovqa

For development installation:

git clone https://github.com/Ddyln/AutoVQA.git
cd AutoVQA
pip install -e ".[dev]"

Quick Start

import json
from autovqa.evaluate import run_evaluate
from autovqa import eda_pipeline, filter_pipeline, balancer_pipeline

# Step 1: Evaluate your augmented VQA data (scores image + text quality)
run_evaluate(limit_samples=-1, max_retries=3)

# Step 2: Load the evaluated data
with open("evaluated_vqa.json", "r", encoding="utf-8") as f:
    data = json.load(f)

# Step 3: Run EDA pipeline
df = eda_pipeline(data, output_dir="./reports", generate_report=True)

# Step 4: Filter low-quality records
df = filter_pipeline(df, threshold=0.5)

# Step 5: Balance the dataset
df = balancer_pipeline(df)

# Save results
df.to_csv("output.csv", index=False)

Pipeline Overview

Collect ──► Augment ──► Evaluate ──► EDA ──► Filter ──► Balance
Step Module Output
1 collect Raw images + text JSON
2 augment augmented_vqa.json — new QA pairs
3 evaluate evaluated_vqa.json — QA + scores
4 eda Cleaned DataFrame + Excel reports
5 filter Quality-filtered DataFrame
6 balance balanced_data.csv

Features

Collect

Download VQA datasets and images from various sources.

from autovqa.collect import download_default_data

download_default_data(output="./data")

Preprocess

Image preprocessing pipeline for VQA tasks (resize, denoise, color correction, sharpening).

from autovqa.preprocess.main import preprocess_image, run_pipeline

# Single image
processed = preprocess_image("image.jpg", target_size=(480, 640))

# Batch processing
run_pipeline(input_folder="./raw_images", output_folder="./processed_images")

Augment

Generate VQA question-answer pairs using LLMs (e.g., Gemini).

from autovqa.augment.client import AugmentClient

client = AugmentClient(service_name="google")
results = client.run_pipeline(
    image_folder_dir="./images",
    output_json_path="./augmented_vqa.json"
)

Evaluate

Score each QA pair and its image across multiple dimensions using Gemini. You can use either a Google API key via GOOGLE_API_KEY or Google Cloud / Vertex AI credentials.

from autovqa.evaluate import run_evaluate

# Evaluate all records (supports resuming from checkpoints)
run_evaluate(limit_samples=-1, max_retries=3)

Scores produced per record:

  • eip_ — Image quality (clarity, occlusion, object density, scene clutter, etc.)
  • idp_ — Image diversity (scene type, main object, cultural context, demographics)
  • etp_ — Text quality (grammar, unambiguity, QA structure, syntactic complexity)
  • vqac_ — VQA correlation (question↔image, answer↔image, reasoning depth)

EDA (Exploratory Data Analysis)

Analyze evaluated VQA data with cleaning, feature extraction, and report generation.

from autovqa import eda_pipeline

df = eda_pipeline(
    data=data,
    output_dir="./reports",
    generate_report=True,
    aggregation_type="median"
)

Filter

Filter data based on quality labels and thresholds.

from autovqa import filter_pipeline

df_filtered = filter_pipeline(df, threshold=0.5, show_stats=True)

Balance

Balance class distributions in your dataset.

from autovqa import balancer_pipeline

df_balanced = balancer_pipeline(df_filtered, output_path="./balanced.csv")

Data Format

AutoVQA expects JSON data in the following format for the EDA/Filter/Balance pipeline (output of the Evaluate step):

[
    {
        "question": "What is in the image?",
        "answers": ["Answer 1", "Answer 2", "Answer 3", "Answer 4", "Answer 5"],
        "image_link": "http://images.cocodataset.org/...",
        "image_name": "000000001.jpg",
        "index": 1,
        "image_quality_evaluation": { "...": "..." },
        "image_diversity_evaluation": { "...": "..." },
        "text_quality_evaluation": { "...": "..." },
        "correlation_evaluation": { "...": "..." }
    }
]

Documentation

See the Getting Started Notebook for detailed usage examples, or the Example Notebook for a minimal end-to-end run.

Development

For more details on setting up a development environment, please refer to the Development Guide.

Contributing

Contributions are welcome! Please read our Contributing Guide for details.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Citation

If you use AutoVQA in your research, please cite:

@misc{tuong2026autoviVQA,
  title  = {AutoViVQA: A Large-Scale Automatically Constructed Dataset for Vietnamese Visual Question Answering},
  author = {Nguyen Anh Tuong, Phan Ba Duc, Nguyen Trung Quoc, Tran Dac Thinh, Dang Duy Lan, Nguyen Quoc Thinh, Tung Le},
  year   = {2026},
  eprint = {2603.09689},
  archivePrefix = {arXiv},
  primaryClass  = {cs.CV},
  url    = {https://arxiv.org/abs/2603.09689}
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

autovqa-0.1.0.tar.gz (45.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

autovqa-0.1.0-py3-none-any.whl (59.4 kB view details)

Uploaded Python 3

File details

Details for the file autovqa-0.1.0.tar.gz.

File metadata

  • Download URL: autovqa-0.1.0.tar.gz
  • Upload date:
  • Size: 45.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for autovqa-0.1.0.tar.gz
Algorithm Hash digest
SHA256 433dcbdb85af0fdaca6cff15369235dc3eca81ceb3be8cfb6e187155772bb0d2
MD5 0d17d3a054f8b4432044ea5070ad9dc5
BLAKE2b-256 451f58e856a3f75b35a4e0be0dd0bbe117d8711c810e117e10b15b9fd3f210ec

See more details on using hashes here.

File details

Details for the file autovqa-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: autovqa-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 59.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for autovqa-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d4cd4cb0e52ce6abeafb253dc062e8bde9300dd6fa143739fccdf44619a6d8cd
MD5 16d8206d2879bd058129c84563b67f5a
BLAKE2b-256 045322871803a540c27ac79e941aaa1101d14f281897276405e6737397cced6d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page