TypeError: detect_image() missing 1 required positional argument: ‘image‘(已解决)

TypeError: detect_image() missing 1 required positional argument: 'image'

这是在没有实例化类对象的情况下,强行硬访问类的成员函数的结果。

TypeError: detect_image() missing 1 required positional argument: ‘image‘(已解决)_第1张图片

我在程序中直接使用Unet()中的detect_image()函数,结果出现上面的错误,具体强制使用的程序程序如下

 TypeError: detect_image() missing 1 required positional argument: ‘image‘(已解决)_第2张图片

这样访问类的成员是不对的。在上面的第一个图像上面已经实例化了类对象,为什么不用呢

unet=Unet()

换句话说,把程序中的Unet.detect_image 改为 unet.detect_image  就可以了。

TypeError: detect_image() missing 1 required positional argument: ‘image‘(已解决)_第3张图片

 

你可能感兴趣的:(pytorch,pytorch)