def get_labels(self, gt_tables):
labels = np.zeros(len(self.candidates))<EOL>for i, candidate in enumerate(self.candidates):<EOL><INDENT>page_num = candidate[<NUM_LIT:0>]<EOL>try:<EOL><INDENT>tables = gt_tables[page_num]<EOL>for gt_table in tables:<EOL><INDENT>page_width, page_height, y0, x0, y1, x1 = gt_table<EOL>w_ratio = float(candidate[<NUM_LIT:1>]) / page_width<EOL>h_ratio = float(candidate[<NUM_LIT:2>]) / page_height<EOL>rescaled_gt_table = (<EOL>y0 * h_ratio,<EOL>x0 * w_ratio,<EOL>y1 * h_ratio,<EOL>x1 * w_ratio,<EOL>)<EOL>iou = compute_iou(candidate[-<NUM_LIT:4>:], rescaled_gt_table)<EOL>if iou > self.iou_thresh:<EOL><INDENT>labels[i] = <NUM_LIT:1><EOL><DEDENT><DEDENT><DEDENT>except KeyError:<EOL><INDENT>pass<EOL><DEDENT><DEDENT>return labels<EOL>
:param gt_tables: dict, keys are page number and values are list of
                  tables bbox within that page
:return: