-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheckDataset.py
More file actions
executable file
·40 lines (33 loc) · 1.01 KB
/
checkDataset.py
File metadata and controls
executable file
·40 lines (33 loc) · 1.01 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
import os
sourcefolderpath = os.path.dirname(os.path.abspath(__file__))+"/dataset/"
src_files = os.listdir(sourcefolderpath)
unannotatedImages = 0
defects=["Slubs",
"Barre",
"Thick Yarn",
"Foreign Yarn",
"Missing Line",
"Holes",
"Knots",
"Misknit",
"Dye Spot",
"Crease line/Crush Mark",
"Stains/Dirty",
"Stop marks",
"Snagging",
"Laddering"]
dic={}
for file_name in src_files:
if(file_name[-3:]=="bmp"):
try:
with open(sourcefolderpath+file_name[:-3]+"txt",'r') as f:
for line in f:
if(defects[int(line.split()[0])] not in dic):
dic[defects[int(line.split()[0])]]=1
else:
dic[defects[int(line.split()[0])]]+=1
except FileNotFoundError:
unannotatedImages += 1
print("\nAll data distribution")
print(dic)
print("\nNumber of Images to be annotated : "+ str(unannotatedImages))