File size: 6,657 Bytes
fd768b2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1fc662a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
# OpenMM-Medical

## Introduction

OpenMM-Medical is a comprehensive medical evaluation dataset, which is an integration of existing datasets. OpenMM-Medical spans multiple domains, including Magnetic Resonance Imaging (MRI), CT scans, X-rays, microscopy images, endoscopy, fundus imaging, and dermoscopy. 

Components | Content | Type | Number | Metrics
| :----: | :----: |:----: | :----: |:----: |
ACRIMA | Fundus Photography | Multiple Choice Question Answering | 159 | Acc
Adam Challenge | Endoscopy | Multiple Choice Question Answering | 87 | Acc
ALL Challenge | Microscopy Images | Multiple Choice Question Answering | 342 | Acc
BioMediTech | Microscopy Images | Multiple Choice Question Answering | 511 | Acc
Blood Cell | Microscopy Images | Multiple Choice Question Answering | 1175 | Acc
BreakHis | Magnetic Resonance Imaging | Multiple Choice Question Answering | 735 | Acc
Chest CT Scan | CT Imaging | Multiple Choice Question Answering | 871 | Acc
Chest X-Ray PA | X-Ray | Multiple Choice Question Answering | 850 | Acc
CoronaHack | X-Ray | Multiple Choice Question Answering | 684 | Acc
Covid CT | CT Imaging | Multiple Choice Question Answering | 199 | Acc
Covid-19 tianchi | X-Ray | Multiple Choice Question Answering | 96 | Acc
Covid19 heywhale | X-Ray | Multiple Choice Question Answering | 690 | Acc
COVIDx CXR-4 | X-Ray | Multiple Choice Question Answering | 485 | Acc
CRC100k | Magnetic Resonance Imaging | Multiple Choice Question Answering | 1322 | Acc
DeepDRiD | Fundus Photography | Multiple Choice Question Answering | 131 | Acc
Diabetic Retinopathy | Fundus Photography | Multiple Choice Question Answering | 2051 | Acc
DRIMDB | Fundus Photography | Multiple Choice Question Answering | 132 | Acc
Fitzpatrick 17k | Dermoscopy | Multiple Choice Question Answering | 1552 | Acc
HuSHeM | Microscopy Images | Multiple Choice Question Answering | 89 | Acc
ISBI2016 | Dermoscopy | Multiple Choice Question Answering | 681 | Acc
ISIC2018 | Dermoscopy | Multiple Choice Question Answering | 272 | Acc
ISIC2019 | Dermoscopy | Multiple Choice Question Answering | 1952 | Acc
ISIC2020 | Dermoscopy | Multiple Choice Question Answering | 1580 | Acc
JSIEC | Fundus Photography | Multiple Choice Question Answering | 220 | Acc
Knee Osteoarthritis | X-Ray | Multiple Choice Question Answering | 518 | Acc
MAlig Lymph | Magnetic Resonance Imaging | Multiple Choice Question Answering | 149 | Acc
MHSMA | Microscopy Images | Multiple Choice Question Answering | 1282 | Acc
MIAS | X-Ray | Multiple Choice Question Answering | 142 | Acc
Monkeypox Skin Image 2022 | Dermoscopy | Multiple Choice Question Answering | 163 | Acc
Mura | X-Ray | Multiple Choice Question Answering | 1464 | Acc
NLM- Malaria Data | Magnetic Resonance Imaging | Multiple Choice Question Answering | 75 | Acc
OCT & X-Ray 2017 | X-Ray, Optical Coherence Tomography | Multiple Choice Question Answering | 1301 | Acc
OLIVES | Fundus Photography | Multiple Choice Question Answering | 593 | Acc
PAD-UFES-20 | Dermoscopy | Multiple Choice Question Answering | 479 | Acc
PALM2019 | Fundus Photography | Multiple Choice Question Answering | 510 | Acc
Pulmonary Chest MC | X-Ray | Multiple Choice Question Answering | 38 | Acc
Pulmonary Chest Shenzhen | X-Ray | Multiple Choice Question Answering | 296 | Acc
RadImageNet | CT; Magnetic Resonance Imaging; Ultrasound | Multiple Choice Question Answering | 56697 | Acc
Retinal OCT-C8 | Optical Coherence Tomography | Multiple Choice Question Answering | 4016 | Acc
RUS CHN | X-Ray | Multiple Choice Question Answering | 1982 | Acc
SARS-CoV-2 CT-scan | CT | Multiple Choice Question Answering | 910 | Acc
Yangxi | Fundus Photography | Multiple Choice Question Answering | 1515 | Acc

## Usage

The following steps detail how to use [**Baichuan-Omni-1.5**](https://github.com/baichuan-inc/Baichuan-Omni-1.5) with OpenMM-Medical for evaluation using [**VLMEvalKit**](https://github.com/open-compass/VLMEvalKit):

---

### **1. Add `baichuan.py` in `VLMEvalKit/vlmeval/vlm`**

Download `baichuan.py` (which defines the `Baichuan` model class) and add it in `VLMEvalKit/vlmeval/vlm`.

---

### **2. Modify `VLMEvalKit/vlmeval/vlm/__init__.py`**
Add the following line:
```python
from .baichuan import Baichuan
```

---

### **3. Modify `VLMEvalKit/vlmeval/config.py`**
Import the `Baichuan` model:
```python
from vlmeval.vlm import Baichuan
```

Add the `Baichuan-omni` model configuration:
```python
'Baichuan-omni': partial(
    Baichuan, 
    sft=True, 
    model_path='/your/path/to/the/model/checkpoint'
)
```

---

### **4. Modify `VLMEvalKit/vlmeval/dataset/image_mcq.py`**
Download `image_mcq.py` and add the following code to define the `OpenMMMedical` class. Ensure the `image_folder` points to your OpenMM-Medical dataset location:

```python
class OpenMMMedical(ImageMCQDataset):

    @classmethod
    def supported_datasets(cls):
        return ['OpenMMMedical']

    def load_data(self, dataset='OpenMMMedical'):
        image_folder = "/your/path/to/OpenMM_Medical"
        def generate_tsv(pth):
            import csv
            from pathlib import Path
            tsv_file_path = os.path.join(LMUDataRoot(), f'{dataset}.tsv')
        ...
```

---

### **5. Update `VLMEvalKit/vlmeval/dataset/__init__.py`**
Import `OpenMMMedical`:
```python
from .image_mcq import (
    ImageMCQDataset, MMMUDataset, CustomMCQDataset, 
    MUIRDataset, GMAIMMBenchDataset, MMERealWorld, OpenMMMedical
)

IMAGE_DATASET = [
    ImageCaptionDataset, ImageYORNDataset, ImageMCQDataset, ImageVQADataset,
    MathVision, MMMUDataset, OCRBench, MathVista, LLaVABench, MMVet,
    MTVQADataset, TableVQABench, MMLongBench, VCRDataset, MMDUDataset,
    DUDE, SlideVQA, MUIRDataset, GMAIMMBenchDataset, MMERealWorld, OpenMMMedical
]
```

---

### **6. Update `VLMEvalKit/vlmeval/dataset/image_base.py`**
Modify the `img_root_map` function:
```python
def img_root_map(dataset):
    if 'OpenMMMedical' in dataset:
        return 'OpenMMMedical'
    if 'OCRVQA' in dataset:
        return 'OCRVQA'
    if 'COCO_VAL' == dataset:
        return 'COCO'
    if 'MMMU' in dataset:
        return 'MMMU'
```

---

### **7. Run the Evaluation**
Execute the following command to start the evaluation:
```bash
python run.py --data OpenMMMedical --model Baichuan-omni --verbose
```

---

### **Notes:**
- Ensure that all paths (e.g., `/your/path/to/OpenMM_Medical`) are correctly specified.
- Confirm that the Baichuan model checkpoint is accessible at the defined `model_path`.
- Validate the dependencies and configurations of VLMEvalKit to avoid runtime issues.

With this setup, you should be able to evaluate OpenMM-Medical using Baichuan-Omni successfully.