@@ -24,7 +24,7 @@ def parse_files(self, img_dir: str, ann_path: str) -> List:
2424 for img_fname , instance in self .loader (ann_path ):
2525 samples .append ((osp .join (img_dir , img_fname ), instance ))
2626 return samples
27-
27+
2828 def loader (self , file_path : str ):
2929 with open (file_path , 'r' , encoding = 'utf-8' ) as f :
3030 data = json .load (f )
@@ -33,10 +33,11 @@ def loader(self, file_path: str):
3333 instances = list ()
3434 for j in range (len (data ['documents' ][i ]['document' ])):
3535 cur_item = data ['documents' ][i ]['document' ][j ]
36- instance = dict (text = cur_item ['text' ],
37- box = cur_item ['box' ],
38- label = cur_item ['label' ],
39- words = cur_item ['words' ])
36+ instance = dict (
37+ text = cur_item ['text' ],
38+ box = cur_item ['box' ],
39+ label = cur_item ['label' ],
40+ words = cur_item ['words' ])
4041 instances .append (instance )
4142 yield img_fname , instances
4243
@@ -59,11 +60,12 @@ def loader(self, file_path: str):
5960 instances = list ()
6061 for j in range (len (data ['documents' ][i ]['document' ])):
6162 cur_item = data ['documents' ][i ]['document' ][j ]
62- instance = dict (text = cur_item ['text' ],
63- box = cur_item ['box' ],
64- label = cur_item ['label' ],
65- words = cur_item ['words' ],
66- linking = cur_item ['linking' ],
67- id = cur_item ['id' ])
63+ instance = dict (
64+ text = cur_item ['text' ],
65+ box = cur_item ['box' ],
66+ label = cur_item ['label' ],
67+ words = cur_item ['words' ],
68+ linking = cur_item ['linking' ],
69+ id = cur_item ['id' ])
6870 instances .append (instance )
6971 yield img_fname , instances
0 commit comments