sihany commited on
Commit
bfa1c61
·
verified ·
1 Parent(s): 28a7b5f

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +36 -0
README.md CHANGED
@@ -53,6 +53,42 @@ from datasets import load_dataset
53
  mmsi_bench = load_dataset("RunsenXu/MMSI-Bench")
54
  print(mmsi_bench)
55
  ```
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
56
 
57
 
58
  ## Evaluation
 
53
  mmsi_bench = load_dataset("RunsenXu/MMSI-Bench")
54
  print(mmsi_bench)
55
  ```
56
+ ## After downloading the parquet file, read each record, decode images from binary, and save them as JPG files.
57
+ ```
58
+ import pandas as pd
59
+ import os
60
+
61
+ df = pd.read_parquet('MMSI_Bench.parquet')
62
+
63
+ output_dir = './images'
64
+ os.makedirs(output_dir, exist_ok=True)
65
+
66
+ for idx, row in df.iterrows():
67
+ id_val = row['id']
68
+ images = row['images']
69
+ question_type = row['question_type']
70
+ question = row['question']
71
+ answer = row['answer']
72
+ thought = row['thought']
73
+
74
+ image_paths = []
75
+ if images is not None:
76
+ for n, img_data in enumerate(images):
77
+ image_path = f"{output_dir}/{id_val}_{n}.jpg"
78
+ with open(image_path, "wb") as f:
79
+ f.write(img_data)
80
+ image_paths.append(image_path)
81
+ else:
82
+ image_paths = []
83
+
84
+ print(f"id: {id_val}")
85
+ print(f"images: {image_paths}")
86
+ print(f"question_type: {question_type}")
87
+ print(f"question: {question}")
88
+ print(f"answer: {answer}")
89
+ print(f"thought: {thought}")
90
+ print("-" * 50)
91
+ ```
92
 
93
 
94
  ## Evaluation