This repository contains the code and implementation details of the CascadeTabNet paper "CascadeTabNet: An approach for end to end table detection and structure recognition from image-based documents"
MIT License
1.46k
stars
422
forks
source link
in blessFunc.py borderless ,why cur_cell=-1?how to fix this error? #183
In blessFunc.py borderless,Icame across this error:
MergedBoxes = []
for cellrow in cellBoxes2BeMerged:
cellrow = sorted(cellrow,key=lambda x: x[0])
cur_cell = -1
for c,cell in enumerate(cellrow):
if(cur_cell == -1):
cur_cell = cell
continue
if(len(cellrow)==1):
MergedBoxes.append(cell)
break
if(abs((cur_cell[0]+cur_cell[2])-cell[0]) < 10):
cur_cell[2] = cur_cell[2] + cell[2] + (cell[0]- (cur_cell[0]+cur_cell[2]))
if(cur_cell[3]<cell[3]):
cur_cell[3]=cell[3]
else:
cur_cell[2] = cur_cell[0]+cur_cell[2]
cur_cell[3] = cur_cell[1]+cur_cell[3]
MergedBoxes.append(cur_cell)
cur_cell = cell
cur_cell[2] = cur_cell[0]+cur_cell[2]
发生异常: TypeError
'int' object is not subscriptable
File "/home/mdisk1/tanjunwen/CascadeTabNet/Table_Structure_Recognition/Functions/blessFunc.py", line 260, in borderless
cur_cell[2] = cur_cell[0]+cur_cell[2]
File "/home/mdisk1/tanjunwen/CascadeTabNet/Table_Structure_Recognition/myown_infer.py", line 104, in
root.append(borderless(res,cv2.imread(filepath),res_cell))
TypeError: 'int' object is not subscriptable
what do it mean when cur_cell=-1? While I train and infer on my own dataset iFLYTAB,about 10% samples will raise this error,I just ignore these samples now.Could you please tell me how to fix this error??
In blessFunc.py borderless,Icame across this error: MergedBoxes = [] for cellrow in cellBoxes2BeMerged: cellrow = sorted(cellrow,key=lambda x: x[0]) cur_cell = -1 for c,cell in enumerate(cellrow): if(cur_cell == -1): cur_cell = cell continue if(len(cellrow)==1): MergedBoxes.append(cell) break if(abs((cur_cell[0]+cur_cell[2])-cell[0]) < 10): cur_cell[2] = cur_cell[2] + cell[2] + (cell[0]- (cur_cell[0]+cur_cell[2])) if(cur_cell[3]<cell[3]): cur_cell[3]=cell[3] else: cur_cell[2] = cur_cell[0]+cur_cell[2] cur_cell[3] = cur_cell[1]+cur_cell[3] MergedBoxes.append(cur_cell) cur_cell = cell cur_cell[2] = cur_cell[0]+cur_cell[2] 发生异常: TypeError 'int' object is not subscriptable File "/home/mdisk1/tanjunwen/CascadeTabNet/Table_Structure_Recognition/Functions/blessFunc.py", line 260, in borderless cur_cell[2] = cur_cell[0]+cur_cell[2] File "/home/mdisk1/tanjunwen/CascadeTabNet/Table_Structure_Recognition/myown_infer.py", line 104, in
root.append(borderless(res,cv2.imread(filepath),res_cell))
TypeError: 'int' object is not subscriptable
what do it mean when cur_cell=-1? While I train and infer on my own dataset iFLYTAB,about 10% samples will raise this error,I just ignore these samples now.Could you please tell me how to fix this error??