EVA Evaluation Framework

repository·main·Indexed 41 days ago

https://github.com/kaiko-ai/eva

An oncology foundation model (FM) evaluation framework for standardized benchmarking in pathology and radiology. Version 0.4.5 supports classification, segmentation, and VQA tasks via offline (embedding-based) and online (end-to-end) evaluation modes. It provides a CLI and Python/YAML configuration interfaces for managing trainers, head modules, and data modules, with built-in support for medical datasets such as BACH, BCSS, BRACS, BreakHis, BTCV, and Camelyon16.

Tokens
35.1K
Snippets
99
Records
194
Agent score
51%

What's inside EVA

  1. Overview of supported Vision datasets

    main

    The eva project provides native support for various vision datasets, categorized by their scale and modality. For many of these datasets, the corresponding dataset classes in eva facilitate automatic downloading to disk.

    Patch-level Datasets

    These datasets consist of image patches used for classification or segmentation tasks, often involving microscopy or tissue samples:

    • BACH: Breast classification (4 classes)
    • BRACS: Breast classification (7 classes)
    • BreakHis: Breast classification (4 classes)
    • CRC: Colorectal classification (9 classes)
    • GleasonArvaniti: Prostate classification (4 classes)
    • PatchCamelyon: Breast classification (2 classes)
    • MHIST: Colorectal Polyp classification (2 classes)
    • UniToPatho: Colorectal Polyp classification (6 classes)
    • MoNuSAC: Multi-organ cell type segmentation (4 classes)
    • CoNSeP: Colorectal nuclear segmentation (8 classes)

    Slide-level Datasets

    These datasets involve Whole Slide Images (WSI) for large-scale classification:

    • Camelyon16: Breast classification (2 classes)
    • PANDA: Prostate classification (6 classes)
    • PANDASmall: Prostate classification (6 classes)

    Radiology Datasets

    These datasets focus on 3D semantic segmentation tasks:

    • BTCV: 14 classes (Download provided)
    • LiTS17: 3 classes (Download NOT provided)
    • MSDTask7Pancreas: 3 classes (Download provided)
  2. Overview of supported Multimodal datasets

    main

    The eva project supports multimodal datasets that combine image and text modalities for various tasks. Automatic download is provided for all listed datasets:

    • PatchCamelyon: Image + Text for Multiple Choice tasks (Domain: Breast Cancer).
    • PathMMU Atlas: Image + Text for Multiple Choice tasks (Domain: Pathology).
    • QuiltVQA: Image + Text for Free-form Visual Question Answering (VQA) (Domain: Histopathology).
  3. Overview of the UniToPatho dataset

    main

    UniToPatho is a vision dataset consisting of 9,536 hematoxylin and eosin (H&E) stained patches extracted from 292 whole-slide images. It is designed for training deep neural networks for colorectal polyp classification and adenoma grading.

    For the current benchmark, only the 800 subset is used, which contains 8,669 images with a resolution of 1812x1812. The dataset is organized into six distinct classes:

    • NORM: Normal tissue
    • HP: Hyperplastic Polyp
    • TA.HG: Tubular Adenoma, High-Grade dysplasia
    • TA.LG: Tubular Adenoma, Low-Grade dysplasia
    • TVA.HG: Tubulo-Villous Adenoma, High-Grade dysplasia
    • TVA.LG: Tubulo-Villous Adenoma, Low-Grade dysplasia
  4. PathMMU Atlas dataset overview

    main

    PathMMU Atlas is a multimodal visual question answering (VQA) dataset designed to evaluate vision-language models on pathology knowledge. It combines expert-validated questions from the PathMMU repository with pathology images from the ARCH Book Set educational textbooks.

    ModalityTaskDomainSample SizeQuestion FormatLicense
    Image + TextMultiple Choice (A-E)Pathology80 val / 799 test / 208 test_tinyVQA with pathology imagesCC-BY-ND-4.0 (PathMMU), CC-BY-NC-SA-4.0 (ARCH)
  5. Use the BreakHis dataset for breast cancer classification

    main

    The BreakHis dataset is used for multiclass classification of breast tumor tissue using microscopic images. For this benchmark, the dataset is filtered to include only 40X magnification samples and classes with at least 7 patients to ensure statistical validity.

    Dataset Specifications

    • Task: Multiclass classification (4 classes)
    • Modality: Vision (WSI patches)
    • Image Dimensions: 700 x 460
    • File Format: png
    • Magnification: 40x (0.25 μm/px)
    • Included Classes: TA (Tubular Adenoma), MC (Mucinous Carcinoma), F (Fibroadenoma), and DC (Ductal Carcinoma).

    Data Splits

    The dataset uses train/validation splits with no patient overlap between them:

    • Train: 1132 samples (76.95%)
    • Validation: 339 samples (23.04%)
  6. Use the BACH dataset for breast cancer classification

    main

    The BACH dataset is used for multiclass classification of breast cancer microscopy images. It contains 408 labeled .tif images across 4 classes: Normal, Benign, Invasive, and InSitu.

    Dataset Specifications

    • Modality: Vision (microscopy images)
    • Image Dimensions: 1536 x 2048 x 3
    • Magnification: 20x (0.42 μm/px)
    • Classes: 4 (102 images per class)
    • Splits: The dataset is split into Train (268 samples) and Validation (132 samples). These splits are designed to prevent data leakage by ensuring images from the same patient are not shared between splits.

    Data Organization

    When extracted from ICIAR2018_BACH_Challenge.zip, the relevant labeled patches are located in the Photos directory, organized by class name (e.g., Photos/Normal/, Photos/Benign/, etc.).

  7. Use model wrappers to integrate external models

    main

    The eva.models.wrappers module provides several classes to wrap different model formats and functions into a unified interface compatible with the eva ecosystem. Use these wrappers to load models from HuggingFace, ONNX, or custom functions.

    from eva.models.wrappers import HuggingFaceModel, ONNXModel, ModelFromFunction, BaseModel
    
    # Wrap a HuggingFace model
    hf_model = HuggingFaceModel(model_id="name")
    
    # Wrap an ONNX model
    onnx_model = ONNXModel(path="model.onnx")
    
    # Wrap a custom function as a model
    custom_model = ModelFromFunction(func=my_function)
  8. Use the Dataset base class for custom data loading

    main

    The eva.core.data.Dataset class serves as the base class for defining custom datasets within the EVA framework. When implementing a new data loading strategy, you should inherit from this base class to ensure compatibility with the rest of the EVA data pipeline.

    from eva.core.data import Dataset
    
    class MyCustomDataset(Dataset):
        # Implement required methods for your specific data type
        pass
  9. UniToPatho data splits and organization

    main

    The dataset provides two primary splits. Note that because only two splits are provided by the authors, no separate test split is reported in benchmarks.

    Splits

    • Train: 6,270 samples (72.33%)
    • Validation: 2,399 samples (27.67%)

    Directory Structure

    The 800 subset is organized with CSV files for split definitions and subdirectories for each class:

    unitopatho
    ├── 800
    │   ├── test.csv
    │   ├── train.csv
    │   ├── HP
    │   ├── NORM
    │   ├── TA.HG
    │   ├── ...
    unitopatho
    ├── 800
    │   ├── test.csv
    │   ├── train.csv
    │   ├── HP                    # 1 folder per class 
    │   ├── NORM
    │   ├── TA.HG
    │   ├── ...
  10. Understand the CoNSeP dataset structure and classes

    main

    The CoNSeP (Colorectal Nuclear Segmentation and Phenotypes) dataset is used for vision-based segmentation tasks. It consists of 41 tiles (1000x1000 pixels) extracted from 16 Whole Slide Images (WSIs).

    While the original dataset contains 7 classes, this implementation uses a combined 4-class schema for segmentation:

    1. Miscellaneous
    2. Inflammatory
    3. Epithelial (combines original 'Normal epithelium' and 'Malignant/dysplastic epithelium')
    4. Spindle-shaped (combines original 'Fibroblast', 'Muscle', and 'Endothelial')

    Technical Specifications:

    • Modality: Vision (WSI patches)
    • Image Dimensions: 1000 x 1000 x 3
    • File Formats: .png for images and .mat for segmentation masks
    • Magnification: 40x (0.25 μm/px)
  11. MoNuSAC dataset splits and validation strategy

    main

    The MoNuSAC dataset uses the splits provided by the original data source. Because a dedicated validation split is not provided by the source, the "test" split is used as the validation split for training workflows.

    SplitNumber of SamplesPercentage
    Train20971%
    Validation (from Test split)8529%