File size: 606 Bytes
2cb73a9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import random
import os

exs = []
for f in os.listdir("imgs"):
    ex = f.split(".jpg")[0]
    exs.append(ex)

random.shuffle(exs)

fp = open("train.csv")

train_exs = []

for line in fp:
    train_exs.append(line.strip().split(",")[0])
fp.close()

test_exs = [ex for ex in exs if ex not in train_exs]
print(len(exs), len(test_exs))
#train_exs = exs[:3896]
#test_exs = exs[int(len(exs)*0.2) + 1:]

#train_fp = open("train.csv", "w")
#for ex in train_exs:
#    train_fp.write(ex + ",1\n")
#train_fp.close()

test_fp = open("test.csv", "w")
for ex in test_exs:
    test_fp.write(ex + ",1\n")
test_fp.close()