(self, original_image)
return prediction
Arguments:
            original_image (np.ndarray): an image as returned by OpenCV

        Returns:
            prediction (BoxList): the detected objects. Additional information
                of the detection properties can be found in the fields of
                the BoxList via `prediction.fields()`
Arguments:
            original_image (np.ndarray): an image as returned by OpenCV
Arguments : original_image ( np . ndarray ) : an image as returned by OpenCV
def compute_prediction(self, original_image):
        """
        Arguments:
            original_image (np.ndarray): an image as returned by OpenCV

        Returns:
            prediction (BoxList): the detected objects. Additional information
                of the detection properties can be found in the fields of
                the BoxList via `prediction.fields()`
        """
        # apply pre-processing to image
        image = self.transforms(original_image)
        # convert to an ImageList, padded so that it is divisible by
        # cfg.DATALOADER.SIZE_DIVISIBILITY
        image_list = to_image_list(image, self.cfg.DATALOADER.SIZE_DIVISIBILITY)
        image_list = image_list.to(self.device)
        # compute predictions
        height, width = original_image.shape[:-1]
        with torch.no_grad():
            predictions = self.model(image_list)

        predictions = [o.to(self.cpu_device) for o in predictions]
        # always single image is passed at a time
        prediction = predictions[0]
        # reshape prediction (a BoxList) into the original image size
        prediction = prediction.resize((width, height))

        if prediction.has_field("mask"):
            # if we have masks, paste the masks in the right position
            # in the image, as defined by the bounding boxes
            masks = prediction.get_field("mask")
            # always single image is passed at a time
            masks = self.masker([masks], [prediction])[0]
            prediction.add_field("mask", masks)

        if prediction.has_field("ke") and self.cfg.MODEL.KE_ON:
            kes = prediction.get_field("ke")
            mty = prediction.get_field("mty")
            prediction.add_field("ke", kes.kes)
            prediction.add_field("mty", mty)

        return prediction
def compute_prediction ( self , original_image ) : # apply pre-processing to image image = self . transforms ( original_image ) # convert to an ImageList, padded so that it is divisible by # cfg.DATALOADER.SIZE_DIVISIBILITY image_list = to_image_list ( image , self . cfg . DATALOADER . SIZE_DIVISIBILITY ) image_list = image_list . to ( self . device ) # compute predictions height , width = original_image . shape [ : - 1 ] with torch . no_grad ( ) : predictions = self . model ( image_list ) predictions = [ o . to ( self . cpu_device ) for o in predictions ] # always single image is passed at a time prediction = predictions [ 0 ] # reshape prediction (a BoxList) into the original image size prediction = prediction . resize ( ( width , height ) ) if prediction . has_field ( "mask" ) : # if we have masks, paste the masks in the right position # in the image, as defined by the bounding boxes masks = prediction . get_field ( "mask" ) # always single image is passed at a time masks = self . masker ( [ masks ] , [ prediction ] ) [ 0 ] prediction . add_field ( "mask" , masks ) if prediction . has_field ( "ke" ) and self . cfg . MODEL . KE_ON : kes = prediction . get_field ( "ke" ) mty = prediction . get_field ( "mty" ) prediction . add_field ( "ke" , kes . kes ) prediction . add_field ( "mty" , mty ) return prediction