er-muyue / DeFRCN

MIT License
181 stars 43 forks source link

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

Closed Decade-Li closed 1 year ago

Decade-Li commented 1 year ago

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."

fkite-cs commented 1 year ago

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 commented 1 year ago

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