-
Notifications
You must be signed in to change notification settings - Fork 1
/
make_list.py
41 lines (29 loc) · 1.18 KB
/
make_list.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
import glob
import json
import os.path
from tqdm import tqdm
def make_dense_list():
root_dir = '/opt/data/common/SeeingThroughFog/SeeingThroughFogCompressedExtracted'
json_files = glob.glob(os.path.join(root_dir, 'labeltool_labels', '*.json'))
samples = []
for file in tqdm(json_files):
with open(file, 'r') as f:
data = json.load(f)
if data['weather']['dense_fog'] and data['daytime']['day']:
samples.append(os.path.basename(file)[:-5] + '\n')
with open('splits/dense_fog/dense_fog.txt', 'w') as f:
f.writelines(samples)
def make_light_list():
root_dir = '/opt/data/common/SeeingThroughFog/SeeingThroughFogCompressedExtracted'
json_files = glob.glob(os.path.join(root_dir, 'labeltool_labels', '*.json'))
samples = []
for file in tqdm(json_files):
with open(file, 'r') as f:
data = json.load(f)
if data['weather']['light_fog'] and data['daytime']['day']:
samples.append(os.path.basename(file)[:-5] + '\n')
with open('splits/dense_fog/light_fog.txt', 'w') as f:
f.writelines(samples)
if __name__ == '__main__':
make_dense_list()
# make_light_list()