-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcareate_testing_dataset.py
More file actions
96 lines (66 loc) · 2.07 KB
/
careate_testing_dataset.py
File metadata and controls
96 lines (66 loc) · 2.07 KB
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
import os
import shutil
import random
# nondecimadatasetpath = '/media/mayur/Projects/Cobra/MayurRD/KerasDemo/BillAddedData/training-images/9/'
# pathtoCopy = 'Dataset/training-images/nondecimal/'
#
# print('before no decimal dataset length',len(os.listdir(pathtoCopy)))
#
# imagelist = os.listdir(nondecimadatasetpath)
#
#
# for i in range(100):
# #make random choice
# randomIndex = random.randint(1,len(os.listdir(nondecimadatasetpath)))
#
# if(not os.path.exists(pathtoCopy+imagelist[randomIndex])):
# shutil.copy(os.path.join(nondecimadatasetpath,imagelist[randomIndex]), pathtoCopy)
# else :
# i -=1 #decreasing counter
#
# print('after no decimal dataset length', len(os.listdir(pathtoCopy)))
#
#
#
#
#
# path = 'Dataset/training-images'
#
#
# decimalpath, non_decimalpath = os.listdir(path)
#Decimal class
# decimalfiles = os.path.join(path, decimalpath)
#
# decimalImagesList = os.listdir(decimalfiles)
#
# decimalfilesTestingLimit = int(len(decimalImagesList) * 0.2)
# print('Testing DECIMAL ', decimalfilesTestingLimit)
#
# for i in range(decimalfilesTestingLimit):
# #make random choice
# randomIndex = random.randint(1,len(decimalImagesList))
#
# if(not os.path.exists('Dataset/testing-images/'+decimalpath+'/'+decimalImagesList[randomIndex])):
# shutil.move(os.path.join(decimalfiles,decimalImagesList[randomIndex]), 'Dataset/testing-images/'+decimalpath)
# else :
# i -=1 #decreasing counter
#
# #Non decimal class
#
# nondecimalfiles = os.path.join(path, non_decimalpath)
#
# nondecimalList = os.listdir(nondecimalfiles)
#
# nondecimalLimit = int(len(nondecimalList) * 0.2)
# print('Testing NON-DECIMAL ', nondecimalLimit)
#
# for j in range(nondecimalLimit):
# nonRandomIndex = random.randint(1, len(nondecimalList))
#
# if( not os.path.exists('Dataset/testing-images/'+non_decimalpath+'/'+nondecimalList[nonRandomIndex])):
# shutil.move(os.path.join(nondecimalfiles,nondecimalList[nonRandomIndex]), 'Dataset/testing-images/'+non_decimalpath)
# else:
# j -=1
#
#
# print('Done !!')