MCPcopy Create free account
hub / github.com/openai/point-e / load

Method load

point_e/util/mesh.py:29–55  ·  view source on GitHub ↗

Load the mesh from a .npz file.

(cls, f: Union[str, BinaryIO])

Source from the content-addressed store, hash-verified

27
28 @classmethod
29 def load(cls, f: Union[str, BinaryIO]) -> "TriMesh":
30 """
31 Load the mesh from a .npz file.
32 """
33 if isinstance(f, str):
34 with open(f, "rb") as reader:
35 return cls.load(reader)
36 else:
37 obj = np.load(f)
38 keys = list(obj.keys())
39 verts = obj["verts"]
40 faces = obj["faces"]
41 normals = obj["normals"] if "normals" in keys else None
42 vertex_channels = {}
43 face_channels = {}
44 for key in keys:
45 if key.startswith("v_"):
46 vertex_channels[key[2:]] = obj[key]
47 elif key.startswith("f_"):
48 face_channels[key[2:]] = obj[key]
49 return cls(
50 verts=verts,
51 faces=faces,
52 normals=normals,
53 vertex_channels=vertex_channels,
54 face_channels=face_channels,
55 )
56
57 def save(self, f: Union[str, BinaryIO]):
58 """

Callers 2

load_checkpointFunction · 0.45
__init__Method · 0.45

Calls 1

keysMethod · 0.80

Tested by

no test coverage detected