Ars*_*21b 1 python opencv numpy conv-neural-network
我收到此错误Error when checking input: expected conv2d_11_input to have 4 dimensions, but got array with shape (300, 300, 3)
如何将 RGB 图像传递给 CNN?如何枚举样本以创建 4D 图像?
卷积函数需要一批图像,即使您有单个图像,您也应该将图像传递为:
# assume img is your RGB image
# add 4th batch dimension
img = np.expand_dims(img, axis=0))
# now you can pass it to CNN
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
632 次 |
| 最近记录: |