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

Error NonZero(/rpn/NonZero) when importing faster rcnn from torchvision.models #323

Open
JohnConnor123 opened this issue Jul 8, 2024 · 0 comments

Comments

@JohnConnor123
Copy link

Hello. I tried to port the trained Faster RCNN from torchvision.models to RK3588 (orange pi 5), but I get an error in the photo. When trying to import a model written from scratch (article: https://towardsdatascience.com/understanding-and-implementing-faster-r-cnn-a-step-by-step-guide-11acfff216b0, github with code: https:/ /github.com/wingedrasengan927/pytorch-tutorials/tree/master/Object%20Detection) I get about the same error with the rpn layer. Importing libtorch didn't help. How can I import at least the standard, not fully trained FasterRCNN from torchvision.models? I've been struggling with this problem for over a week now.

My code:

model = torchvision.models.detection.fasterrcnn_resnet50_fpn(pretrained=False, pretrained_backbone=False)
in_features = model.roi_heads.box_predictor.cls_score.in_features
model.roi_heads.box_predictor = FastRCNNPredictor(in_features, 2)
big_model.load_state_dict(torch.load(big_model_path))
big_model.eval()

image

@JohnConnor123 JohnConnor123 changed the title Failure to import faster rcnn from torchhub Failure to import faster rcnn from torchvision.models Jul 8, 2024
@JohnConnor123 JohnConnor123 changed the title Failure to import faster rcnn from torchvision.models Error None Zero(/rpm/NoneZero) when importing faster rcnn from torchvision.models. Jul 8, 2024
@JohnConnor123 JohnConnor123 changed the title Error None Zero(/rpm/NoneZero) when importing faster rcnn from torchvision.models. Error None Zero(/rpm/NoneZero) when importing faster rcnn from torchvision.models Jul 8, 2024
@JohnConnor123 JohnConnor123 changed the title Error None Zero(/rpm/NoneZero) when importing faster rcnn from torchvision.models Error NoneZero(/rpn/NoneZero) when importing faster rcnn from torchvision.models Jul 8, 2024
@JohnConnor123 JohnConnor123 changed the title Error NoneZero(/rpn/NoneZero) when importing faster rcnn from torchvision.models Error NonZero(/rpn/NonZero) when importing faster rcnn from torchvision.models Jul 8, 2024
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