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

How to generate the score of a determined label for a determined region of an image using Mask R-CNN #108

Open
mingqiJ opened this issue Dec 20, 2022 · 0 comments

Comments

@mingqiJ
Copy link

mingqiJ commented Dec 20, 2022

I want to change the RegionProposalNetwork of Mask R-CNN to generate the score for a determined region of an image using Mask R-CNN.

import torch
from torch import nn
import torchvision.models as models
import torchvision
from torchvision.models.detection import MaskRCNN
from torchvision.models.detection.anchor_utils import AnchorGenerator

model = models.detection.maskrcnn_resnet50_fpn(pretrained=True)

class rpn_help(nn.Module):
    def __init__(self,) -> None:
        super().__init__()
    def forward(self,) :
        proposals=torch.tensor([ 78.0753,  12.7310, 165.6465, 153.7253])
        proposal_losses=0
        return proposals, proposal_losses

model.rpn= rpn_help
model.eval()
model(input_tensor) # input_tensor is an image

It takes error like this
WeChat2c25a7cb2c1677cda18d2ca820630990

Does anyone know how to generate the score for a determined region of an image using Mask R-CNN
?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant