def METHOD_NAME(self, pred, bitmap, dest_width, dest_height):
    """
    bitmap: single map with shape (H, W), whose values are binarized as {0, 1}
    """
    assert len(bitmap.shape) == 2
    height, width = bitmap.shape
    contours, _ = cv2.findContours(
        (bitmap * 255).astype(np.uint8), cv2.RETR_LIST, cv2.CHAIN_APPROX_SIMPLE)
    num_contours = min(len(contours), self.max_candidates)
    boxes = np.zeros((num_contours, 4, 2), dtype=np.int16)
    scores = np.zeros((num_contours,), dtype=np.float32)
    for index in range(num_contours):
        contour = contours[index].squeeze(1)
        points, sside = self.get_mini_boxes(contour)
        if sside < self.min_size:
            continue
        points = np.array(points)
        score = self.box_score_fast(pred, contour)
        if self.box_thresh > score:
            continue
        box = self.unclip(
            points, unclip_ratio=self.unclip_ratio).reshape(-1, 1, 2)
        box, sside = self.get_mini_boxes(box)
        if sside < self.min_size + 2:
            continue
        box = np.array(box)
        if not isinstance(dest_width, int):
            dest_width = dest_width.item()
            dest_height = dest_height.item()
        box[:, 0] = np.clip(
            np.round(box[:, 0] / width * dest_width), 0, dest_width)
        box[:, 1] = np.clip(
            np.round(box[:, 1] / height * dest_height), 0, dest_height)
        boxes[index, :, :] = box.astype(np.int16)
        scores[index] = score
    return boxes, scores