File size: 1,201 Bytes
7324130
 
44766e7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7324130
cbc31d4
 
 
 
 
 
b966f33
 
 
 
 
 
 
 
 
 
cbc31d4
 
 
 
 
 
 
b966f33
cbc31d4
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
---
license: cc-by-4.0
dataset_info:
  features:
  - name: image
    dtype: string
  - name: caption
    dtype: string
  - name: dialog
    sequence:
      sequence: string
  splits:
  - name: train
    num_bytes: 72983994
    num_examples: 123287
  - name: test
    num_bytes: 3146123
    num_examples: 8000
  - name: validation
    num_bytes: 1294797
    num_examples: 2064
  download_size: 32870167
  dataset_size: 77424914
---

Usage:
```python
from dataclasses import dataclass
import datasets

# load and path setting
ds_visdial = datasets.load_dataset('jxu124/visdial')
path_map = {
    "coco/train2014": f"/datasets/coco/train2014",
    "coco/val2014": f"/datasets/coco/val2014",
    "visdial/VisualDialog_test2018": f"/datasets/visdial/VisualDialog_test2018",
    "visdial/VisualDialog_val2018": f"/datasets/visdial/VisualDialog_val2018"
}

# apply to your datasets
@dataclass
class ReplaceImagePath():
    path_map: {}
    def __call__(self, features):
        for k, v in self.path_map.items():
            features['image'] = features['image'].replace(k, v)
        return features
ds_visdial = ds_visdial.map(ReplaceImagePath(path_map=path_map)).cast_column("image", datasets.Image())
```