khaclinh commited on
Commit
d6b27ea
·
1 Parent(s): 08fb141

Update testdata.py

Browse files
Files changed (1) hide show
  1. testdata.py +3 -9
testdata.py CHANGED
@@ -102,17 +102,11 @@ class TestData(datasets.GeneratorBasedBuilder):
102
  files = []
103
 
104
  idx = 0
105
-
106
  for img_file in glob(os.path.join(image_dir, "*.png")):
 
 
107
 
108
- d = { image_dir: "", ".png": ""}
109
- gt_path = img_file
110
- for i, j in d.items():
111
- gt_path = gt_path.replace(i, j)
112
- faces = []
113
- plates = []
114
-
115
- gt_path = os.path.join(annotation_dir, gt_path, ".txt")
116
 
117
  annotation = defaultdict(list)
118
  with open(gt_path, 'r') as f:
 
102
  files = []
103
 
104
  idx = 0
 
105
  for img_file in glob(os.path.join(image_dir, "*.png")):
106
+ img_relative_file = os.path.relpath(img_file, image_dir)
107
+ gt_relative_path = img_relative_file.replace("png", "txt")
108
 
109
+ gt_path = os.path.join(annotation_dir, gt_relative_path)
 
 
 
 
 
 
 
110
 
111
  annotation = defaultdict(list)
112
  with open(gt_path, 'r') as f: