MhLiao / DB

A PyTorch implementation of "Real-time Scene Text Detection with Differentiable Binarization".
2.1k stars 479 forks source link

eval(icdar2015) #161

Open 15926273249 opened 4 years ago

15926273249 commented 4 years ago

ValueError: could not convert string to float: '###'

TangDL commented 3 years ago

in data/image_dataset.py def load_ann(self): res = [] for gt in self.gt_paths: lines = [] reader = open(gt, 'r').readlines() for line in reader: item = {} parts = line.strip().split(',') label = parts[-1] if 'TD' in self.data_dir[0] and label == '1': label = '###' line = [i.strip('\ufeff').strip('\xef\xbb\xbf') for i in parts] if 'icdar' in self.data_dir[0]: poly = np.array(list(map(float, line[:8]))).reshape((-1, 2)).tolist() else: num_points = math.floor((len(line) - 1) / 2) * 2 poly = np.array(list(map(float, line[:num_points]))).reshape((-1, 2)).tolist() item['poly'] = poly item['text'] = label lines.append(item) res.append(lines) return res make sure you use the right code to load ann