Loading ballontranslator/dl/textdetector/db_utils.py +5 −5 Original line number Diff line number Diff line Loading @@ -197,10 +197,10 @@ class SegDetectorRepresenter(): def box_score_fast(self, bitmap, _box): h, w = bitmap.shape[:2] box = _box.copy() xmin = np.clip(np.floor(box[:, 0].min()).astype(np.int), 0, w - 1) xmax = np.clip(np.ceil(box[:, 0].max()).astype(np.int), 0, w - 1) ymin = np.clip(np.floor(box[:, 1].min()).astype(np.int), 0, h - 1) ymax = np.clip(np.ceil(box[:, 1].max()).astype(np.int), 0, h - 1) xmin = np.clip(np.floor(box[:, 0].min()).astype(np.int64), 0, w - 1) xmax = np.clip(np.ceil(box[:, 0].max()).astype(np.int64), 0, w - 1) ymin = np.clip(np.floor(box[:, 1].min()).astype(np.int64), 0, h - 1) ymax = np.clip(np.ceil(box[:, 1].max()).astype(np.int64), 0, h - 1) mask = np.zeros((ymax - ymin + 1, xmax - xmin + 1), dtype=np.uint8) box[:, 0] = box[:, 0] - xmin Loading Loading @@ -465,7 +465,7 @@ class QuadMetric(): for i in range(pred_polygons.shape[0]): if pred_scores[i] >= box_thresh: # print(pred_polygons[i,:,:].tolist()) pred.append(dict(points=pred_polygons[i, :, :].astype(np.int))) pred.append(dict(points=pred_polygons[i, :, :].astype(np.int64))) # pred = [dict(points=pred_polygons[i,:,:].tolist()) if pred_scores[i] >= box_thresh for i in range(pred_polygons.shape[0])] results.append(self.evaluator.evaluate_image(gt, pred)) return results Loading ballontranslator/ui/scenetext_manager.py +1 −1 Original line number Diff line number Diff line Loading @@ -589,7 +589,7 @@ class SceneTextManager(QObject): def onEndCreateTextBlock(self, rect: QRectF): if rect.width() > 1 and rect.height() > 1: xyxy = np.array([rect.x(), rect.y(), rect.right(), rect.bottom()]) xyxy = np.round(xyxy).astype(np.int) xyxy = np.round(xyxy).astype(np.int32) block = TextBlock(xyxy) xywh = np.copy(xyxy) xywh[[2, 3]] -= xywh[[0, 1]] Loading ballontranslator/utils/stroke_width_calculator.py +1 −1 Original line number Diff line number Diff line Loading @@ -105,7 +105,7 @@ def strokewidth_check(text_mask, labels, num_labels, stats, debug_type=0): mean_area = np.mean(stats[ma][:, 4]) false_labels = np.where(rays_width[:, 1] > 2*mean_width)[0] false_labels = rays_width[false_labels, 0].astype(np.int) false_labels = rays_width[false_labels, 0].astype(np.int32) for fl in false_labels: if stats[fl][4] > 2 * mean_area: text_mask[np.where(labels==fl)] = 0 Loading Loading
ballontranslator/dl/textdetector/db_utils.py +5 −5 Original line number Diff line number Diff line Loading @@ -197,10 +197,10 @@ class SegDetectorRepresenter(): def box_score_fast(self, bitmap, _box): h, w = bitmap.shape[:2] box = _box.copy() xmin = np.clip(np.floor(box[:, 0].min()).astype(np.int), 0, w - 1) xmax = np.clip(np.ceil(box[:, 0].max()).astype(np.int), 0, w - 1) ymin = np.clip(np.floor(box[:, 1].min()).astype(np.int), 0, h - 1) ymax = np.clip(np.ceil(box[:, 1].max()).astype(np.int), 0, h - 1) xmin = np.clip(np.floor(box[:, 0].min()).astype(np.int64), 0, w - 1) xmax = np.clip(np.ceil(box[:, 0].max()).astype(np.int64), 0, w - 1) ymin = np.clip(np.floor(box[:, 1].min()).astype(np.int64), 0, h - 1) ymax = np.clip(np.ceil(box[:, 1].max()).astype(np.int64), 0, h - 1) mask = np.zeros((ymax - ymin + 1, xmax - xmin + 1), dtype=np.uint8) box[:, 0] = box[:, 0] - xmin Loading Loading @@ -465,7 +465,7 @@ class QuadMetric(): for i in range(pred_polygons.shape[0]): if pred_scores[i] >= box_thresh: # print(pred_polygons[i,:,:].tolist()) pred.append(dict(points=pred_polygons[i, :, :].astype(np.int))) pred.append(dict(points=pred_polygons[i, :, :].astype(np.int64))) # pred = [dict(points=pred_polygons[i,:,:].tolist()) if pred_scores[i] >= box_thresh for i in range(pred_polygons.shape[0])] results.append(self.evaluator.evaluate_image(gt, pred)) return results Loading
ballontranslator/ui/scenetext_manager.py +1 −1 Original line number Diff line number Diff line Loading @@ -589,7 +589,7 @@ class SceneTextManager(QObject): def onEndCreateTextBlock(self, rect: QRectF): if rect.width() > 1 and rect.height() > 1: xyxy = np.array([rect.x(), rect.y(), rect.right(), rect.bottom()]) xyxy = np.round(xyxy).astype(np.int) xyxy = np.round(xyxy).astype(np.int32) block = TextBlock(xyxy) xywh = np.copy(xyxy) xywh[[2, 3]] -= xywh[[0, 1]] Loading
ballontranslator/utils/stroke_width_calculator.py +1 −1 Original line number Diff line number Diff line Loading @@ -105,7 +105,7 @@ def strokewidth_check(text_mask, labels, num_labels, stats, debug_type=0): mean_area = np.mean(stats[ma][:, 4]) false_labels = np.where(rays_width[:, 1] > 2*mean_width)[0] false_labels = rays_width[false_labels, 0].astype(np.int) false_labels = rays_width[false_labels, 0].astype(np.int32) for fl in false_labels: if stats[fl][4] > 2 * mean_area: text_mask[np.where(labels==fl)] = 0 Loading