Na-Z / attMPTI

[CVPR 2021] Few-shot 3D Point Cloud Semantic Segmentation
MIT License
160 stars 29 forks source link

Errors occur when running 'bash train_attMPTI.sh' #26

Open neymar-jr opened 1 year ago

neymar-jr commented 1 year ago

Errors are listed as below.

Traceback (most recent call last): File "/home/liuxuanchen/Develop/few-shot-point-cloud/attMPTI/main.py", line 101, in train(args) File "/home/liuxuanchen/Develop/few-shot-point-cloud/attMPTI/runs/mpti_train.py", line 58, in train loss, accuracy = MPTI.train(data) File "/home/liuxuanchen/Develop/few-shot-point-cloud/attMPTI/models/mpti_learner.py", line 63, in train query_logits, loss= self.model(support_x, support_y, query_x, query_y) File "/home/liuxuanchen/anaconda3/envs/torch/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1194, in _call_impl return forward_call(*input, **kwargs) File "/home/liuxuanchen/Develop/few-shot-point-cloud/attMPTI/models/mpti.py", line 107, in forward A = self.calculateLocalConstrainedAffinity(node_feat, k=self.kconnect) File "/home/liuxuanchen/Develop/few-shot-point-cloud/attMPTI/models/mpti.py", line 258, in calculateLocalConstrainedAffinity A = A.scatter(1, I, knn_similarity) RuntimeError: Expected index [4396, 200] to be smaller than self [4396, 4396] apart from dimension 1 and to be smaller size than src [4396, 192]

mayur20169 commented 1 year ago

I am also getting exactly same error.

suurajroshan commented 1 year ago

I get a similar error too. Did anyone get a solution to this error?

WeiTang-code commented 10 months ago

It may be something wrong with faiss. I've managed to run the code successfully in another environment, but it gives me an error in a higher version of pytorch and cuda environment on a 30-series GPU. Now I get wrong knn_index.


Further troubleshooting revealed that it was not a faiss error, but a large number of "nan" in the tensor of node_feat, which comes from the prototype.


I have solved this problem. It comes from the function "pytorch.nn.functional.pairwise_distance". This function behaves differently in different versions of pytorch.

If you use pytorch of higher version, you can refer to my solution. Note that every use of the "pairwise_distance" function requires modification.

distances = F.pairwise_distance(feat[..., None].transpose(1,2), farthest_seeds[None, ...], p=2) # (n_points, n_prototypes)

xin1106 commented 3 weeks ago

@WeiTang-code Your answer is very helpful. I encountered an error while running the protonet.by : Runtime Error: Expected target size [2,192], got [2,2048]. Have you encountered this problem before. For the 'similarity=- F.pairise_distance (feature, prototype [None, None], p=2)**2', how should I modify it?