the code is not working its gives an error
boxes_list = [] for i in range(len(rows)): l=[] for k in range(total_cells): l.append([]) for j in range(len(rows[i])): diff = abs(center-(rows[i][j][0]+rows[i][j][2]/4)) minimum = min(diff) indexing = list(diff).index(minimum) l[indexing].append(rows[i][j]) boxes_list.append(l) for box in boxes_list: print(box)
8 minimum = min(diff) 9 indexing = list(diff).index(minimum) ---> 10 l[indexing].append(rows[i][j]) 11 boxes_list.append(l) 12 for box in boxes_list:
IndexError: list index out of range
Same here! Could you find a solution for it? @Abdullah-000 @Soumi7
this error happens in some specific images. For the example image which is in the repo, there would be no issue!
It is the bug. I fixed these bugs after several hours. 😭
I'm not sure how accurate this is but I swapped out
for i in range(len(row)):
if len(row[i]) > total_cells:
total_cells = len(row[i])
with
total_cells = len(max(rows, key=len))
Basically, taking the max of the cells not the items in each cell.