File size: 492 Bytes
fe6a4ad
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import random
import ipdb

domains = ["clipart", "infograph", "painting", "quickdraw", "real", "sketch"]
random.seed(42)
data = []
for index, domain in enumerate(domains):
    with open(domain + '_train_fold.txt', 'r') as f:
        domain_data = f.readlines()
        domain_data = [x.strip() + ' ' + str(index) + '\n' for x in domain_data]
        data.extend(domain_data)

random.shuffle(data)
data = data[:30000]
with open('Domainnet_train_30k.txt', 'w') as f:
    f.write("".join(data))