RuntimeError: Given groups=1, weight of size [64, 3, 6, 6], expected input[1, 4, 896, 1280] to have
在使用图片base64编码时遇到RuntimeError: Given groups=1, weight of size [64, 3, 6, 6], expected input[1, 4, 896, 1280] to have 3 channels, but got 4 channels instead 问题
解决方法
该问题出现在png格式的图片base64编码后解码为数组格式时会出现通道数为4的情况,需要将解码的数组用函数convert(‘RGB’)做RGB的转换现在将代码给出如下:
// 将p
原创
2022-04-12 17:15:20 ·
3425 阅读 ·
0 评论