-
Notifications
You must be signed in to change notification settings - Fork 1
/
meta.py
26 lines (22 loc) · 869 Bytes
/
meta.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
import json
class Meta(object):
def __init__(self):
self.num_train_examples = None
self.num_val_examples = None
self.num_test_examples = None
def save(self, path_to_json_file):
with open(path_to_json_file, 'w') as f:
content = {
'num_examples': {
'train': self.num_train_examples,
'val': self.num_val_examples,
'test': self.num_test_examples
}
}
json.dump(content, f)
def load(self, path_to_json_file):
with open(path_to_json_file, 'r') as f:
content = json.load(f)
self.num_train_examples = content['num_examples']['train']
self.num_val_examples = content['num_examples']['val']
self.num_test_examples = content['num_examples']['test']