The code found at the documentation for DensePose rendering contains a bug, caused due to not passing PathManager to _read_image.
I guess this bug introduced 3 month ago, by this commit. It added PathManager as a mandatory input for _read_image function, yet the documentation was not updated accordingly.
The fix is simple as passing an PathManager instance to _read_image. For example:
path_manager = PathManager()
_read_image(file_name=tex_filename, path_manager=path_manager, format='RGB')
And, to add an import from iopath at the modules import section:
from iopath.common.file_io import PathManager
Thanks for reporting this. I think it is better to change the tutorial notebook to not use an internal function of PyTorch3D, and I plan to do this.
In particular, I would replace
tex = torch.from_numpy(_read_image(file_name=tex_filename, format='RGB') / 255. ).unsqueeze(0).to(device)
with
with Image.open(tex_filename) as image:
np_image = np.asarray(image.convert("RGB")).astype(np.float32)
tex = torch.from_numpy(np_image / 255. )[None].to(device)
and replace the import of _read_image with from PIL import Image.
Thanks for reporting this @OmriKaduri!
This is now fixed in 6c4151a.
Most helpful comment
Thanks for reporting this. I think it is better to change the tutorial notebook to not use an internal function of PyTorch3D, and I plan to do this.
In particular, I would replace
with
and replace the import of
_read_imagewithfrom PIL import Image.