mirror of
https://github.com/facebookresearch/pytorch3d.git
synced 2025-12-22 23:30:35 +08:00
Extract finding directories for test data
Summary: Make common functions for finding directories where test data is found, instead of lots of tests using their own `__file__` while trying to get ./tests/data and the tutorials data. Reviewed By: nikhilaravi Differential Revision: D27633701 fbshipit-source-id: 1467bb6018cea16eba3cab097d713116d51071e9
This commit is contained in:
committed by
Facebook GitHub Bot
parent
24ee279005
commit
1216b5765a
@@ -9,6 +9,20 @@ import torch
|
||||
from PIL import Image
|
||||
|
||||
|
||||
def get_tests_dir() -> Path:
|
||||
"""
|
||||
Returns Path for the directory containing this file.
|
||||
"""
|
||||
return Path(__file__).resolve().parent
|
||||
|
||||
|
||||
def get_pytorch3d_dir() -> Path:
|
||||
"""
|
||||
Returns Path for the root PyTorch3D directory.
|
||||
"""
|
||||
return get_tests_dir().parent
|
||||
|
||||
|
||||
def load_rgb_image(filename: str, data_dir: Union[str, Path]):
|
||||
filepath = data_dir / filename
|
||||
with Image.open(filepath) as raw_image:
|
||||
|
||||
Reference in New Issue
Block a user