AI智能
改变未来

Expected 4-dimensional input for 4-dimensional weight 64 3 11 11, but got 3-dimensional input of siz

Expected 4-dimensional input for 4-dimensional weight 64 3 11 11, but got 3-dimensional input of size [3, 224, 224] instead

  • 解决办法
  • 原因

解决办法

img = np.expand_dims(img,0)

原因

我用pytorch里的transform函数处理的是一张图片,而卷积神经网络模型是输入的是一个数据集的图片,而不是一张图片,
赞(0) 打赏
未经允许不得转载:爱站程序员基地 » Expected 4-dimensional input for 4-dimensional weight 64 3 11 11, but got 3-dimensional input of siz