(self, image, predictions, ext)
return image
Adds detected class names and scores in the positions defined by the
        top-left corner of the predicted bounding box

        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 `scores` and `labels`.
Adds detected class names and scores in the positions defined by the
        top-left corner of the predicted bounding box
Adds detected class names and scores in the positions defined by the top - left corner of the predicted bounding box
def overlay_class_names(self, image, predictions, ext):
        """
        Adds detected class names and scores in the positions defined by the
        top-left corner of the predicted bounding box

        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 `scores` and `labels`.
        """
        scores = predictions.get_field("scores").tolist()
        labels = predictions.get_field("labels").tolist()
        labels = [self.CATEGORIES[i] for i in labels]
        boxes = predictions.bbox

        template = "{}: {:.2f}"
        for box, score, label in zip(boxes, scores, labels):
            x, y = box[:2]
            s = template.format(ext, score)
            if ext == 'c':
                cv2.putText(
                    image, s, (x, y), cv2.FONT_HERSHEY_SIMPLEX, .5, (255, 255, 0), 1
                )
            elif ext == 't':
                cv2.putText(
                    image, s, (x, y), cv2.FONT_HERSHEY_SIMPLEX, .5, (0, 0, 255), 1
                )

        return image
def overlay_class_names ( self , image , predictions , ext ) : scores = predictions . get_field ( "scores" ) . tolist ( ) labels = predictions . get_field ( "labels" ) . tolist ( ) labels = [ self . CATEGORIES [ i ] for i in labels ] boxes = predictions . bbox template = "{}: {:.2f}" for box , score , label in zip ( boxes , scores , labels ) : x , y = box [ : 2 ] s = template . format ( ext , score ) if ext == 'c' : cv2 . putText ( image , s , ( x , y ) , cv2 . FONT_HERSHEY_SIMPLEX , .5 , ( 255 , 255 , 0 ) , 1 ) elif ext == 't' : cv2 . putText ( image , s , ( x , y ) , cv2 . FONT_HERSHEY_SIMPLEX , .5 , ( 0 , 0 , 255 ) , 1 ) return image