AttributeError: ‘Upsample‘ object has no attribute ‘recompute_scale_factor‘

created at 06-05-2022 views: 22

problem

After yolov5 training is complete, when running detect.py for inference test, I get this error:

AttributeError: ‘Upsample‘ object has no attribute ‘recompute_scale_factor‘

solution

1.Click the following error reporting method to enter:

find the file

2.Modify the following code:

modify the code

def forward(self, input: Tensor) -> Tensor:
    return F.interpolate(input, self.size, self.scale_factor, self.mode, self.align_corners)

That's it

created at:06-05-2022
edited at: 06-06-2022: