data_utils#

Resolve a task list to dataset configs and download the corresponding MedVision subsets.

medvision_bm.utils.data_utils.tasks_to_configs(tasks, split)[source]#

Convert task names into MedVision dataset config names for a split.

Appends "_Train" or "_Test" to each task name and rewrites the legacy "BoxCoordinate" token to "BoxSize" to match the dataset’s config naming. Task names keep "BoxCoordinate" because "BoxSize" is reserved there for mask-size estimation tasks.

Parameters:
  • tasks (list) – Task names to convert.

  • split (str) – Data split, "train" or "test" (case-insensitive).

Returns:

Dataset config names, one per input task.

Return type:

list

Raises:

AssertionError – If split is not "train" or "test".

medvision_bm.utils.data_utils.download_datasets_from_configs(configs, split='test')[source]#

Download MedVision dataset splits for the given config names.

Parameters:
  • configs (list) – Dataset config names to download.

  • split (str) – Split requested from datasets.load_dataset. Defaults to "test".

Note

The MedVision data-loading script downloads the raw data for both the train and test splits regardless of the requested split or config, so any split/config downloads the entire dataset. See the loading script at https://huggingface.co/datasets/YongchengYAO/MedVision/blob/main/MedVision.py and the config list at https://huggingface.co/datasets/YongchengYAO/MedVision/tree/main/info.

medvision_bm.utils.data_utils.download_datasets_from_tasks(tasks, split='test')[source]#

Download MedVision datasets for the given task names and split.

Convenience wrapper that converts tasks to config names via tasks_to_configs and then calls download_datasets_from_configs.

Parameters:
  • tasks (list) – Task names to download data for.

  • split (str) – Data split, "train" or "test". Defaults to "test".