Initial commit
Browse files- docbank.py +4 -4
docbank.py
CHANGED
|
@@ -172,7 +172,7 @@ class Docbank(datasets.GeneratorBasedBuilder):
|
|
| 172 |
data_dir = dl_manager.download_and_extract(urls)
|
| 173 |
#print(data_dir)
|
| 174 |
train_txts = glob(data_dir['train'] + '/train/txt/*.csv')
|
| 175 |
-
print(train_txts[0])
|
| 176 |
train_data = [(txt, data_dir['train'] + '/train/img/' + os.path.basename(txt)[:-4] + '.jpg') for txt in train_txts]
|
| 177 |
test_txts = glob(data_dir['test'] + '/test/txt/*.csv')
|
| 178 |
test_data = [(txt, data_dir['test'] + '/test/img/' + os.path.basename(txt)[:-4] + '.jpg') for txt in test_txts]
|
|
@@ -222,7 +222,7 @@ class Docbank(datasets.GeneratorBasedBuilder):
|
|
| 222 |
# print(filepath)
|
| 223 |
key = 0
|
| 224 |
for f_fp_txt, f_fp_img in filepath:
|
| 225 |
-
print(f_fp_txt)
|
| 226 |
f_id = key
|
| 227 |
#f_fp_txt = f['filepath_txt']
|
| 228 |
#f_fp_img = f['filepath_img']
|
|
@@ -238,9 +238,9 @@ class Docbank(datasets.GeneratorBasedBuilder):
|
|
| 238 |
|
| 239 |
try:
|
| 240 |
with open(f_fp_txt, encoding='utf-8') as csvfile:
|
| 241 |
-
reader = csv.
|
| 242 |
for row in reader:
|
| 243 |
-
print(row)
|
| 244 |
# normalized_bbox = normalize_bbox(row[1:5], size)
|
| 245 |
normalized_bbox = [int(x) for x in row[1:5]]
|
| 246 |
tokens.append(row[0])
|
|
|
|
| 172 |
data_dir = dl_manager.download_and_extract(urls)
|
| 173 |
#print(data_dir)
|
| 174 |
train_txts = glob(data_dir['train'] + '/train/txt/*.csv')
|
| 175 |
+
#print(train_txts[0])
|
| 176 |
train_data = [(txt, data_dir['train'] + '/train/img/' + os.path.basename(txt)[:-4] + '.jpg') for txt in train_txts]
|
| 177 |
test_txts = glob(data_dir['test'] + '/test/txt/*.csv')
|
| 178 |
test_data = [(txt, data_dir['test'] + '/test/img/' + os.path.basename(txt)[:-4] + '.jpg') for txt in test_txts]
|
|
|
|
| 222 |
# print(filepath)
|
| 223 |
key = 0
|
| 224 |
for f_fp_txt, f_fp_img in filepath:
|
| 225 |
+
#print(f_fp_txt)
|
| 226 |
f_id = key
|
| 227 |
#f_fp_txt = f['filepath_txt']
|
| 228 |
#f_fp_img = f['filepath_img']
|
|
|
|
| 238 |
|
| 239 |
try:
|
| 240 |
with open(f_fp_txt, encoding='utf-8') as csvfile:
|
| 241 |
+
reader = csv.DictReader(csvfile, delimiter=',')
|
| 242 |
for row in reader:
|
| 243 |
+
#print(row)
|
| 244 |
# normalized_bbox = normalize_bbox(row[1:5], size)
|
| 245 |
normalized_bbox = [int(x) for x in row[1:5]]
|
| 246 |
tokens.append(row[0])
|