MCPcopy Create free account
hub / github.com/computational-imaging/bacon / export_model

Function export_model

experiments/render_sdf.py:16–45  ·  view source on GitHub ↗
(ckpt_path, model_name, N=512, model_type='bacon', hidden_layers=8,
                 hidden_size=256, output_layers=[1, 2, 4, 8],
                 return_sdf=False, adaptive=True)

Source from the content-addressed store, hash-verified

14
15
16def export_model(ckpt_path, model_name, N=512, model_type='bacon', hidden_layers=8,
17 hidden_size=256, output_layers=[1, 2, 4, 8],
18 return_sdf=False, adaptive=True):
19
20 # the network has 4 output levels of detail
21 num_outputs = len(output_layers)
22 max_frequency = 3*(32,)
23
24 # load model
25 with utils.HiddenPrint():
26 model = modules.MultiscaleBACON(3, hidden_size, 1,
27 hidden_layers=hidden_layers,
28 bias=True,
29 frequency=max_frequency,
30 quantization_interval=np.pi,
31 is_sdf=True,
32 output_layers=output_layers,
33 reuse_filters=True)
34
35 ckpt = torch.load(ckpt_path)
36 model.load_state_dict(ckpt)
37 model.cuda()
38
39 if not adaptive:
40 # extracts separate meshes for each scale
41 generate_mesh(model, N, return_sdf, num_outputs, model_name)
42
43 else:
44 # extracts single-scale output
45 generate_mesh_adaptive(model, model_name)
46
47
48def generate_mesh(model, N, return_sdf=False, num_outputs=4, model_name='model'):

Callers 1

export_meshesFunction · 0.70

Calls 2

generate_meshFunction · 0.85
generate_mesh_adaptiveFunction · 0.85

Tested by

no test coverage detected