我正在尝试进行单眼深度估计,弹出的错误是“轴不匹配数组”

问题描述

这是我在其中输入了图片和深度图的代码,出现此错误

Images = ['/content/gdrive/My Drive/depth code 2/Images']
temp_depths = ['/content/gdrive/My Drive/depth code 2/Depth']
Images = np.transpose(Images,(2,1))
Depths = []
for i in range(temp_depths.shape[-1]):
    Depths.append(temp_depths[:,:,i]/temp_depths[:,i].max()) 
Images = Images/255.   
Depths = np.array(Depths)
Depths = Depths.reshape((Depths.shape[0],Depths.shape[1],Depths.shape[2],1))
print(Images.shape,Depths.shape)
del data

Here is the error

ValueError                                Traceback (most recent call last)
<ipython-input-18-d076851297b1> in <module>()
      2 temp_depths = ['/content/gdrive/My Drive/depth code 2/Depth']
      3 
----> 4 Images = np.transpose(Images,1))
      5 Depths = []
      6 for i in range(temp_depths.shape[-1]):

<__array_function__ internals> in transpose(*args,**kwargs)

2 frames
/usr/local/lib/python3.6/dist-packages/numpy/core/fromnumeric.py in _wrapit(obj,method,*args,**kwds)
     45     except AttributeError:
     46         wrap = None
---> 47     result = getattr(asarray(obj),method)(*args,**kwds)
     48     if wrap:
     49         if not isinstance(result,mu.ndarray):

ValueError: axes don't match array

我被困在这里代码长时间不起作用

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)