【YOLOV5 call camera recognition error solution】

When YOLOV5 uses detect.py to call the camera for real-time recognition, 'Upsample' object has no attribute 'recompute_scanle_factorthe error reporting

p2.png

Go to the python library to find upsampling.py and open it, as shown in the figure below;

p5.png

Modify upsampling.py, the modified result is as follows:

p3.png

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

Save the modification, and then run detect.py to call the camera recognition

Guess you like

Origin blog.csdn.net/weixin_44355653/article/details/125766680