-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
UserWarning: R is not a valid rotation matrix (using look_at_rotation) #595
Comments
@fairydora this is where the warning is coming from: pytorch3d/pytorch3d/transforms/transform3d.py Lines 703 to 727 in ff9c661
Is the warning affecting the result? Does the optimization complete or are you getting NaNs? Can you also check #585 to see if you have the same issue? |
Hello Nikhila :) The result of this is a totally white render, so I can't finish the optimisation. I'll immediately test the solution from #585 and report the outcome, thanks! |
hi Nikhila, |
Great! We'll fix the issue in master! |
Hello, :)
I've taken the tutorial "camera_position_optimization_with_differentiable_rendering" and
In each of these tests I get the error "UserWarning: R is not a valid rotation matrix" at random times.
At first I thought it was a problem with the camera aligning itself with the up vector, but it doesn't seem to be the case (the default up vector for look_at_rotation is (0,1,0).
I'm using the following versions:
-pytorch 1.8.0
-pytorch3d 0.4.0
-python 3.6.8
I would like to ask how I can work around this or if I am doing something wrong... this issue is rather urgent for me.
To replicate the problem in collab, you need to run it a few times starting from "3. Initialize the model and optimizer".
It always runs correctly the first time. I can also send the version I've copied to pycharm.
This is the last few printouts from your collab version of the tutorial:
The problem happens on iteration 90 in this case, but it's random, can happen almost immediately:
model.camera_position: tensor([0.2993, 3.9161, 1.3367], device='cuda:0')
R: tensor([[[-0.9758, -0.2063, -0.0721],
[ 0.0000, 0.3302, -0.9439],
[ 0.2185, -0.9211, -0.3222]]], device='cuda:0')
T: tensor([[-0.0000, -0.0000, 4.1488]], device='cuda:0')
model.camera_position: tensor([-0.2256, 3.2020, 1.6944], device='cuda:0')
R: tensor([[[-0.9913, 0.1164, 0.0621],
[ 0.0000, 0.4709, -0.8822],
[-0.1320, -0.8745, -0.4668]]], device='cuda:0')
T: tensor([[1.4901e-08, -0.0000e+00, 3.6297e+00]], device='cuda:0')
model.camera_position: tensor([-0.0372, 2.4358, 1.8689], device='cuda:0')
R: tensor([[[-0.9998, 0.0158, 0.0121],
[ 0.0000, 0.6088, -0.7933],
[-0.0199, -0.7932, -0.6087]]], device='cuda:0')
T: tensor([[-0.0000e+00, -2.3842e-07, 3.0704e+00]], device='cuda:0')
model.camera_position: tensor([0.0960, 2.1915, 2.1579], device='cuda:0')
R: tensor([[[-0.9990, -0.0316, -0.0312],
[ 0.0000, 0.7020, -0.7122],
[ 0.0444, -0.7115, -0.7013]]], device='cuda:0')
T: tensor([[-0.0000e+00, -1.1921e-07, 3.0771e+00]], device='cuda:0')
/usr/local/lib/python3.7/dist-packages/pytorch3d/transforms/transform3d.py:726: UserWarning: R is not a valid rotation matrix
warnings.warn(msg)
model.camera_position: tensor([nan, nan, nan], device='cuda:0')
R: tensor([[[nan, nan, nan],
[nan, nan, nan],
[nan, nan, nan]]], device='cuda:0')
T: tensor([[nan, nan, nan]], device='cuda:0')
This is the output from my own optimisation, I can replicate the problem almost every time I run it:
The text was updated successfully, but these errors were encountered: