Hi,
I was trying to load a .ply file with load_ply however I encountered an error (ValueError: Invalid datatype: uint8). This does not happen with all the .ply files I am loading. Please note that I verified that the file is correct and uncorrputed. Please give your suggestions, thanks!
It appears that there are multiple versions of the ply file format, and pytorch3d is not currently compatible with all of them. In particular, we assume the traditional type names (uchar, short, double etc.) - as described for example at https://wiki.fileformat.com/3d/ply/ and http://paulbourke.net/dataformats/ply/. There is an alternative set (uint8, int16, float64) as well , which I see in the code at https://www.cc.gatech.edu/projects/large_models/ply.html, and which some of your files are probably using.
It would be interesting if you could post the header (the short text at the beggining) of one of the files which fails.
To fix it, it may be enough for you to replace
_PLY_TYPES = {
"char": _PlyTypeData(1, "b", np.byte),
"uchar": _PlyTypeData(1, "B", np.ubyte),
"short": _PlyTypeData(2, "h", np.short),
"ushort": _PlyTypeData(2, "H", np.ushort),
"int": _PlyTypeData(4, "i", np.int32),
"uint": _PlyTypeData(4, "I", np.uint32),
"float": _PlyTypeData(4, "f", np.float32),
"double": _PlyTypeData(8, "d", np.float64),
}
with
_PLY_TYPES = {
"char": _PlyTypeData(1, "b", np.byte),
"uchar": _PlyTypeData(1, "B", np.ubyte),
"short": _PlyTypeData(2, "h", np.short),
"ushort": _PlyTypeData(2, "H", np.ushort),
"int": _PlyTypeData(4, "i", np.int32),
"uint": _PlyTypeData(4, "I", np.uint32),
"float": _PlyTypeData(4, "f", np.float32),
"double": _PlyTypeData(8, "d", np.float64),
"int8": _PlyTypeData(1, "b", np.byte),
"uint8": _PlyTypeData(1, "B", np.ubyte),
"int16": _PlyTypeData(2, "h", np.short),
"uint16": _PlyTypeData(2, "H", np.ushort),
"int32": _PlyTypeData(4, "i", np.int32),
"uint32": _PlyTypeData(4, "I", np.uint32),
"float32": _PlyTypeData(4, "f", np.float32),
"float64": _PlyTypeData(8, "d", np.float64),
}
in pytorch3d/io/ply_io.py.
A fix was made yesterday. This should be working in the nightly build now.
Most helpful comment
A fix was made yesterday. This should be working in the nightly build now.