Skip to content

Conversation

@KyleRoss-rice
Copy link

Fix for "off-by-one" issue in the main loop

for i in range(opts.iterations):
    //...

    if i % 1 == 0:
        print(f'{os.path.basename(opts.input_pc)}; iter: {i} out of: {opts.iterations}; loss: {loss.item():.4f};'
                f' sample count: {num_samples}; time: {end_time - start_time:.2f}')
    if i % opts.export_interval == 0 and i > 0:
        print('exporting reconstruction... current LR: {}'.format(optimizer.param_groups[0]['lr']))
        with torch.no_grad():
            part_mesh.export(os.path.join(opts.save_path, f'recon_iter_{i}.obj'))

    //...

if opts.iterations == 100, for example, then the range for i is [0, 99].
On the final iteration, iter: 99 out of: 100 is printed.

if opts.export_interval == 100, then i % opts.export_interval == 0 is always false, since i never reaches a multiple of 100. No reconstructed mesh is exported.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant