From 08d7d8c13053ea2aa4c5b33f966b6e5927bcf696 Mon Sep 17 00:00:00 2001 From: Ben Hoff Date: Wed, 3 Jul 2019 08:53:36 -0400 Subject: [PATCH] Fixed Pixel Link interp file API issues (#544) --- .../0001/pixel_link_mobilenet_v2.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/utils/open_model_zoo/Retail/object_detection/text/pixel_link_mobilenet_v2/0001/pixel_link_mobilenet_v2.py b/utils/open_model_zoo/Retail/object_detection/text/pixel_link_mobilenet_v2/0001/pixel_link_mobilenet_v2.py index 7c2ede3b78a..77297cabdb1 100644 --- a/utils/open_model_zoo/Retail/object_detection/text/pixel_link_mobilenet_v2/0001/pixel_link_mobilenet_v2.py +++ b/utils/open_model_zoo/Retail/object_detection/text/pixel_link_mobilenet_v2/0001/pixel_link_mobilenet_v2.py @@ -3,9 +3,7 @@ class PixelLinkDecoder(): - def __init__(self, height, width): - self.image_height = height - self.image_width = width + def __init__(self): four_neighbours = False if four_neighbours: self._get_neighbours = self._get_neighbours_4 @@ -14,7 +12,9 @@ def __init__(self, height, width): self.pixel_conf_threshold = 0.8 self.link_conf_threshold = 0.8 - def decode(self, detections: dict): + def decode(self, height, width, detections: dict): + self.image_height = height + self.image_width = width self.pixel_scores = self._set_pixel_scores(detections['pixel_cls/add_2']) self.link_scores = self._set_link_scores(detections['pixel_link/add_2']) @@ -131,7 +131,6 @@ def _get_neighbours_4(self, x, y): return [i for i in tmp if i[1] >= 0 and i[1] < w and i[2] >= 0 and i[2] < h] def _mask_to_bboxes(self, min_area=300, min_height=10): - image_h, image_w = self.image_shape self.bboxes = [] max_bbox_idx = self.mask.max() mask_tmp = cv2.resize(self.mask, (self.image_width, self.image_height), interpolation=cv2.INTER_NEAREST)