Skip to content
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

Errors in Rendering #72

Closed
shersoni610 opened this issue Feb 19, 2020 · 6 comments
Closed

Errors in Rendering #72

shersoni610 opened this issue Feb 19, 2020 · 6 comments
Assignees
Labels
question Further information is requested

Comments

@shersoni610
Copy link

Hello,

I installed Python3.6 when things did not work with 3.7 and 3.8. Now I get the following errors:

Copyright (c) Facebook, Inc. and its affiliates. All rights reserved.

Camera position optimization using differentiable rendering
In this tutorial we will learn the [x, y, z] position of a camera given a reference image using differentiable rendering.

We will first initialize a renderer with a starting position for the camera. We will then use this to generate an image, compute a loss with the reference image, and finally backpropagate through the entire pipeline to update the position of the camera.

This tutorial shows how to:

load a mesh from an .obj file
initialize a Camera, Shader and Renderer,
render a mesh
set up an optimization loop with a loss function and optimizer
Set up and imports
import os
import torch
import numpy as np
from tqdm import tqdm_notebook
import imageio
import torch.nn as nn
import torch.nn.functional as F
import matplotlib.pyplot as plt
from skimage import img_as_ubyte

io utils

from pytorch3d.io import load_obj

datastructures

from pytorch3d.structures import Meshes, Textures

3D transformations functions

from pytorch3d.transforms import Rotate, Translate

rendering components

from pytorch3d.renderer import (
OpenGLPerspectiveCameras, look_at_view_transform, look_at_rotation,
RasterizationSettings, MeshRenderer, MeshRasterizer, BlendParams,
SilhouetteShader, PhongShader, PointLights
)

ModuleNotFoundError Traceback (most recent call last)
in
19
20 # rendering components
---> 21 from pytorch3d.renderer import (
22 OpenGLPerspectiveCameras, look_at_view_transform, look_at_rotation,
23 RasterizationSettings, MeshRenderer, MeshRasterizer, BlendParams,

~/Disk/Software/Anaconda3/envs/pytorch3d/lib/python3.6/site-packages/pytorch3d/renderer/init.py in
17 from .lighting import DirectionalLights, PointLights, diffuse, specular
18 from .materials import Materials
---> 19 from .mesh import (
20 GouradShader,
21 MeshRasterizer,

~/Disk/Software/Anaconda3/envs/pytorch3d/lib/python3.6/site-packages/pytorch3d/renderer/mesh/init.py in
2
3 from .rasterize_meshes import rasterize_meshes
----> 4 from .rasterizer import MeshRasterizer, RasterizationSettings
5 from .renderer import MeshRenderer
6 from .shader import (

~/Disk/Software/Anaconda3/envs/pytorch3d/lib/python3.6/site-packages/pytorch3d/renderer/mesh/rasterizer.py in
3
4
----> 5 from dataclasses import dataclass
6 from typing import NamedTuple, Optional
7 import torch

ModuleNotFoundError: No module named 'dataclasses'

@bottler
Copy link
Contributor

bottler commented Feb 19, 2020

This is a known problem with our release not being compatible with python 3.6. We use a python feature which doesn't exist there. This is fixed in the version on github, and we hope to have a full release soon.
For the moment, as a temporary solution, you can try overwriting the file ~/Disk/Software/Anaconda3/envs/pytorch3d/lib/python3.6/site-packages/pytorch3d/renderer/mesh/rasterizer.py with the text at https://raw.githubusercontent.com/facebookresearch/pytorch3d/533887a18885c244d89b292036e167d668736124/pytorch3d/renderer/mesh/rasterizer.py

@nikhilaravi
Copy link
Contributor

Are you running the notebook locally? What was not working with Python 3.7? As mentioned, dataclasses is available in Python 3.7 - see #31 which is about the same issue.

@bottler
Copy link
Contributor

bottler commented Feb 19, 2020

OP's issue in other pythons is in #47. It seems that pytorch itself would not install.

@shpotes
Copy link

shpotes commented Feb 20, 2020

You can also install dataclasses in python 3.6 and fix the version incompatibility https://pypi.org/project/dataclasses/

@nikhilaravi
Copy link
Contributor

@shersoni610 were you able to resolve this problem? If so, please close this issue.

@nikhilaravi nikhilaravi added the question Further information is requested label Feb 24, 2020
@shersoni610
Copy link
Author

shersoni610 commented Feb 25, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants