(self, image, predictions)
return image
Adds the predicted boxes on top of the image

        Arguments:
            image (np.ndarray): an image as returned by OpenCV
            predictions (BoxList): the result of the computation by the model.
                It should contain the field `labels`.
Adds the predicted boxes on top of the image
Adds the predicted boxes on top of the image
def overlay_boxes(self, image, predictions):
        """
        Adds the predicted boxes on top of the image

        Arguments:
            image (np.ndarray): an image as returned by OpenCV
            predictions (BoxList): the result of the computation by the model.
                It should contain the field `labels`.
        """
        labels = predictions.get_field("labels")
        boxes = predictions.bbox

        colors = self.compute_colors_for_labels(labels).tolist()

        for box, color in zip(boxes, colors):
            box = box.to(torch.int64)
            top_left, bottom_right = box[:2].tolist(), box[2:].tolist()
            # tuple(color)
            image = cv2.rectangle(
                image, tuple(top_left), tuple(bottom_right), (255,255,0), 2
            )

        return image
def overlay_boxes ( self , image , predictions ) : labels = predictions . get_field ( "labels" ) boxes = predictions . bbox colors = self . compute_colors_for_labels ( labels ) . tolist ( ) for box , color in zip ( boxes , colors ) : box = box . to ( torch . int64 ) top_left , bottom_right = box [ : 2 ] . tolist ( ) , box [ 2 : ] . tolist ( ) # tuple(color) image = cv2 . rectangle ( image , tuple ( top_left ) , tuple ( bottom_right ) , ( 255 , 255 , 0 ) , 2 ) return image