aimagelab / mcmr

PyTorch code for 3DV 2021 paper: "Multi-Category Mesh Reconstruction From Image Collections"
MIT License
18 stars 2 forks source link

AttributeError: 'int' object has no attribute 'index' #3

Closed lisentao closed 2 years ago

lisentao commented 2 years ago

Thank you for sharing your amazing work!
I'm sorry to bother you. I have a problem in main.py in line 640( g['lr'] = [self.args.G_lr_steps_values[self.args.G_lr_steps.index(self.epoch)] ) image

In this line, I find all of the self.args.G_lr_steps_values,self.args.G_lr_steps,self.epoch are Integer. So the integer can not use with the function index().Also,when we use [] behind an Integer,there will be an error ( 'int' object is not subscriptable ) I am wondering how to solve this problem,can you give me any suggestions.

lisentao commented 2 years ago

I think this is about the learning rate,because g['lr'] = 1e-05. But when I change the g['lr'] = 1e-05 or other code I found in the website like these image Now there has problem in the line 845. image image I have run the code on GeForce RTX 3060 with Cuda11.1 .
I am sure these environment can run pytorch code with GPU because I can train the code of MVSNet-pytorch in these environment. And all of the last code run well. image The last image is the instruction about how the test on Pascal 3D image And the last image is what I run. image I wonder where did I go wrong.Can you give me some suggestions. Thanks for your listening.

alexj94 commented 2 years ago

Hi, thanks for your interest in our work. Regarding the first problem, the parameters _self.G_lrsteps and _self.G_lr_stepsvalues should be two lists in which the first one has the decay epochs (e.g. [50, 150]) and the second one the values of the learning rate (e.g. [1e-4, 1e-5]). I modified the main.py file because the initialization of those two parameters was wrong. Regarding the second problem, I can see that the terminal error is more related to SoftRasterizer which doesn't have a compatible kernel for your GPU. I modified the _setupsoftras.py file adding the CUDA version for the new RTX architectures, which includes also your RTX 3060. Try to compile again the SoftRas module. Thanks for your feedback and let me know if everything works fine.

lisentao commented 2 years ago

Thank you for your reply. In Monday I try to Add '--generate-code=arch=compute_86,code=sm_86', in setup_softras.py and now in can use softras in RTX3060.See in the last image image But there still have the problem of "RuntimeError: CUDA error: an illegal memory access was encountered" image I try to found the reason and I found an Strange phenomenon.I add three lines in your code,we can see in the last image. image And I get the result like in the last image image The problem occur in the function torch.cat(). I add the line "out_a = out_a.cuda()" and get the same result. image When I was discouraged, I made a small attempt, but it worked.We can see in the last image about what I got. image All six parameters,I transform to .cpu(),and then transform to .cuda(), and in the last,I get it. image I really don not now why.It's a really amazing question.

lisentao commented 2 years ago

And now I have the problem about the result. I think the bottle in PASCAL 3D get good result.We can see the last three picture. image image image But the problem occur when I try to run the boat in PASCAL 3D dataset. I have now run the boat dataset, and we can see the result in the last three picture image image image The result like these image image I am wondering why this happen. At first, I find a lot of False in there,we can see in the last image image So I set lots of parameters ot True.We can see in the last image. image And it does not work. Then I found the problem of g['lr'].We can see in the last image image image The self.args.G_lr_steps = 351 but it's only did it once.Is that what caused the problem.Do you have any suggestions. Thank you for listening to my long speech.

alexj94 commented 2 years ago

@lisentao are you using pre-trained weights? If so, which weights are you using?

lisentao commented 2 years ago

I am using this pretrained weight image

alexj94 commented 2 years ago

If you're using those weights you should test on all Pascal3D+ classes using the same arguments contained in the "args" field of the weight files. We do not run experiments on just the boat class. Regarding the learning rate problem, if you update the code with the last changes, it should work fine.

lisentao commented 2 years ago

I am very appreciate for your reply,I will try.