RuntimeError: The size of tensor a (4) must match the size of tensor b (3) at non-singleton dimensio

出现:RuntimeError: The size of tensor a (4) must match the size of tensor b (3) at non-singleton dimension 0的解决办法:

在这里插入图片描述

把代码中

Image.open(img_path)

改为

Image.open(img_path).convert('RGB')

即可解决问题。

你可能感兴趣的:(opencv,计算机视觉)