File size: 1,324 Bytes
07444d1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
from pathlib import Path
from Checker import Checker
from Printer import Printer
import sys
from os import listdir
from os.path import isfile, join

if len(sys.argv) != 2:
    print('The program must receive the path to the directory as a argument')
    sys.exit(0)
pathRoot = sys.argv[1]

files = [f for f in listdir(pathRoot) if isfile(join(pathRoot, f)) and f[-4:] == '.txt']

subset_filenames = list()

for file in files:
    with open(join(pathRoot, file)) as f:
        ids = f.readlines()
        subset_filenames.extend([id.strip() for id in ids])

checker = Checker(pathRoot)
dictImgsLabels, withoutMarcation, inexistentFiles = checker.check(pathRoot)
printer = Printer()

print("Images without labels in the JSons. Total: ", len(withoutMarcation))
for wm in withoutMarcation:
    print(wm)

print("Images in the JSons that does not exist. Total: ", len(inexistentFiles))
for inex in inexistentFiles:
    print(inex)

print('PRESS Q TO EXIT.')
print(subset_filenames)
printer.print(pathRoot, dictImgsLabels, subset_filenames)


#cv2.namedWindow('image', cv2.WINDOW_NORMAL)
#for path in pathImgs:
#    print(path.as_posix())
#    img = cv2.imread(path.as_posix())
#    cv2.imshow('image',img)
#    k = cv2.waitKey(0)
#    if k == ord('q'): # wait for 's' key to save and exit
#        break

#cv2.destroyAllWindows()