khaclinh commited on
Commit
a773fc3
·
1 Parent(s): 4baf9cf

Update testdata.py

Browse files
Files changed (1) hide show
  1. testdata.py +2 -2
testdata.py CHANGED
@@ -109,10 +109,10 @@ class TestData(datasets.GeneratorBasedBuilder):
109
  img_path = os.path.join(image_dir, img_relative_path)
110
 
111
  annotation = defaultdict(list)
112
- with open(gt_file, 'r') as f:
113
  line = f.readline().strip()
114
  while line:
115
- assert re.match(r'^\d( [\d\.]+){4,5}$', line), 'Incorrect line: %s' % line
116
  cls, cx, cy, w, h = line.split()[:5]
117
  cls, cx, cy, w, h = int(cls), float(cx), float(cy), float(w), float(h)
118
  x1, y1, x2, y2 = cx - w / 2, cy - h / 2, cx + w / 2, cy + h / 2
 
109
  img_path = os.path.join(image_dir, img_relative_path)
110
 
111
  annotation = defaultdict(list)
112
+ with open(gt_file, "r", encoding="utf-8") as f:
113
  line = f.readline().strip()
114
  while line:
115
+ assert re.match(r"^\d( [\d\.]+){4,5}$", line), "Incorrect line: %s" % line
116
  cls, cx, cy, w, h = line.split()[:5]
117
  cls, cx, cy, w, h = int(cls), float(cx), float(cy), float(w), float(h)
118
  x1, y1, x2, y2 = cx - w / 2, cy - h / 2, cx + w / 2, cy + h / 2