khaclinh commited on
Commit
ee47538
1 Parent(s): 601ec3c

Update testdata.py

Browse files
Files changed (1) hide show
  1. testdata.py +5 -6
testdata.py CHANGED
@@ -104,12 +104,11 @@ class TestData(datasets.GeneratorBasedBuilder):
104
 
105
  idx = 0
106
  for i_file in glob(os.path.join(image_dir, "*.png")):
107
-
108
- d = { image_dir: annotation_dir, "png": "txt"}
109
- gt_path = i_file
110
- for i, j in d.items():
111
- gt_path = gt_path.replace(i, j)
112
-
113
  yield idx, {"image": i_file, "path": i_file, "gt_path": gt_path}
114
 
115
  idx += 1
 
104
 
105
  idx = 0
106
  for i_file in glob(os.path.join(image_dir, "*.png")):
107
+ img_relative_file = os.path.relpath(i_file, image_dir)
108
+ gt_relative_path = img_relative_file.replace(".png", ".txt")
109
+
110
+ gt_path = os.path.join(annotation_dir, gt_relative_path)
111
+
 
112
  yield idx, {"image": i_file, "path": i_file, "gt_path": gt_path}
113
 
114
  idx += 1