IAM ReCTS

This commit is contained in:
echo840
2023-06-09 10:29:18 +08:00
parent 3c59897aa6
commit e22b12b169
185 changed files with 294244 additions and 22 deletions

4
datasets/process/process_ESTVQA.py Normal file → Executable file
View File

@@ -5,8 +5,8 @@ def has_chinese_characters(string):
pattern = re.compile(r'[\u4e00-\u9fa5]')
return bool(pattern.search(string))
if __name__ == "__main__":
ann_file = "/home/zhangli/GPT4/MutimodelOCR/data/ESTVQA/annotations/train.json"
img_file = "/home/zhangli/GPT4/MutimodelOCR/data/ESTVQA/images/train"
ann_file = "/home/zhangli/OCRData/data/TextVQA/ESTVQA/annotations/train.json"
#img_file = "/home/zhangli/GPT4/MutimodelOCR/data/ESTVQA/images/train"
cn_list = []
en_list= []
with open(ann_file,'r') as f:

0
datasets/process/process_FUNSD.py Normal file → Executable file
View File

View File

@@ -0,0 +1,23 @@
import re
import os
def has_chinese_characters(string):
pattern = re.compile(r'[\u4e00-\u9fa5]')
return bool(pattern.search(string))
def is_all_chinese(text):
"""
判断一个字符串是否仅仅包含中文
"""
pattern = re.compile(r'^[\u4e00-\u9fa5]+$')
return pattern.match(text) is not None
if __name__ =='__main__':
file_path = "/home/zhangli/GPT4/MutimodelOCR/data/ReCTS/annotation.txt"
out = open("/home/zhangli/GPT4/MutimodelOCR/data/ReCTS/ann.txt",'w')
with open(file_path, 'r') as file:
data = file.readlines()
for line in data:
text = line.strip().split()[1]
path = os.path.join("/home/zhangli/GPT4/MutimodelOCR/data/ReCTS/crops",line.strip().split()[0])
if is_all_chinese(text) and os.path.exists(path):
out.write(line.strip())
out.write('\n')
out.close()