def METHOD_NAME(
    self, max_num_outputs=math.inf, segment_type="instance"
):
    def visual_filter(masks, labels, segment_type):
        masks = masks.astype(int)
        # H, W = masks.shape[2:]
        # Instead of T/F for each mask, use Class_label/0
        for i, mask in enumerate(masks):
            np.putmask(masks[i], mask, labels[i])
        visuals = self._compute_mode_ignore_zeros(masks)
        return visuals
    assert segment_type in ["instance", "semantic"]
    self.model.eval()
    with torch.no_grad():
        cpu_device = torch.device("cpu")
        visuals = {}
        for num_out_so_far, (images, targets) in enumerate(self.dataloader):
            images = [img.to(self.device) for img in images]
            targets = [
                {k: v.to(self.device) for k, v in t.items()} for t in targets
            ]
            torch.cuda.synchronize()
            outputs = self.model(images)
            outputs = [{k: v.to(cpu_device) for k, v in t.items()} for t in outputs]
            res = {
                target["image_id"].item(): output
                for target, output in zip(targets, outputs)
            }
            rgbs = {
                target["image_id"].item(): images[i]
                for i, target in enumerate(targets)
            }
            for image_id in res:
                masks = res[image_id]["masks"].numpy() >= 0.5
                labels = res[image_id]["labels"].numpy()
                visual = visual_filter(masks, labels, segment_type)
                rgb = rgbs[image_id].cpu().permute(1, 2, 0).numpy()
                visuals[image_id] = (rgb, visual)
            if num_out_so_far + 1 == max_num_outputs:
                break
    return visuals