Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No pred_mask in the predictor output #5070

Closed
vishakhalall opened this issue Aug 25, 2023 · 2 comments
Closed

No pred_mask in the predictor output #5070

vishakhalall opened this issue Aug 25, 2023 · 2 comments
Labels
invalid/unrelated unrelated to this project or invalid type of issues needs-more-info More info is needed to complete the issue

Comments

@vishakhalall
Copy link

I am using this to evaluate a trained model on some test images

from detectron2.config import get_cfg
from detectron2.utils.visualizer import Visualizer, ColorMode
from detectron2.engine import DefaultTrainer, DefaultPredictor

cfg.MODEL.WEIGHTS = f"model_final.pth" 
cfg.MODEL.ROI_HEADS.SCORE_THRESH_TEST = 0.75
predictor = DefaultPredictor(cfg)

test_dir = "DetectronDataset/val/images"
for im_p in os.listdir(test_dir):
    im = cv2.imread(f"{test_dir}/{im_p}")
    outputs = predictor(im)  
    v = Visualizer(im,metadata=test_metadata,instance_mode=ColorMode.IMAGE)
    out = v.draw_instance_predictions(outputs["instances"].to("cpu"))
    img = out.get_image()
    print(outputs["instances"])
    cv2.imwrite(f'{output_dir}/{im_p}', out.get_image())

However I noticed that the images do not have the segmentation masks. I tried printing the output of the model and got the following

Instances(num_instances=5, image_height=1280, image_width=720, fields=[pred_boxes: Boxes(tensor([[153.3457, 113.8107, 453.8591, 560.3398],
        [ 77.2884, 298.6120, 624.6890, 489.1781],
        [253.5901,  62.7516, 565.4692, 625.5353],
        [367.0150, 172.0205, 574.5746, 541.7480],
        [ 61.4621,  25.3327, 696.5031, 629.1113]], device='cuda:0')), scores: tensor([0.8329, 0.8182, 0.8029, 0.7972, 0.7571], device='cuda:0'), pred_classes: tensor([0, 0, 0, 0, 0], device='cuda:0')])

As observed, there is no pred_masks in the output. I'm not sure why.

@github-actions
Copy link

You've chosen to report an unexpected problem or bug. Unless you already know the root cause of it, please include details about it by filling the issue template.
The following information is missing: "Instructions To Reproduce the Issue and Full Logs"; "Your Environment";

@github-actions github-actions bot added the needs-more-info More info is needed to complete the issue label Aug 25, 2023
@github-actions
Copy link

github-actions bot commented Sep 2, 2023

Requested information was not provided in 7 days, so we're closing this issue.

Please open new issue if information becomes available. Otherwise, use github discussions for free-form discussions.

@github-actions github-actions bot closed this as completed Sep 2, 2023
@github-actions github-actions bot added the invalid/unrelated unrelated to this project or invalid type of issues label Sep 2, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 28, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
invalid/unrelated unrelated to this project or invalid type of issues needs-more-info More info is needed to complete the issue
Projects
None yet
Development

No branches or pull requests

1 participant