facebookresearch / pytorch3d

PyTorch3D is FAIR's library of reusable components for deep learning with 3D data
https://pytorch3d.org/
Other
8.71k stars 1.3k forks source link

Rendering with multi-gpu #103

Closed tjdhg456 closed 4 years ago

tjdhg456 commented 4 years ago

❓ Questions on how to use PyTorch3d

Thank you.

# Define the settings for rasterization and shading. Here we set the output image to be of size
# 256x256. To form the blended image we use 100 faces for each pixel. Refer to rasterize_meshes.py
# for an explanation of this parameter. 
raster_settings = RasterizationSettings(
    image_size=256, 
    blur_radius=np.log(1. / 1e-4 - 1.) * blend_params.sigma, 
    faces_per_pixel=100, 
    bin_size=0
)

NOTE:

  1. If you encountered any errors or unexpected issues while using PyTorch3d and need help resolving them, please use the "Bugs / Unexpected behaviors" issue template.

  2. We do not answer general machine learning / computer vision questions that are not specific to PyTorch3d, such as how a model works or what algorithm/methods can be used to achieve X.

nikhilaravi commented 4 years ago

@tjdhg456 regarding the first question, please see #17 which is requesting the same feature for non square image rasterization. This is a high priority feature on our roadmap.

For your second question, what is your use case for multi-gpu rendering?

tjdhg456 commented 4 years ago

Thank you for the response.

When I rendered the cad obj to big image (such as 1900 x 1900), out-of-memory error shows. I thought it is because of memory occupied by differential rendering. Is it right?

nikhilaravi commented 4 years ago

@tjdhg456 yes this is possible. Are you just trying to do forward rendering to produce an image or is this part of a deep learning pipeline where you want to calculate gradients?

In the renderer documentation we explain how the memory usage is calculated. One of the key components is the number of faces_per_pixel which is set in raster_settings e.g. in the code snipped you shared above, you have set this to 100.

If you do not need to calculate gradients, you can set faces_per_pixel to 1 and this should significantly reduce the memory usage.

tjdhg456 commented 4 years ago

@nikhilaravi I need the differential rendering module in the part of deep learning network. So I think, faces_per_pixel should not be set to 1.

For example, if faces_per_pixel is set to 50, are there any differences in the performance of the network?

Thank you.

nikhilaravi commented 4 years ago

@tjdhg456 this is a parameter that you will need to tune and will probably vary depending on your task.

tjdhg456 commented 4 years ago

Thank you..!