MCPcopy Create free account
hub / github.com/TencentARC/InstantMesh / generate_mvs

Function generate_mvs

app.py:134–152  ·  view source on GitHub ↗
(input_image, sample_steps, sample_seed)

Source from the content-addressed store, hash-verified

132
133
134def generate_mvs(input_image, sample_steps, sample_seed):
135
136 seed_everything(sample_seed)
137
138 # sampling
139 generator = torch.Generator(device=device0)
140 z123_image = pipeline(
141 input_image,
142 num_inference_steps=sample_steps,
143 generator=generator,
144 ).images[0]
145
146 show_image = np.asarray(z123_image, dtype=np.uint8)
147 show_image = torch.from_numpy(show_image) # (960, 640, 3)
148 show_image = rearrange(show_image, '(n h) (m w) c -> (n m) h w c', n=3, m=2)
149 show_image = rearrange(show_image, '(n m) h w c -> (n h) (m w) c', n=2, m=3)
150 show_image = Image.fromarray(show_image.numpy())
151
152 return z123_image, show_image
153
154
155def make_mesh(mesh_fpath, planes):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected