changed to input ids
Browse files- ref_seg_ger.py +18 -13
ref_seg_ger.py
CHANGED
@@ -248,23 +248,28 @@ class RefSeg(datasets.GeneratorBasedBuilder):
|
|
248 |
else:
|
249 |
continue
|
250 |
|
251 |
-
|
252 |
-
|
253 |
-
|
|
|
|
|
|
|
|
|
|
|
254 |
#split_bboxes = bboxes[index:index + self.CHUNK_SIZE]
|
255 |
# split_rgbs = rgbs[index:index + self.CHUNK_SIZE]
|
256 |
# split_fonts = fonts[index:index + self.CHUNK_SIZE]
|
257 |
-
split_labels =
|
258 |
split_labels_post = [item for sublist in split_labels for item in sublist]
|
259 |
-
if(len(split_ids) != len(split_labels)):
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
for s in split_labels:
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
#print(len(split_labels_post), split_labels_post)
|
269 |
#print(split_labels, len(split_labels))
|
270 |
#print(split_ids, len(split_ids))
|
|
|
248 |
else:
|
249 |
continue
|
250 |
|
251 |
+
clean_input_ids = []
|
252 |
+
clean_labels = []
|
253 |
+
for i, input in enumerate(input_ids):
|
254 |
+
if input != '':
|
255 |
+
clean_input_ids.append(input)
|
256 |
+
clean_labels.append(labels[i])
|
257 |
+
for chunk_id, index in enumerate(range(0, len(clean_input_ids), self.CHUNK_SIZE)):
|
258 |
+
split_ids = clean_input_ids[index:max(len(clean_input_ids), index + self.CHUNK_SIZE)]
|
259 |
#split_bboxes = bboxes[index:index + self.CHUNK_SIZE]
|
260 |
# split_rgbs = rgbs[index:index + self.CHUNK_SIZE]
|
261 |
# split_fonts = fonts[index:index + self.CHUNK_SIZE]
|
262 |
+
split_labels = clean_labels[index:max(len(clean_input_ids), index + self.CHUNK_SIZE)]
|
263 |
split_labels_post = [item for sublist in split_labels for item in sublist]
|
264 |
+
# if(len(split_ids) != len(split_labels)):
|
265 |
+
# print(f)
|
266 |
+
# print(len(input_ids), input_ids)
|
267 |
+
# print(len(split_labels), split_labels)
|
268 |
+
# for s in split_labels:
|
269 |
+
# if type(s) is not str:
|
270 |
+
# print(f)
|
271 |
+
# print(len(input_ids), input_ids)
|
272 |
+
# print(len(split_labels), split_labels)
|
273 |
#print(len(split_labels_post), split_labels_post)
|
274 |
#print(split_labels, len(split_labels))
|
275 |
#print(split_ids, len(split_ids))
|