Skip to content

Instantly share code, notes, and snippets.

@justinhchae
Last active June 22, 2023 03:50
Show Gist options
  • Save justinhchae/7c6a717c570b1ed0a0f46c921bc70a0d to your computer and use it in GitHub Desktop.
Save justinhchae/7c6a717c570b1ed0a0f46c921bc70a0d to your computer and use it in GitHub Desktop.
Example Usage to Subset an Obj with PyTorch3D
# install direct from our forked repository: https://github.com/Esri/pytorch3d/tree/multitexture-obj-high-precision
!pip install 'git+https://github.com/Esri/pytorch3d.git@multitexture-obj-high-precision'
from pytorch3d.io import subset_obj
faces_to_subset = <a torch tensor of face indices to subset>
# all obj objects are subset to the selected face indices
obj_subset = subset_obj(
obj=obj,
faces_to_subset=faces_to_subset,
device=torch.device("cpu") # specify cpu as the target device to subset and return obj sebset
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment