//  [python]
def detect(self, image_data):
        input_image = image_data.asarray().astype('uint8')
        if self._rgb_to_bgr:
            input_image = cv2.cvtColor(input_image, cv2.COLOR_RGB2BGR)
        inputs = torch.from_numpy(input_image).permute(2,0,1).unsqueeze(0).type(torch.float).cuda()
        output = self.model.cuda()(inputs)
        output = self.postprocessors['bbox'](output, torch.Tensor([[1.0, 1.0]]).cuda())[0]
        logits = output['logits']
        scores = output['scores']
        labels = output['labels']
        feats = output['feats']
        bboxes = output['boxes']
        pred_label = [str(int(item)) for item in labels]
        pred_feats = feats  
        test_feats = {}
        for i in range(len(pred_label)):
            label = pred_label[i]
            feats = pred_feats[i]
            if label not in test_feats.keys():
                test_feats[label] = feats.unsqueeze(0)
            else:
                test_feats[label] = torch.cat((test_feats[label], feats.unsqueeze(0)), 0)
        prob_test = []
        test_data = []
        output = DetectedObjectSet()
        if len(test_feats.keys()) == 0:
            return output
        for cls in test_feats.keys():
            test_data.append(test_feats[cls])

        test_data = torch.cat(test_data, dim=0)
        test_data = torch.linalg.norm(test_data, dim=1, ord=self._norm_degree)

        #max_index_test = torch.max(test_data, dim=1).indices
        # convert to kwiver format, apply threshold
        for row in test_data:
            max_value_row = torch.max(row, dim=0).values

            sample_ReScore = self.remax.ReScore(max_value_row)
            if sample_ReScore.isnan().any():
                raise Exception
            prob_test.append(sample_ReScore.view(-1))

        prob_test = torch.cat(prob_test,dim=0)
        names = []
        for bbox, score, novelty_prob, label in zip(bboxes, scores, prob_test, labels):
            class_confidence = float(bbox[-1])
            if score < self._thresh:
                continue
            new_bbox = torch.tensor([bbox[0]*inputs.shape[2], bbox[1]*inputs.shape[3], bbox[2]*inputs.shape[2], bbox[3]*inputs.shape[3]])
            bbox_int = new_bbox.type(torch.int32)
            bounding_box = BoundingBoxD(bbox_int[0], bbox_int[1],
                                        bbox_int[2], bbox_int[3])
            class_name = self._labels[int(label)]
            detected_object_type = DetectedObjectType(class_name, class_confidence)
            detected_object = DetectedObject(bounding_box,
                                             np.max(class_confidence),
                                             detected_object_type)
            detected_object.add_note(":novelty=" + str(novelty_prob.item()))
            output.add(detected_object)

        inds = []
        for score in scores:
            if str(score.item()) in names:
                inds.append(names.index(str(score.item())))
        if labels.size()[0] > 0 and self._display_detections:
            mmcv.imshow_det_bboxes(
                input_image,
                bboxes,
                labels,
                class_names=self._labels,
                score_thr=self._thresh,
                show=True)

        return output