Datasets:
Update README.md
Browse files
README.md
CHANGED
|
@@ -48,14 +48,14 @@ ds = load_dataset("SimulaMet-HOST/Kvasir-VQA")
|
|
| 48 |
```
|
| 49 |
d_path ="./" #existing folder where you want to save images and metadata.csv
|
| 50 |
|
| 51 |
-
df = ds['
|
| 52 |
df.to_csv(f"{d_path}/metadata.csv", index=False)
|
| 53 |
|
| 54 |
import os
|
| 55 |
os.makedirs(f"{d_path}/images", exist_ok=True)
|
| 56 |
|
| 57 |
for i, row in df.groupby('img_id').nth(0).iterrows(): # for images
|
| 58 |
-
image = ds['
|
| 59 |
```
|
| 60 |
|
| 61 |
The total image size is around 1.5 GB. The CSV file will have 58,849 rows.
|
|
|
|
| 48 |
```
|
| 49 |
d_path ="./" #existing folder where you want to save images and metadata.csv
|
| 50 |
|
| 51 |
+
df = ds['raw'].select_columns(['source', 'question', 'answer', 'img_id']).to_pandas()
|
| 52 |
df.to_csv(f"{d_path}/metadata.csv", index=False)
|
| 53 |
|
| 54 |
import os
|
| 55 |
os.makedirs(f"{d_path}/images", exist_ok=True)
|
| 56 |
|
| 57 |
for i, row in df.groupby('img_id').nth(0).iterrows(): # for images
|
| 58 |
+
image = ds['raw'][i]['image'].save(f"{d_path}/images/{row['img_id']}.jpg")
|
| 59 |
```
|
| 60 |
|
| 61 |
The total image size is around 1.5 GB. The CSV file will have 58,849 rows.
|