forked from lazyprogrammer/machine_learning_examples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmake_limited_datasets.py
39 lines (29 loc) · 928 Bytes
/
make_limited_datasets.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
# https://deeplearningcourses.com/c/advanced-computer-vision
# https://www.udemy.com/advanced-computer-vision
import os
def mkdir(p):
if not os.path.exists(p):
os.mkdir(p)
def link(src, dst):
if not os.path.exists(dst):
os.symlink(src, dst, target_is_directory=True)
mkdir('../large_files/fruits-360-small')
classes = [
'Apple Golden 1',
'Avocado',
'Lemon',
'Mango',
'Kiwi',
'Banana',
'Strawberry',
'Raspberry'
]
train_path_from = os.path.abspath('../large_files/fruits-360/Training')
valid_path_from = os.path.abspath('../large_files/fruits-360/Validation')
train_path_to = os.path.abspath('../large_files/fruits-360-small/Training')
valid_path_to = os.path.abspath('../large_files/fruits-360-small/Validation')
mkdir(train_path_to)
mkdir(valid_path_to)
for c in classes:
link(train_path_from + '/' + c, train_path_to + '/' + c)
link(valid_path_from + '/' + c, valid_path_to + '/' + c)