TencentARC / InstantMesh

InstantMesh: Efficient 3D Mesh Generation from a Single Image with Sparse-view Large Reconstruction Models
Apache License 2.0
3.36k stars 362 forks source link

IndexError: too many indices for tensor of dimension 2 #107

Open throb081 opened 5 months ago

throb081 commented 5 months ago

你好,我在运行训练代码,model.py文件里面这一段: input_c2ws=torch.tensor(batch['input_c2ws']) print(input_c2ws.shape)

nput_c2ws=np.array(batch['input_c2ws'].cpu())

    input_c2ws=input_c2ws.reshape(input_c2ws.shape[0],-1)
    #input_c2ws=input_c2ws.flatten(-2)
    input_Ks = batch['input_Ks'].flatten(-2)

    input_extrinsics = input_c2ws[:, :, :12],

报了IndexError: too many indices for tensor of dimension 2的错误,我的input_c2ws是644的list,所以源代码的flatten操作我改成了reshape,变换后应该是6*16,但是input_c2ws[:, :, :12]这一行就执行不了,所以想问问看您之前跑的时候的input_c2ws的维度具体是多少呢?是我这边的维度有错么

HaFred commented 3 months ago

Probably something wrong with your input_cam var here. But honestly the naming convention in the dataset script about c2ws and w2cs means literally the opposite, so making it somewhat confusing...