{"id":50937986,"url":"https://github.com/simula/kvasir-vqa","last_synced_at":"2026-06-17T11:03:35.088Z","repository":{"id":339419623,"uuid":"849746663","full_name":"simula/Kvasir-VQA","owner":"simula","description":"Official Code Repository for Kvasir-VQA: A Text-Image Pair GI Tract Dataset","archived":false,"fork":false,"pushed_at":"2026-02-19T15:44:22.000Z","size":569,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"main","last_synced_at":"2026-02-19T19:27:39.456Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://datasets.simula.no/kvasir-vqa/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/simula.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-08-30T07:00:30.000Z","updated_at":"2026-02-19T15:44:26.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/simula/Kvasir-VQA","commit_stats":null,"previous_names":["simula/kvasir-vqa"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/simula/Kvasir-VQA","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simula%2FKvasir-VQA","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simula%2FKvasir-VQA/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simula%2FKvasir-VQA/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simula%2FKvasir-VQA/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/simula","download_url":"https://codeload.github.com/simula/Kvasir-VQA/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simula%2FKvasir-VQA/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34445186,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-17T02:00:05.408Z","response_time":127,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-06-17T11:03:21.078Z","updated_at":"2026-06-17T11:03:35.081Z","avatar_url":"https://github.com/simula.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Kvasir-VQA\n\nPublic repository for the Kvasir-VQA dataset and experiments.\n\n- Dataset: https://datasets.simula.no/kvasir-vqa/\n- Paper: https://dl.acm.org/doi/10.1145/3689096.3689458\n- Advanced VQA version (Kvasir-VQA-x1): https://github.com/simula/Kvasir-VQA-x1\n\n## 📙 Dataset\nThe full Kvasir-VQA dataset consists of 6,500 images with question-answer annotations and is available at https://datasets.simula.no/kvasir-vqa/.\n\nA subset of this dataset, featuring 2,000 images and 20,241 captions, was randomly selected from five different sources. An LLM was employed to transform captions into question-answer pairs for a VQA task. The subset used in the experiments in this paper is publicly available at 🤗 https://huggingface.co/datasets/SushantGautam/ImageCLEFmed-MEDVQA-GI-2024-Dev_mod.\n\n## 🔗 Model Checkpoints (Hugging Face)\n- SD3 DreamBooth/LoRA: https://huggingface.co/SushantGautam/kvasir-vqa-sd3-lora\n- Florence-2 VQA LoRA: https://huggingface.co/SushantGautam/kvasir-vqa-florence2-medvqa-lora\n- Florence-2 Image Captioning LoRA: https://huggingface.co/SushantGautam/kvasir-vqa-florence2-image-captioning-lora\n\n\nThe code below replicates the three use-cases of the dataset as presented in the paper.\n## 🖼️ Image Captioning\nFinetune Florence-2 with the prefix `\u003cDETAILED_CAPTION\u003e` :\n\n`python image_captioning/fine_tune_florence_2.py`\n\nlocal trained model path: Florence-2-vision_tower_frozen/epoch_10\n\n### 📝 Evaluation\n`python evaluation/image_captioning.py`\n\n\n## ❓Visual Question Answering (VQA)\nFinetune Florence-2 model with the prefix `\u003cmedvqa\u003e`:\n\n`python vqa/fine_tune_florence_2_vqa.py`\n\n local trained model path: Florence-2-vqa/epoch_10\n\n\n#### 🤖 Synthetic VQA generation with VLLM server on an A100 GPU\nServe Meta-Llama-3-8B-Instruct model on a VLLM server:\n\n`python -m vllm.entrypoints.openai.api_server  --model meta-llama/Meta-Llama-3-8B-Instruct --tensor-parallel-size 1`\n\nRun VLLM VQA generation with the VLLM server:\n\n`python vqa/llm_vqa.py --vllm_url http://vllserver-hostname:8000 --num_proc 100`\n \n### 📝 Evaluation\n`python evaluation/vqa.py`\n\nThe generated Q/A pairs along with the generated answers for each (image, question) input form the trained VQA model (Florence-2-vqa/epoch_10) is shared as `generated_llm_vqa.csv`. The index of rows in the csv file is same as the one in the dataset (subset; see Dataset section below).\n\n## Synthetic Medical Image Generation\nStable Diffusion 3 fine-tuning with DreamBooth/ LoRA:\n\n`python imagen/fine_tune_dreambooth_lora_sd3.py --pretrained_model_name_or_path=stabilityai/stable-diffusion-3-medium-diffusers --dataset_name=SushantGautam/ImageCLEFmed-MEDVQA-GI-2024-Dev_mod --instance_prompt XXX --caption_column caption --report_to wandb --resolution=512 --train_batch_size=48 --gradient_accumulation_steps=1 --gradient_checkpointing --mixed_precision=fp16 --num_train_epochs=80 --optimizer=prodigy --learning_rate=1.0 --allow_tf32 --weighting_scheme=logit_normal --lr_scheduler=constant --validation_prompt=\"Generate an image with a polyp located in the center-right.\" --validation_epochs=1 --lr_warmup_steps=0 --seed=0 --rank 128 --checkpoints_total_limit=20 --output_dir=MEDVQA_SD3_db_lora_dev`\n\nlocal trained model path: MEDVQA_SD3_db_lora_dev/pytorch_lora_weights.safetensors\n\n\n### 📝 Evaluation\n\n##### 🏥 Generate synthetic images\n`python evaluation/imagen_generate.py --type polyp --num_images 5000`\n`python evaluation/imagen_generate.py --type non_polyp --num_images 5000`\n\nThis should generate synthetic images in \"data/polyp_classification-v1/polyp/\" and \"data/polyp_classification-v1/non_polyp/\"\n\n##### Download real images from ImageCLEFmed-MEDVQA-GI-2024-Development-Dataset: https://drive.google.com/file/d/1bZ27-A3RLTYot65swbtu0A3p4O9Asp0-/view and put all images in \"MEDVQA_GI_2024/Dev-Dataset/images\"\n\n##### 📝 Evaluate the generated images\n`python evaluation/imagen.py`\n\n## 🧾 Citation\nIf you use this dataset or code, please cite:\n\n```\n@incollection{Gautam2024Oct,\n\tauthor = {Gautam, Sushant and Stor\\aa s, Andrea M. and Midoglu, Cise and others},\n\ttitle = {{Kvasir-VQA: A Text-Image Pair GI Tract Dataset}},\n\tbooktitle = {{ACM Conferences}},\n\tpages = {3--12},\n\tyear = {2024},\n\tmonth = oct,\n\tpublisher = {Association for Computing Machinery},\n\taddress = {New York, NY, USA},\n\tdoi = {10.1145/3689096.3689458}\n}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimula%2Fkvasir-vqa","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsimula%2Fkvasir-vqa","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimula%2Fkvasir-vqa/lists"}