-
Notifications
You must be signed in to change notification settings - Fork 3
/
augment.py
39 lines (33 loc) · 1.06 KB
/
augment.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
import sys
from labeller import (
AugmentHelper, PartiallyLabelledDataset,
ask_directory, MessageBox
)
if __name__ == '__main__':
argc = len(sys.argv)
dirname = ()
if argc == 1:
dirname = ask_directory('Select a dataset root directory')
elif argc == 2:
dirname = sys.argv[1]
else:
print('Usage: "{}" or "{} [/path/to/dataset]"'.format(sys.argv[0], sys.argv[0]))
exit(1)
try:
if dirname is not None:
# Load parially labelled dataset
dataset = PartiallyLabelledDataset()
dataset.load(dirname, labelled_only=True)
# Create label helper
helper = AugmentHelper(dataset)
result = helper.mainloop()
# Notify user
if result is not None:
win = MessageBox(
'The augmented dataset is saved at {}'.format(result),
'Finished!'
)
win.mainloop()
except Exception as e:
win = MessageBox(str(e), 'Failure')
win.mainloop()