问题一 传入图像通道问题 RuntimeError: The size of tensor a (4) must match the size of tensor b (3) at non-singleton dimension 0 这个问题是我们将一张四通道(RGBA)的图片应用的一个需要三通道(RGB)的方法之中,我们可以在使用前判断图片是否为三通道图片,如果是则不做处理,不是则将其转化为三通道。 if img.mode != "RGB": img = img.convert("RGB")