Visual-Template-Free-Form-Parsing
Visual-Template-Free-Form-Parsing copied to clipboard
while run the eval.py of detector on the test data ,why need the json of test data ?
this is my order: -c min_saved/detector/checkpoint-latest.pth -g 0 -n 1 -d output -T but to run test data , why need the json data
They are giving metrics to show how good their model is. I wrote a small script to populate the jsons in the NAF_ data/NAF_dataset/groups
directory.
import os
import json
import sys
data = {}
dir_names = sys.argv[1:]
current_dir = os.getcwd()
test = {}
for dir_name in dir_names:
files = os.listdir(dir_name)
imgs = [x for x in files if ('.jpg' in x) or ('.png' in x)]
test[dir_name]=[]
for img_name in imgs:
test[dir_name].append(img_name)
with open(os.path.join(current_dir,dir_name,img_name[:-4]+'.json'),'w') as f:
f.write('{"textBBs":[],"fieldBBs":[],"pairs":[]}')
data["test"]=test
data["train"]={}
data["val"]={}
print(data)
with open('../train_valid_test_split.json','w') as json_file:
json.dump(data,json_file,indent=4)
Just run the above with the directory names as arguments while in the data/NAF_dataset/groups/
directory. But you are right, there can be an option of not supplying the jsons at all.
Thanks for your reply There is an option of specifying the image name,but it can't run While load test data ,the dataset is None.Since the function of test images without json is not developed
Yes, You can perhaps add that feature. For now though, if you wish to run the detector model on say multiple images in folders, you can use the code I provided above. It generates the json without bounding boxes and places it where required. It is only a workaround though, I agree.