Ejemplo n.º 1
0
 def _to_original_scale(boxes):
     minmax_boxes = to_minmax(boxes)
     minmax_boxes[:, 0] *= self.output_width
     minmax_boxes[:, 2] *= self.output_width
     minmax_boxes[:, 1] *= self.output_height
     minmax_boxes[:, 3] *= self.output_height
     return minmax_boxes.astype(np.int)
Ejemplo n.º 2
0
 def _to_original_scale(boxes):
     minmax_boxes = to_minmax(boxes)
     minmax_boxes[:, 0] *= 224
     minmax_boxes[:, 2] *= 224
     minmax_boxes[:, 1] *= 224
     minmax_boxes[:, 3] *= 224
     return minmax_boxes.astype(np.int)
Ejemplo n.º 3
0
    def detect(self, image, anchors, net_size=416):
        image_h, image_w, _ = image.shape
        new_image = preprocess_input(image, net_size)
        # 3. predict
        yolos = self.predict(new_image)
        boxes_ = postprocess_ouput(yolos, anchors, net_size, image_h, image_w)

        if len(boxes_) > 0:
            boxes, probs = boxes_to_array(boxes_)
            boxes = to_minmax(boxes)
            labels = np.array([b.get_label() for b in boxes_])
        else:
            boxes, labels, probs = [], [], []
        return boxes, labels, probs