-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathdataloading.py
54 lines (48 loc) · 1.57 KB
/
dataloading.py
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
"""
This is an example of loading data that does not need transform.
It will load an excerpt from the `SLATS` dataset.
For more discussion on the `SLATS` dataset, see the README
of the repository or the paper: https://arxiv.org/abs/2304.12858.
To run it, please do the folowing.
In the folder containing this script,
0. activate conda environment `uvcgan4slats` by running
```
conda activate uvcgan4slats
```
1. set environment variable of `UVCGAN_DATA` to ./data by running
```
export UVCGAN_DATA=./data
```
2. run `python dataloading.py`
"""
from uvcgan.config import Config
from uvcgan.data import construct_data_loaders
def main():
"""
Loading an excerpt from the SLATS dataset
"""
args_dict = {
'data': {
'datasets' : [
{
'dataset' : {
'name' : 'ndarray-domain-hierarchy',
'domain' : domain,
'path' : 'slats_tiles_excerpt',
},
'shape' : (1, 256, 256),
'transform_train' : None,
'transform_test' : None,
} for domain in [ 'fake', 'real' ]
],
'merge_type' : 'unpaired'
},
'batch_size': 4,
}
args_dict = Config(**args_dict)
it_train = construct_data_loaders(args_dict.data,
args_dict.batch_size,
split='train')
for i, batch in enumerate(it_train):
print(i, batch[0].shape, batch[1].shape)
main()