2020年1月5日星期日

RuntimeError: Given groups=1, weight of size [64, 3, , ], expected input[1, 4, , ] to have 3

This kind of problem that should be 3 channels and the result is 4 channels is generally due to the Image.open function.

Error statement:

img = Image.open(osp.join(dspth, image_path))

At this time, reading the picture is 4 channels, so an error will be reported.

It should be changed to:

 img = Image.open(osp.join(dspth, image_path)).convert('RGB')

没有评论:

发表评论