edward1997104 / Wavelet-Generation

Neural Wavelet-domain Diffusion for 3D Shape Generation [SIGGRAPH Asia 2022]
MIT License
86 stars 12 forks source link

Diffusion wavelet type #11

Closed Sakura0124 closed 1 week ago

Sakura0124 commented 2 weeks ago

Thanks for sharing the wonderful idea! When I select different wavelet_type, I get different low_lap and highs_lap. However, after the dwt_inverse_3d_lap function, I get the same voxels_pred. What is the reason? @edward1997104 `for args in args_list: try: idx, path, resolution_index, clip_value = args assert path.endswith('.npy') voxels_np = np.load(path) voxels_torch = torch.from_numpy(voxels_np).unsqueeze(0).unsqueeze(0).float().to(device)

        if clip_value is not None:
            voxels_torch = torch.clip(voxels_torch, -clip_value, clip_value)

        dwt_forward_3d_lap = DWTForward3d_Laplacian(J=config.max_depth, wave=config.wavelet, mode=config.padding_mode).to(device)
        dwt_inverse_3d_lap = DWTInverse3d_Laplacian(J=config.max_depth, wave=config.wavelet, mode=config.padding_mode).to(device)

        # DWT
        low_lap, highs_lap = dwt_forward_3d_lap(voxels_torch) 

        # IWT
        voxels_pred = dwt_inverse_3d_lap((low_lap, highs_lap))
        vertices, traingles = mcubes.marching_cubes(voxels_pred.detach().cpu().numpy()[0, 0], 0.0)
        vertices = (vertices.astype(np.float32) - 0.5) / config.resolution - 0.5
        wavelet_type = config.wavelet_type
        mcubes.export_obj(vertices, traingles, './datasets/test_wavelet/test_{}.obj'.format(wavelet_type))
        print(f"Done!")

        if resolution_index == config.max_depth:
            results.append(low_lap[0,0].detach().cpu().numpy()[None, :])
        else:
            results.append(highs_lap[resolution_index][0,0].detach().cpu().numpy()[None, :])
    except:
        traceback.print_exc()

    print(f"index {idx} Done!")`