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

TypeError: init() got an unexpected keyword argument 'first_stride' #63

Closed
Decade-Li opened this issue Jan 30, 2023 · 2 comments
Closed

Comments

@Decade-Li
Copy link

Decade-Li commented Jan 30, 2023

What is the first_stride parameter set when initializing blocks in the Res5ROIHeads class?
image
TypeError: init() got an unexpected keyword argument 'first_stride'
Try to solve:
Convert first_stride=2 to stride_per_block=[2, 1, 1]。
image
But,“TypeError: add(): argument 'alpha' must be Number, not NoneType”.
Then,
image
But,"FloatingPointError: Predicted boxes or scores contain Inf/NaN. Training has diverged."

@Decade-Li Decade-Li changed the title first_stride=2 TypeError: init() got an unexpected keyword argument 'first_stride' Jan 30, 2023
@fkite-cs
Copy link

Hi, i had the same problem when i was trying to run the model.
If you check the logs in the training examples that they have in google drive, you can find this warning:

Screenshot from 2023-01-31 10-03-00

To fix this problem i had to modify detectron2 code https://github.com/facebookresearch/detectron2/blob/58e472e076a5d861fdcf773d9254a3664e045bf8/detectron2/modeling/backbone/resnet.py#L542

Just change "first_stride" key for "stride"

if "first_stride" in list(curr_kwargs.keys()):
    _stride = curr_kwargs["first_stride"]
    del curr_kwargs["first_stride"]
    curr_kwargs["stride"] = _stride

@hairfull
Copy link

hairfull commented Apr 7, 2023

I've met the same question, and solve this by degrading detectron2 to v0.3

This issue was closed.
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

4 participants