Skip to main content

Benchmark toolkit for DrVD

Project description

DrVD-Bench: Do Vision-Language Models Reason Like Human Doctors in Medical Image Diagnosis?

paperkagglehuggingfacegithub

This repository is the official implementation of the paper: DrVD-Bench: Do Vision-Language Models Reason Like Human Doctors in Medical Image Diagnosis?

Introduction

Vision–language models (VLMs) exhibit strong zero-shot generalization on natural images and show early promise in interpretable medical image analysis. However, existing benchmarks do not systematically evaluate whether these models truly reason like human clinicians or merely imitate superficial patterns.
To address this gap, we propose DrVD-Bench, the first multimodal benchmark for clinical visual reasoning. DrVD-Bench consists of three modules: Visual Evidence Comprehension, Reasoning Trajectory Assessment, and Report Generation Evaluation, comprising 7 789 image–question pairs.
Our benchmark covers 20 task types, 17 diagnostic categories, and five imaging modalities—CT, MRI, ultrasound, X-ray, and pathology. DrVD-Bench mirrors the clinical workflow from modality recognition to lesion identification and diagnosis.
We benchmark 19 VLMs (general-purpose & medical-specific, open-source & proprietary) and observe that performance drops sharply as reasoning complexity increases. While some models begin to exhibit traces of human-like reasoning, they often rely on shortcut correlations rather than grounded visual understanding. DrVD-Bench therefore provides a rigorous framework for developing clinically trustworthy VLMs.

DrVD-Bench Usage Instructions

0. Installation

pip install drvd-bench

1. Function get_drvd_data

Functionality

Reads JSONL, generates the final prompt, and returns an iterator of (img_path, prompt, origin_data).

Note

This code only returns an iterator for retrieving data and does not include model inference.

Parameters

  • jsonl_path (str | Path): Path to the dataset JSONL file
  • image_root (str | Path): Root directory of the dataset
  • data_type ({“single”, “joint”}): Question type, default “single”. Use “joint” only for joint_qa.jsonl; all other JSONL files should use “single”
  • verbose (bool): Whether to show a progress bar; default is True

Returns

Iterator[(img_path:str, prompt:str, record:dict)]

Example

from drvd_bench import get_drvd_data
for img, prompt, original_data in get_drvd_data(
    "test_drvd_pypi/data/visual_evidence_qa.jsonl",
    "test_drvd_pypi/data",
    data_type="single"
):
    print(img, prompt[:80] + "…")

2. Function map_result

Functionality

Calls the DeepSeek Chat API to map open-ended responses to options and writes back to JSONL.

Note

Use only when the model instruction-following capability is insufficient and for non-report generation tasks. Not needed if the model instruction-following is strong.

Parameters

  • api_key (str): DeepSeek API Key; refer to the DeepSeek official website for details
  • input_path (str | Path): Path to the original prediction JSONL file
  • output_path (str | Path): Path to save the mapped JSONL file
  • base_url (str): Private deployment URL; typically does not need modification
  • show_preview (int): Preview the first N results; default is 5

Example

from drvd_bench import map_result
map_result(
    api_key="sk-…",
    input_path="pred.jsonl",
    output_path="mapped.jsonl"
)

3. Function compute_choice_metric

Functionality

Calculates accuracy for multiple-choice questions.

Note

Your JSONL file must contain an answer key for the original data’s answer. The model’s result must be stored in the key model_response and should be a single option, such as A, B, C, D, etc.

Parameters

  • jsonl_path (str | Path): Path to the prediction result JSONL file
  • mode ({“single”, “joint”}): Question type, default “single”. Use “joint” only for joint_qa.jsonl; all other multiple-choice JSONL result files should use “single”

Example

from drvd_bench import compute_choice_metric
compute_choice_metric(
    "visual_evidence_qa_pred.jsonl",
    mode="single"
)

4. Function compute_report_generation_metric

Functionality

Computes BLEU and BERTScore F1 for report generation tasks.

Note

Your JSONL file must contain an answer key for the original data’s answer. The model’s result must be stored in the key model_response.

Parameters

  • api_key (str): DeepSeek API Key
  • json_path (str | Path): Path to the JSONL result file containing answer / model_response fields for report generation
  • base_url (str): Private deployment URL; typically does not need modification

Example

from drvd_bench import compute_report_generation_metric
compute_report_generation_metric(
    api_key="sk-…",
    json_path="report_generation_preds.jsonl"
)

Contact

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

drvd_bench-0.2.1.tar.gz (17.4 kB view details)

Uploaded Source

Built Distribution

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

drvd_bench-0.2.1-py3-none-any.whl (17.6 kB view details)

Uploaded Python 3

File details

Details for the file drvd_bench-0.2.1.tar.gz.

File metadata

  • Download URL: drvd_bench-0.2.1.tar.gz
  • Upload date:
  • Size: 17.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.2

File hashes

Hashes for drvd_bench-0.2.1.tar.gz
Algorithm Hash digest
SHA256 19a57800b8731bb84ed8c6953977c42aca816d91b4ccc99135f5d869da8537b7
MD5 2be7e0daabca62cab25b46709c6cd5d5
BLAKE2b-256 be43fb0bf170424d8754391118907c891aea6e060557d3d012acb6779cbe1530

See more details on using hashes here.

File details

Details for the file drvd_bench-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: drvd_bench-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 17.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.2

File hashes

Hashes for drvd_bench-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 14dbf71e7ad6c09f02d4b12a4a1f0e1f1a4b08d3a3d4edf42cf5f3eadff2ed5e
MD5 7f3d7a13f5a44e571efa92ea8789d519
BLAKE2b-256 52634ffedaf33780c0e5142e37dfec496adf952ccb35e25ccb6eff13e9be49e9

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