├── 3dDiffusion
├── improved_diffusion
│ ├── __init__.py
│ ├── __pycache__
│ │ ├── RenderPeople_datasets.cpython-38.pyc
│ │ ├── __init__.cpython-38.pyc
│ │ ├── __init__.cpython-39.pyc
│ │ ├── dist_util.cpython-38.pyc
│ │ ├── dist_util.cpython-39.pyc
│ │ ├── fp16_util.cpython-38.pyc
│ │ ├── gaussian_diffusion.cpython-38.pyc
│ │ ├── gaussian_diffusion.cpython-39.pyc
│ │ ├── image_datasets.cpython-38.pyc
│ │ ├── logger.cpython-38.pyc
│ │ ├── logger.cpython-39.pyc
│ │ ├── losses.cpython-38.pyc
│ │ ├── losses.cpython-39.pyc
│ │ ├── nn.cpython-38.pyc
│ │ ├── nn.cpython-39.pyc
│ │ ├── resample.cpython-38.pyc
│ │ ├── respace.cpython-38.pyc
│ │ ├── respace.cpython-39.pyc
│ │ ├── script_util.cpython-38.pyc
│ │ ├── script_util.cpython-39.pyc
│ │ ├── slerp.cpython-38.pyc
│ │ ├── train_util.cpython-38.pyc
│ │ ├── transformer_tri.cpython-38.pyc
│ │ ├── triplane_datasets.cpython-38.pyc
│ │ ├── unet.cpython-38.pyc
│ │ └── unet.cpython-39.pyc
│ ├── dist_util.py
│ ├── fp16_util.py
│ ├── gaussian_diffusion.py
│ ├── logger.py
│ ├── losses.py
│ ├── nn.py
│ ├── resample.py
│ ├── respace.py
│ ├── script_util.py
│ ├── slerp.py
│ ├── train_util.py
│ ├── triplane_datasets_omni.py
│ ├── triplane_datasets_shapenet.py
│ └── unet.py
├── scripts
│ ├── image_sample.py
│ ├── image_sample_shapenet.py
│ ├── image_train.py
│ └── image_train_shapenet.py
└── setup.py
├── LICENCE
├── README.md
├── Triplanerecon
├── __pycache__
│ ├── configparse.cpython-310.pyc
│ ├── configparse.cpython-38.pyc
│ ├── load_LINEMOD.cpython-38.pyc
│ ├── load_blender.cpython-38.pyc
│ ├── load_deepvoxels.cpython-38.pyc
│ ├── load_llff.cpython-38.pyc
│ ├── omni_dataset.cpython-38.pyc
│ ├── omni_dataset_ddpm.cpython-38.pyc
│ ├── omni_dataset_single.cpython-38.pyc
│ ├── our_dataset.cpython-38.pyc
│ ├── our_dataset_ddp.cpython-38.pyc
│ ├── run_nerf_helpers.cpython-38.pyc
│ ├── shape_utils.cpython-38.pyc
│ ├── shapenet_dataset.cpython-38.pyc
│ ├── shapenet_dataset_all.cpython-38.pyc
│ ├── shapenet_dataset_ddpm.cpython-38.pyc
│ └── shapenet_dataset_single.cpython-38.pyc
├── configparse.py
├── configs
│ ├── omni
│ │ ├── ddpm.txt
│ │ ├── test_single.txt
│ │ ├── train.txt
│ │ └── train_single.txt
│ └── shapenet_car
│ │ ├── ddpm.txt
│ │ ├── test_single.txt
│ │ ├── train.txt
│ │ └── train_single.txt
├── ddpm_vis.py
├── extract.py
├── multi_omni.sh
├── multi_shapenet.sh
├── omni_dataset.py
├── omni_dataset_ddpm.py
├── omni_dataset_single.py
├── run_nerf_helpers.py
├── shapenet_dataset.py
├── shapenet_dataset_ddpm.py
├── shapenet_dataset_single.py
├── shapenet_pose
│ └── example
│ │ └── pose
│ │ ├── 000000.txt
│ │ ├── 000001.txt
│ │ ├── 000002.txt
│ │ ├── 000003.txt
│ │ ├── 000004.txt
│ │ ├── 000005.txt
│ │ ├── 000006.txt
│ │ ├── 000007.txt
│ │ ├── 000008.txt
│ │ ├── 000009.txt
│ │ ├── 000010.txt
│ │ ├── 000011.txt
│ │ ├── 000012.txt
│ │ ├── 000013.txt
│ │ ├── 000014.txt
│ │ ├── 000015.txt
│ │ ├── 000016.txt
│ │ ├── 000017.txt
│ │ ├── 000018.txt
│ │ ├── 000019.txt
│ │ ├── 000020.txt
│ │ ├── 000021.txt
│ │ ├── 000022.txt
│ │ ├── 000023.txt
│ │ ├── 000024.txt
│ │ ├── 000025.txt
│ │ ├── 000026.txt
│ │ ├── 000027.txt
│ │ ├── 000028.txt
│ │ ├── 000029.txt
│ │ ├── 000030.txt
│ │ ├── 000031.txt
│ │ ├── 000032.txt
│ │ ├── 000033.txt
│ │ ├── 000034.txt
│ │ ├── 000035.txt
│ │ ├── 000036.txt
│ │ ├── 000037.txt
│ │ ├── 000038.txt
│ │ ├── 000039.txt
│ │ ├── 000040.txt
│ │ ├── 000041.txt
│ │ ├── 000042.txt
│ │ ├── 000043.txt
│ │ ├── 000044.txt
│ │ ├── 000045.txt
│ │ ├── 000046.txt
│ │ ├── 000047.txt
│ │ ├── 000048.txt
│ │ ├── 000049.txt
│ │ ├── 000050.txt
│ │ ├── 000051.txt
│ │ ├── 000052.txt
│ │ ├── 000053.txt
│ │ ├── 000054.txt
│ │ ├── 000055.txt
│ │ ├── 000056.txt
│ │ ├── 000057.txt
│ │ ├── 000058.txt
│ │ ├── 000059.txt
│ │ ├── 000060.txt
│ │ ├── 000061.txt
│ │ ├── 000062.txt
│ │ ├── 000063.txt
│ │ ├── 000064.txt
│ │ ├── 000065.txt
│ │ ├── 000066.txt
│ │ ├── 000067.txt
│ │ ├── 000068.txt
│ │ ├── 000069.txt
│ │ ├── 000070.txt
│ │ ├── 000071.txt
│ │ ├── 000072.txt
│ │ ├── 000073.txt
│ │ ├── 000074.txt
│ │ ├── 000075.txt
│ │ ├── 000076.txt
│ │ ├── 000077.txt
│ │ ├── 000078.txt
│ │ ├── 000079.txt
│ │ ├── 000080.txt
│ │ ├── 000081.txt
│ │ ├── 000082.txt
│ │ ├── 000083.txt
│ │ ├── 000084.txt
│ │ ├── 000085.txt
│ │ ├── 000086.txt
│ │ ├── 000087.txt
│ │ ├── 000088.txt
│ │ ├── 000089.txt
│ │ ├── 000090.txt
│ │ ├── 000091.txt
│ │ ├── 000092.txt
│ │ ├── 000093.txt
│ │ ├── 000094.txt
│ │ ├── 000095.txt
│ │ ├── 000096.txt
│ │ ├── 000097.txt
│ │ ├── 000098.txt
│ │ ├── 000099.txt
│ │ ├── 000100.txt
│ │ ├── 000101.txt
│ │ ├── 000102.txt
│ │ ├── 000103.txt
│ │ ├── 000104.txt
│ │ ├── 000105.txt
│ │ ├── 000106.txt
│ │ ├── 000107.txt
│ │ ├── 000108.txt
│ │ ├── 000109.txt
│ │ ├── 000110.txt
│ │ ├── 000111.txt
│ │ ├── 000112.txt
│ │ ├── 000113.txt
│ │ ├── 000114.txt
│ │ ├── 000115.txt
│ │ ├── 000116.txt
│ │ ├── 000117.txt
│ │ ├── 000118.txt
│ │ ├── 000119.txt
│ │ ├── 000120.txt
│ │ ├── 000121.txt
│ │ ├── 000122.txt
│ │ ├── 000123.txt
│ │ ├── 000124.txt
│ │ ├── 000125.txt
│ │ ├── 000126.txt
│ │ ├── 000127.txt
│ │ ├── 000128.txt
│ │ ├── 000129.txt
│ │ ├── 000130.txt
│ │ ├── 000131.txt
│ │ ├── 000132.txt
│ │ ├── 000133.txt
│ │ ├── 000134.txt
│ │ ├── 000135.txt
│ │ ├── 000136.txt
│ │ ├── 000137.txt
│ │ ├── 000138.txt
│ │ ├── 000139.txt
│ │ ├── 000140.txt
│ │ ├── 000141.txt
│ │ ├── 000142.txt
│ │ ├── 000143.txt
│ │ ├── 000144.txt
│ │ ├── 000145.txt
│ │ ├── 000146.txt
│ │ ├── 000147.txt
│ │ ├── 000148.txt
│ │ ├── 000149.txt
│ │ ├── 000150.txt
│ │ ├── 000151.txt
│ │ ├── 000152.txt
│ │ ├── 000153.txt
│ │ ├── 000154.txt
│ │ ├── 000155.txt
│ │ ├── 000156.txt
│ │ ├── 000157.txt
│ │ ├── 000158.txt
│ │ ├── 000159.txt
│ │ ├── 000160.txt
│ │ ├── 000161.txt
│ │ ├── 000162.txt
│ │ ├── 000163.txt
│ │ ├── 000164.txt
│ │ ├── 000165.txt
│ │ ├── 000166.txt
│ │ ├── 000167.txt
│ │ ├── 000168.txt
│ │ ├── 000169.txt
│ │ ├── 000170.txt
│ │ ├── 000171.txt
│ │ ├── 000172.txt
│ │ ├── 000173.txt
│ │ ├── 000174.txt
│ │ ├── 000175.txt
│ │ ├── 000176.txt
│ │ ├── 000177.txt
│ │ ├── 000178.txt
│ │ ├── 000179.txt
│ │ ├── 000180.txt
│ │ ├── 000181.txt
│ │ ├── 000182.txt
│ │ ├── 000183.txt
│ │ ├── 000184.txt
│ │ ├── 000185.txt
│ │ ├── 000186.txt
│ │ ├── 000187.txt
│ │ ├── 000188.txt
│ │ ├── 000189.txt
│ │ ├── 000190.txt
│ │ ├── 000191.txt
│ │ ├── 000192.txt
│ │ ├── 000193.txt
│ │ └── 000194.txt
├── train.py
├── train_single_omni.py
└── train_single_shapenet.py
├── dataset
├── Omniobject3D
│ ├── README.md
│ └── renders
│ │ └── apple
│ │ └── apple_001
│ │ └── render
│ │ ├── depths
│ │ └── r_0_depth.exr
│ │ ├── images
│ │ └── r_0.png
│ │ ├── normals
│ │ └── r_0_normal.png
│ │ └── transforms.json
└── ShapeNet
│ ├── README.md
│ ├── renders
│ └── car
│ │ └── 1a0bc9ab92c915167ae33d942430658c
│ │ ├── intrinsics.txt
│ │ ├── pose
│ │ └── 000000.txt
│ │ └── rgb
│ │ └── 000000.png
│ └── shapenet_renderer
│ ├── LICENSE
│ ├── README.md
│ ├── blender_interface.py
│ ├── render.sh
│ ├── shapenet_spherical_renderer.py
│ └── util.py
├── img
└── img11.png
└── install_difftf.sh
/3dDiffusion/improved_diffusion/__init__.py:
--------------------------------------------------------------------------------
1 | """
2 | Codebase for "Improved Denoising Diffusion Probabilistic Models".
3 | """
4 |
--------------------------------------------------------------------------------
/3dDiffusion/improved_diffusion/__pycache__/RenderPeople_datasets.cpython-38.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ziangcao0312/DiffTF/296ba1bed593fd9b4aae242f453a2e8c1750cebe/3dDiffusion/improved_diffusion/__pycache__/RenderPeople_datasets.cpython-38.pyc
--------------------------------------------------------------------------------
/3dDiffusion/improved_diffusion/__pycache__/__init__.cpython-38.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ziangcao0312/DiffTF/296ba1bed593fd9b4aae242f453a2e8c1750cebe/3dDiffusion/improved_diffusion/__pycache__/__init__.cpython-38.pyc
--------------------------------------------------------------------------------
/3dDiffusion/improved_diffusion/__pycache__/__init__.cpython-39.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ziangcao0312/DiffTF/296ba1bed593fd9b4aae242f453a2e8c1750cebe/3dDiffusion/improved_diffusion/__pycache__/__init__.cpython-39.pyc
--------------------------------------------------------------------------------
/3dDiffusion/improved_diffusion/__pycache__/dist_util.cpython-38.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ziangcao0312/DiffTF/296ba1bed593fd9b4aae242f453a2e8c1750cebe/3dDiffusion/improved_diffusion/__pycache__/dist_util.cpython-38.pyc
--------------------------------------------------------------------------------
/3dDiffusion/improved_diffusion/__pycache__/dist_util.cpython-39.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ziangcao0312/DiffTF/296ba1bed593fd9b4aae242f453a2e8c1750cebe/3dDiffusion/improved_diffusion/__pycache__/dist_util.cpython-39.pyc
--------------------------------------------------------------------------------
/3dDiffusion/improved_diffusion/__pycache__/fp16_util.cpython-38.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ziangcao0312/DiffTF/296ba1bed593fd9b4aae242f453a2e8c1750cebe/3dDiffusion/improved_diffusion/__pycache__/fp16_util.cpython-38.pyc
--------------------------------------------------------------------------------
/3dDiffusion/improved_diffusion/__pycache__/gaussian_diffusion.cpython-38.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ziangcao0312/DiffTF/296ba1bed593fd9b4aae242f453a2e8c1750cebe/3dDiffusion/improved_diffusion/__pycache__/gaussian_diffusion.cpython-38.pyc
--------------------------------------------------------------------------------
/3dDiffusion/improved_diffusion/__pycache__/gaussian_diffusion.cpython-39.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ziangcao0312/DiffTF/296ba1bed593fd9b4aae242f453a2e8c1750cebe/3dDiffusion/improved_diffusion/__pycache__/gaussian_diffusion.cpython-39.pyc
--------------------------------------------------------------------------------
/3dDiffusion/improved_diffusion/__pycache__/image_datasets.cpython-38.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ziangcao0312/DiffTF/296ba1bed593fd9b4aae242f453a2e8c1750cebe/3dDiffusion/improved_diffusion/__pycache__/image_datasets.cpython-38.pyc
--------------------------------------------------------------------------------
/3dDiffusion/improved_diffusion/__pycache__/logger.cpython-38.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ziangcao0312/DiffTF/296ba1bed593fd9b4aae242f453a2e8c1750cebe/3dDiffusion/improved_diffusion/__pycache__/logger.cpython-38.pyc
--------------------------------------------------------------------------------
/3dDiffusion/improved_diffusion/__pycache__/logger.cpython-39.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ziangcao0312/DiffTF/296ba1bed593fd9b4aae242f453a2e8c1750cebe/3dDiffusion/improved_diffusion/__pycache__/logger.cpython-39.pyc
--------------------------------------------------------------------------------
/3dDiffusion/improved_diffusion/__pycache__/losses.cpython-38.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ziangcao0312/DiffTF/296ba1bed593fd9b4aae242f453a2e8c1750cebe/3dDiffusion/improved_diffusion/__pycache__/losses.cpython-38.pyc
--------------------------------------------------------------------------------
/3dDiffusion/improved_diffusion/__pycache__/losses.cpython-39.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ziangcao0312/DiffTF/296ba1bed593fd9b4aae242f453a2e8c1750cebe/3dDiffusion/improved_diffusion/__pycache__/losses.cpython-39.pyc
--------------------------------------------------------------------------------
/3dDiffusion/improved_diffusion/__pycache__/nn.cpython-38.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ziangcao0312/DiffTF/296ba1bed593fd9b4aae242f453a2e8c1750cebe/3dDiffusion/improved_diffusion/__pycache__/nn.cpython-38.pyc
--------------------------------------------------------------------------------
/3dDiffusion/improved_diffusion/__pycache__/nn.cpython-39.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ziangcao0312/DiffTF/296ba1bed593fd9b4aae242f453a2e8c1750cebe/3dDiffusion/improved_diffusion/__pycache__/nn.cpython-39.pyc
--------------------------------------------------------------------------------
/3dDiffusion/improved_diffusion/__pycache__/resample.cpython-38.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ziangcao0312/DiffTF/296ba1bed593fd9b4aae242f453a2e8c1750cebe/3dDiffusion/improved_diffusion/__pycache__/resample.cpython-38.pyc
--------------------------------------------------------------------------------
/3dDiffusion/improved_diffusion/__pycache__/respace.cpython-38.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ziangcao0312/DiffTF/296ba1bed593fd9b4aae242f453a2e8c1750cebe/3dDiffusion/improved_diffusion/__pycache__/respace.cpython-38.pyc
--------------------------------------------------------------------------------
/3dDiffusion/improved_diffusion/__pycache__/respace.cpython-39.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ziangcao0312/DiffTF/296ba1bed593fd9b4aae242f453a2e8c1750cebe/3dDiffusion/improved_diffusion/__pycache__/respace.cpython-39.pyc
--------------------------------------------------------------------------------
/3dDiffusion/improved_diffusion/__pycache__/script_util.cpython-38.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ziangcao0312/DiffTF/296ba1bed593fd9b4aae242f453a2e8c1750cebe/3dDiffusion/improved_diffusion/__pycache__/script_util.cpython-38.pyc
--------------------------------------------------------------------------------
/3dDiffusion/improved_diffusion/__pycache__/script_util.cpython-39.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ziangcao0312/DiffTF/296ba1bed593fd9b4aae242f453a2e8c1750cebe/3dDiffusion/improved_diffusion/__pycache__/script_util.cpython-39.pyc
--------------------------------------------------------------------------------
/3dDiffusion/improved_diffusion/__pycache__/slerp.cpython-38.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ziangcao0312/DiffTF/296ba1bed593fd9b4aae242f453a2e8c1750cebe/3dDiffusion/improved_diffusion/__pycache__/slerp.cpython-38.pyc
--------------------------------------------------------------------------------
/3dDiffusion/improved_diffusion/__pycache__/train_util.cpython-38.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ziangcao0312/DiffTF/296ba1bed593fd9b4aae242f453a2e8c1750cebe/3dDiffusion/improved_diffusion/__pycache__/train_util.cpython-38.pyc
--------------------------------------------------------------------------------
/3dDiffusion/improved_diffusion/__pycache__/transformer_tri.cpython-38.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ziangcao0312/DiffTF/296ba1bed593fd9b4aae242f453a2e8c1750cebe/3dDiffusion/improved_diffusion/__pycache__/transformer_tri.cpython-38.pyc
--------------------------------------------------------------------------------
/3dDiffusion/improved_diffusion/__pycache__/triplane_datasets.cpython-38.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ziangcao0312/DiffTF/296ba1bed593fd9b4aae242f453a2e8c1750cebe/3dDiffusion/improved_diffusion/__pycache__/triplane_datasets.cpython-38.pyc
--------------------------------------------------------------------------------
/3dDiffusion/improved_diffusion/__pycache__/unet.cpython-38.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ziangcao0312/DiffTF/296ba1bed593fd9b4aae242f453a2e8c1750cebe/3dDiffusion/improved_diffusion/__pycache__/unet.cpython-38.pyc
--------------------------------------------------------------------------------
/3dDiffusion/improved_diffusion/__pycache__/unet.cpython-39.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ziangcao0312/DiffTF/296ba1bed593fd9b4aae242f453a2e8c1750cebe/3dDiffusion/improved_diffusion/__pycache__/unet.cpython-39.pyc
--------------------------------------------------------------------------------
/3dDiffusion/improved_diffusion/dist_util.py:
--------------------------------------------------------------------------------
1 | """
2 | Helpers for distributed training.
3 | """
4 |
5 | import io
6 | import os
7 | import socket
8 |
9 | import blobfile as bf
10 | from mpi4py import MPI
11 | import torch as th
12 | import torch.distributed as dist
13 |
14 | # Change this to reflect your cluster layout.
15 | # The GPU for a given rank is (rank % GPUS_PER_NODE).
16 | GPUS_PER_NODE = 8
17 |
18 | SETUP_RETRY_COUNT = 3
19 |
20 |
21 | def setup_dist():
22 | """
23 | Setup a distributed process group.
24 | """
25 | if dist.is_initialized():
26 | return
27 |
28 | comm = MPI.COMM_WORLD
29 | backend = "gloo" if not th.cuda.is_available() else "nccl"
30 |
31 | if backend == "gloo":
32 | hostname = "localhost"
33 | else:
34 | hostname = socket.gethostbyname(socket.getfqdn())
35 | os.environ["MASTER_ADDR"] = comm.bcast(hostname, root=0)
36 | os.environ["RANK"] = str(comm.rank)
37 | os.environ["WORLD_SIZE"] = str(comm.size)
38 |
39 | port = comm.bcast(_find_free_port(), root=0)
40 | os.environ["MASTER_PORT"] = str(port)
41 | dist.init_process_group(backend=backend, init_method="env://")
42 |
43 |
44 | def dev():
45 | """
46 | Get the device to use for torch.distributed.
47 | """
48 | if th.cuda.is_available():
49 | return th.device(f"cuda:{MPI.COMM_WORLD.Get_rank() % GPUS_PER_NODE}")
50 | return th.device("cpu")
51 |
52 |
53 | def load_state_dict(path, **kwargs):
54 | """
55 | Load a PyTorch file without redundant fetches across MPI ranks.
56 | """
57 | # if MPI.COMM_WORLD.Get_rank() == 0:
58 | with bf.BlobFile(path, "rb") as f:
59 | data = f.read()
60 | # else:
61 | # data = None
62 | # data = MPI.COMM_WORLD.bcast(data)
63 | return th.load(io.BytesIO(data), **kwargs)
64 |
65 |
66 | def sync_params(params):
67 | """
68 | Synchronize a sequence of Tensors across ranks from rank 0.
69 | """
70 | for p in params:
71 | with th.no_grad():
72 | dist.broadcast(p, 0)
73 |
74 |
75 | def _find_free_port():
76 | try:
77 | s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
78 | s.bind(("", 0))
79 | s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
80 | return s.getsockname()[1]
81 | finally:
82 | s.close()
83 |
--------------------------------------------------------------------------------
/3dDiffusion/improved_diffusion/fp16_util.py:
--------------------------------------------------------------------------------
1 | """
2 | Helpers to train with 16-bit precision.
3 | """
4 |
5 | import torch.nn as nn
6 | from torch._utils import _flatten_dense_tensors, _unflatten_dense_tensors
7 |
8 |
9 | def convert_module_to_f16(l):
10 | """
11 | Convert primitive modules to float16.
12 | """
13 | if isinstance(l, (nn.Conv1d, nn.Conv2d, nn.Conv3d)):
14 | l.weight.data = l.weight.data.half()
15 | l.bias.data = l.bias.data.half()
16 |
17 |
18 | def convert_module_to_f32(l):
19 | """
20 | Convert primitive modules to float32, undoing convert_module_to_f16().
21 | """
22 | if isinstance(l, (nn.Conv1d, nn.Conv2d, nn.Conv3d)):
23 | l.weight.data = l.weight.data.float()
24 | l.bias.data = l.bias.data.float()
25 |
26 |
27 | def make_master_params(model_params):
28 | """
29 | Copy model parameters into a (differently-shaped) list of full-precision
30 | parameters.
31 | """
32 | master_params = _flatten_dense_tensors(
33 | [param.detach().float() for param in model_params]
34 | )
35 | master_params = nn.Parameter(master_params)
36 | master_params.requires_grad = True
37 | return [master_params]
38 |
39 |
40 | def model_grads_to_master_grads(model_params, master_params):
41 | """
42 | Copy the gradients from the model parameters into the master parameters
43 | from make_master_params().
44 | """
45 | master_params[0].grad = _flatten_dense_tensors(
46 | [param.grad.data.detach().float() for param in model_params]
47 | )
48 |
49 |
50 | def master_params_to_model_params(model_params, master_params):
51 | """
52 | Copy the master parameter data back into the model parameters.
53 | """
54 | # Without copying to a list, if a generator is passed, this will
55 | # silently not copy any parameters.
56 | model_params = list(model_params)
57 |
58 | for param, master_param in zip(
59 | model_params, unflatten_master_params(model_params, master_params)
60 | ):
61 | param.detach().copy_(master_param)
62 |
63 |
64 | def unflatten_master_params(model_params, master_params):
65 | """
66 | Unflatten the master parameters to look like model_params.
67 | """
68 | return _unflatten_dense_tensors(master_params[0].detach(), model_params)
69 |
70 |
71 | def zero_grad(model_params):
72 | for param in model_params:
73 | # Taken from https://pytorch.org/docs/stable/_modules/torch/optim/optimizer.html#Optimizer.add_param_group
74 | if param.grad is not None:
75 | param.grad.detach_()
76 | param.grad.zero_()
77 |
--------------------------------------------------------------------------------
/3dDiffusion/improved_diffusion/losses.py:
--------------------------------------------------------------------------------
1 | """
2 | Helpers for various likelihood-based losses. These are ported from the original
3 | Ho et al. diffusion models codebase:
4 | https://github.com/hojonathanho/diffusion/blob/1e0dceb3b3495bbe19116a5e1b3596cd0706c543/diffusion_tf/utils.py
5 | """
6 |
7 | import numpy as np
8 |
9 | import torch as th
10 |
11 |
12 | def normal_kl(mean1, logvar1, mean2, logvar2):
13 | """
14 | Compute the KL divergence between two gaussians.
15 |
16 | Shapes are automatically broadcasted, so batches can be compared to
17 | scalars, among other use cases.
18 | """
19 | tensor = None
20 | for obj in (mean1, logvar1, mean2, logvar2):
21 | if isinstance(obj, th.Tensor):
22 | tensor = obj
23 | break
24 | assert tensor is not None, "at least one argument must be a Tensor"
25 |
26 | # Force variances to be Tensors. Broadcasting helps convert scalars to
27 | # Tensors, but it does not work for th.exp().
28 | logvar1, logvar2 = [
29 | x if isinstance(x, th.Tensor) else th.tensor(x).to(tensor)
30 | for x in (logvar1, logvar2)
31 | ]
32 |
33 | return 0.5 * (
34 | -1.0
35 | + logvar2
36 | - logvar1
37 | + th.exp(logvar1 - logvar2)
38 | + ((mean1 - mean2) ** 2) * th.exp(-logvar2)
39 | )
40 |
41 |
42 | def approx_standard_normal_cdf(x):
43 | """
44 | A fast approximation of the cumulative distribution function of the
45 | standard normal.
46 | """
47 | return 0.5 * (1.0 + th.tanh(np.sqrt(2.0 / np.pi) * (x + 0.044715 * th.pow(x, 3))))
48 |
49 |
50 | def discretized_gaussian_log_likelihood(x, *, means, log_scales):
51 | """
52 | Compute the log-likelihood of a Gaussian distribution discretizing to a
53 | given image.
54 |
55 | :param x: the target images. It is assumed that this was uint8 values,
56 | rescaled to the range [-1, 1].
57 | :param means: the Gaussian mean Tensor.
58 | :param log_scales: the Gaussian log stddev Tensor.
59 | :return: a tensor like x of log probabilities (in nats).
60 | """
61 | assert x.shape == means.shape == log_scales.shape
62 | centered_x = x - means
63 | inv_stdv = th.exp(-log_scales)
64 | plus_in = inv_stdv * (centered_x + 1.0 / 255.0)
65 | cdf_plus = approx_standard_normal_cdf(plus_in)
66 | min_in = inv_stdv * (centered_x - 1.0 / 255.0)
67 | cdf_min = approx_standard_normal_cdf(min_in)
68 | log_cdf_plus = th.log(cdf_plus.clamp(min=1e-12))
69 | log_one_minus_cdf_min = th.log((1.0 - cdf_min).clamp(min=1e-12))
70 | cdf_delta = cdf_plus - cdf_min
71 | log_probs = th.where(
72 | x < -0.999,
73 | log_cdf_plus,
74 | th.where(x > 0.999, log_one_minus_cdf_min, th.log(cdf_delta.clamp(min=1e-12))),
75 | )
76 | assert log_probs.shape == x.shape
77 | return log_probs
78 |
--------------------------------------------------------------------------------
/3dDiffusion/improved_diffusion/nn.py:
--------------------------------------------------------------------------------
1 | """
2 | Various utilities for neural networks.
3 | """
4 |
5 | import math
6 |
7 | import torch as th
8 | import torch.nn as nn
9 |
10 |
11 | # PyTorch 1.7 has SiLU, but we support PyTorch 1.5.
12 | class SiLU(nn.Module):
13 | def forward(self, x):
14 | return x * th.sigmoid(x)
15 |
16 |
17 | class GroupNorm32(nn.GroupNorm):
18 | def forward(self, x):
19 | return super().forward(x.float()).type(x.dtype)
20 |
21 |
22 | def conv_nd(dims, *args, **kwargs):
23 | """
24 | Create a 1D, 2D, or 3D convolution module.
25 | """
26 | if dims == 1:
27 | return nn.Conv1d(*args, **kwargs)
28 | elif dims == 2:
29 | return nn.Conv2d(*args, **kwargs)
30 | elif dims == 3:
31 | return nn.Conv3d(*args, **kwargs)
32 | raise ValueError(f"unsupported dimensions: {dims}")
33 |
34 |
35 | def linear(*args, **kwargs):
36 | """
37 | Create a linear module.
38 | """
39 | return nn.Linear(*args, **kwargs)
40 |
41 |
42 | def avg_pool_nd(dims, *args, **kwargs):
43 | """
44 | Create a 1D, 2D, or 3D average pooling module.
45 | """
46 | if dims == 1:
47 | return nn.AvgPool1d(*args, **kwargs)
48 | elif dims == 2:
49 | return nn.AvgPool2d(*args, **kwargs)
50 | elif dims == 3:
51 | return nn.AvgPool3d(*args, **kwargs)
52 | raise ValueError(f"unsupported dimensions: {dims}")
53 |
54 |
55 | def update_ema(target_params, source_params, rate=0.99):
56 | """
57 | Update target parameters to be closer to those of source parameters using
58 | an exponential moving average.
59 |
60 | :param target_params: the target parameter sequence.
61 | :param source_params: the source parameter sequence.
62 | :param rate: the EMA rate (closer to 1 means slower).
63 | """
64 | for targ, src in zip(target_params, source_params):
65 | targ.detach().mul_(rate).add_(src, alpha=1 - rate)
66 |
67 |
68 | def zero_module(module):
69 | """
70 | Zero out the parameters of a module and return it.
71 | """
72 | for p in module.parameters():
73 | p.detach().zero_()
74 | return module
75 |
76 |
77 | def scale_module(module, scale):
78 | """
79 | Scale the parameters of a module and return it.
80 | """
81 | for p in module.parameters():
82 | p.detach().mul_(scale)
83 | return module
84 |
85 |
86 | def mean_flat(tensor):
87 | """
88 | Take the mean over all non-batch dimensions.
89 | """
90 | return tensor.mean(dim=list(range(1, len(tensor.shape))))
91 |
92 |
93 | def normalization(channels):
94 | """
95 | Make a standard normalization layer.
96 |
97 | :param channels: number of input channels.
98 | :return: an nn.Module for normalization.
99 | """
100 | return GroupNorm32(32, channels)
101 |
102 |
103 | def timestep_embedding(timesteps, dim, max_period=10000):
104 | """
105 | Create sinusoidal timestep embeddings.
106 |
107 | :param timesteps: a 1-D Tensor of N indices, one per batch element.
108 | These may be fractional.
109 | :param dim: the dimension of the output.
110 | :param max_period: controls the minimum frequency of the embeddings.
111 | :return: an [N x dim] Tensor of positional embeddings.
112 | """
113 | half = dim // 2
114 | freqs = th.exp(
115 | -math.log(max_period) * th.arange(start=0, end=half, dtype=th.float32) / half
116 | ).to(device=timesteps.device)
117 | args = timesteps[:, None].float() * freqs[None]
118 | embedding = th.cat([th.cos(args), th.sin(args)], dim=-1)
119 | if dim % 2:
120 | embedding = th.cat([embedding, th.zeros_like(embedding[:, :1])], dim=-1)
121 | return embedding
122 |
123 |
124 | def checkpoint(func, inputs, params, flag):
125 | """
126 | Evaluate a function without caching intermediate activations, allowing for
127 | reduced memory at the expense of extra compute in the backward pass.
128 |
129 | :param func: the function to evaluate.
130 | :param inputs: the argument sequence to pass to `func`.
131 | :param params: a sequence of parameters `func` depends on but does not
132 | explicitly take as arguments.
133 | :param flag: if False, disable gradient checkpointing.
134 | """
135 | if flag:
136 | args = tuple(inputs) + tuple(params)
137 | return CheckpointFunction.apply(func, len(inputs), *args)
138 | else:
139 | return func(*inputs)
140 |
141 |
142 | class CheckpointFunction(th.autograd.Function):
143 | @staticmethod
144 | def forward(ctx, run_function, length, *args):
145 | ctx.run_function = run_function
146 | ctx.input_tensors = list(args[:length])
147 | ctx.input_params = list(args[length:])
148 | with th.no_grad():
149 | output_tensors = ctx.run_function(*ctx.input_tensors)
150 | return output_tensors
151 |
152 | @staticmethod
153 | def backward(ctx, *output_grads):
154 | ctx.input_tensors = [x.detach().requires_grad_(True) for x in ctx.input_tensors]
155 | with th.enable_grad():
156 | # Fixes a bug where the first op in run_function modifies the
157 | # Tensor storage in place, which is not allowed for detach()'d
158 | # Tensors.
159 | shallow_copies = [x.view_as(x) for x in ctx.input_tensors]
160 | output_tensors = ctx.run_function(*shallow_copies)
161 | input_grads = th.autograd.grad(
162 | output_tensors,
163 | ctx.input_tensors + ctx.input_params,
164 | output_grads,
165 | allow_unused=True,
166 | )
167 | del ctx.input_tensors
168 | del ctx.input_params
169 | del output_tensors
170 | return (None, None) + input_grads
171 |
--------------------------------------------------------------------------------
/3dDiffusion/improved_diffusion/resample.py:
--------------------------------------------------------------------------------
1 | from abc import ABC, abstractmethod
2 |
3 | import numpy as np
4 | import torch as th
5 | import torch.distributed as dist
6 |
7 |
8 | def create_named_schedule_sampler(name, diffusion):
9 | """
10 | Create a ScheduleSampler from a library of pre-defined samplers.
11 |
12 | :param name: the name of the sampler.
13 | :param diffusion: the diffusion object to sample for.
14 | """
15 | if name == "uniform":
16 | return UniformSampler(diffusion)
17 | elif name == "loss-second-moment":
18 | return LossSecondMomentResampler(diffusion)
19 | else:
20 | raise NotImplementedError(f"unknown schedule sampler: {name}")
21 |
22 |
23 | class ScheduleSampler(ABC):
24 | """
25 | A distribution over timesteps in the diffusion process, intended to reduce
26 | variance of the objective.
27 |
28 | By default, samplers perform unbiased importance sampling, in which the
29 | objective's mean is unchanged.
30 | However, subclasses may override sample() to change how the resampled
31 | terms are reweighted, allowing for actual changes in the objective.
32 | """
33 |
34 | @abstractmethod
35 | def weights(self):
36 | """
37 | Get a numpy array of weights, one per diffusion step.
38 |
39 | The weights needn't be normalized, but must be positive.
40 | """
41 |
42 | def sample(self, batch_size, device):
43 | """
44 | Importance-sample timesteps for a batch.
45 |
46 | :param batch_size: the number of timesteps.
47 | :param device: the torch device to save to.
48 | :return: a tuple (timesteps, weights):
49 | - timesteps: a tensor of timestep indices.
50 | - weights: a tensor of weights to scale the resulting losses.
51 | """
52 | w = self.weights()
53 | p = w / np.sum(w)
54 | indices_np = np.random.choice(len(p), size=(batch_size,), p=p)
55 | indices = th.from_numpy(indices_np).long().to(device)
56 | weights_np = 1 / (len(p) * p[indices_np])
57 | weights = th.from_numpy(weights_np).float().to(device)
58 | return indices, weights
59 |
60 |
61 | class UniformSampler(ScheduleSampler):
62 | def __init__(self, diffusion):
63 | self.diffusion = diffusion
64 | self._weights = np.ones([diffusion.num_timesteps])
65 |
66 | def weights(self):
67 | return self._weights
68 |
69 |
70 | class LossAwareSampler(ScheduleSampler):
71 | def update_with_local_losses(self, local_ts, local_losses):
72 | """
73 | Update the reweighting using losses from a model.
74 |
75 | Call this method from each rank with a batch of timesteps and the
76 | corresponding losses for each of those timesteps.
77 | This method will perform synchronization to make sure all of the ranks
78 | maintain the exact same reweighting.
79 |
80 | :param local_ts: an integer Tensor of timesteps.
81 | :param local_losses: a 1D Tensor of losses.
82 | """
83 | batch_sizes = [
84 | th.tensor([0], dtype=th.int32, device=local_ts.device)
85 | for _ in range(dist.get_world_size())
86 | ]
87 | dist.all_gather(
88 | batch_sizes,
89 | th.tensor([len(local_ts)], dtype=th.int32, device=local_ts.device),
90 | )
91 |
92 | # Pad all_gather batches to be the maximum batch size.
93 | batch_sizes = [x.item() for x in batch_sizes]
94 | max_bs = max(batch_sizes)
95 |
96 | timestep_batches = [th.zeros(max_bs).to(local_ts) for bs in batch_sizes]
97 | loss_batches = [th.zeros(max_bs).to(local_losses) for bs in batch_sizes]
98 | dist.all_gather(timestep_batches, local_ts)
99 | dist.all_gather(loss_batches, local_losses)
100 | timesteps = [
101 | x.item() for y, bs in zip(timestep_batches, batch_sizes) for x in y[:bs]
102 | ]
103 | losses = [x.item() for y, bs in zip(loss_batches, batch_sizes) for x in y[:bs]]
104 | self.update_with_all_losses(timesteps, losses)
105 |
106 | @abstractmethod
107 | def update_with_all_losses(self, ts, losses):
108 | """
109 | Update the reweighting using losses from a model.
110 |
111 | Sub-classes should override this method to update the reweighting
112 | using losses from the model.
113 |
114 | This method directly updates the reweighting without synchronizing
115 | between workers. It is called by update_with_local_losses from all
116 | ranks with identical arguments. Thus, it should have deterministic
117 | behavior to maintain state across workers.
118 |
119 | :param ts: a list of int timesteps.
120 | :param losses: a list of float losses, one per timestep.
121 | """
122 |
123 |
124 | class LossSecondMomentResampler(LossAwareSampler):
125 | def __init__(self, diffusion, history_per_term=10, uniform_prob=0.001):
126 | self.diffusion = diffusion
127 | self.history_per_term = history_per_term
128 | self.uniform_prob = uniform_prob
129 | self._loss_history = np.zeros(
130 | [diffusion.num_timesteps, history_per_term], dtype=np.float64
131 | )
132 | self._loss_counts = np.zeros([diffusion.num_timesteps], dtype=np.int)
133 |
134 | def weights(self):
135 | if not self._warmed_up():
136 | return np.ones([self.diffusion.num_timesteps], dtype=np.float64)
137 | weights = np.sqrt(np.mean(self._loss_history ** 2, axis=-1))
138 | weights /= np.sum(weights)
139 | weights *= 1 - self.uniform_prob
140 | weights += self.uniform_prob / len(weights)
141 | return weights
142 |
143 | def update_with_all_losses(self, ts, losses):
144 | for t, loss in zip(ts, losses):
145 | if self._loss_counts[t] == self.history_per_term:
146 | # Shift out the oldest loss term.
147 | self._loss_history[t, :-1] = self._loss_history[t, 1:]
148 | self._loss_history[t, -1] = loss
149 | else:
150 | self._loss_history[t, self._loss_counts[t]] = loss
151 | self._loss_counts[t] += 1
152 |
153 | def _warmed_up(self):
154 | return (self._loss_counts == self.history_per_term).all()
155 |
--------------------------------------------------------------------------------
/3dDiffusion/improved_diffusion/respace.py:
--------------------------------------------------------------------------------
1 | import numpy as np
2 | import torch as th
3 | import ipdb
4 | from .gaussian_diffusion import GaussianDiffusion
5 |
6 | def space_timesteps_new(num_timesteps, section_counts):
7 | """
8 | Create a list of timesteps to use from an original diffusion process,
9 | given the number of timesteps we want to take from equally-sized portions
10 | of the original process.
11 |
12 | For example, if there's 300 timesteps and the section counts are [10,15,20]
13 | then the first 100 timesteps are strided to be 10 timesteps, the second 100
14 | are strided to be 15 timesteps, and the final 100 are strided to be 20.
15 |
16 | If the stride is a string starting with "ddim", then the fixed striding
17 | from the DDIM paper is used, and only one section is allowed.
18 |
19 | :param num_timesteps: the number of diffusion steps in the original
20 | process to divide up.
21 | :param section_counts: either a list of numbers, or a string containing
22 | comma-separated numbers, indicating the step count
23 | per section. As a special case, use "ddimN" where N
24 | is a number of steps to use the striding from the
25 | DDIM paper.
26 | :return: a set of diffusion steps from the original process to use.
27 | """
28 | if isinstance(section_counts, str):
29 | if section_counts.startswith("ddim"):
30 | desired_count = int(section_counts[len("ddim") :])
31 | for i in range(1, num_timesteps):
32 | if len(range(0, num_timesteps, i)) == desired_count:
33 | return set(range(0, num_timesteps, i))
34 | raise ValueError(
35 | f"cannot create exactly {num_timesteps} steps with an integer stride"
36 | )
37 | section_counts = [int(x) for x in section_counts.split(",")]
38 |
39 | if len(section_counts)==0:
40 | size_per = num_timesteps // len(section_counts)
41 | extra = num_timesteps % len(section_counts)
42 | start_idx = 0
43 | all_steps = []
44 | for i, section_count in enumerate(section_counts):
45 | size = size_per + (1 if i < extra else 0)
46 | if size < section_count:
47 | raise ValueError(
48 | f"cannot divide section of {size} steps into {section_count}"
49 | )
50 | if section_count <= 1:
51 | frac_stride = 1
52 | else:
53 | frac_stride = (size - 1) / (section_count - 1)
54 | cur_idx = 0.0
55 | taken_steps = []
56 | for _ in range(section_count):
57 | taken_steps.append(start_idx + round(cur_idx))
58 | cur_idx += frac_stride
59 | all_steps += taken_steps
60 | start_idx += size
61 | else:
62 | all_steps=list(np.int16(np.round(np.flip(np.arange(num_timesteps,0,-num_timesteps/int(section_counts[0])))))-1)
63 |
64 | return set(all_steps)
65 |
66 |
67 |
68 | class SpacedDiffusion(GaussianDiffusion):
69 | """
70 | A diffusion process which can skip steps in a base diffusion process.
71 |
72 | :param use_timesteps: a collection (sequence or set) of timesteps from the
73 | original diffusion process to retain.
74 | :param kwargs: the kwargs to create the base diffusion process.
75 | """
76 |
77 | def __init__(self, use_timesteps, **kwargs):
78 | self.use_timesteps = set(use_timesteps)
79 | self.timestep_map = []
80 | self.original_num_steps = len(kwargs["betas"])
81 |
82 | base_diffusion = GaussianDiffusion(**kwargs) # pylint: disable=missing-kwoa
83 | last_alpha_cumprod = 1.0
84 | new_betas = []
85 | for i, alpha_cumprod in enumerate(base_diffusion.alphas_cumprod):
86 | if i in self.use_timesteps:
87 | new_betas.append(1 - alpha_cumprod / last_alpha_cumprod)
88 | last_alpha_cumprod = alpha_cumprod
89 | self.timestep_map.append(i)
90 | kwargs["betas"] = np.array(new_betas)
91 | super().__init__(**kwargs)
92 |
93 | def p_mean_variance(
94 | self, model, *args, **kwargs
95 | ): # pylint: disable=signature-differs
96 | return super().p_mean_variance(self._wrap_model(model), *args, **kwargs)
97 |
98 | def training_losses(
99 | self, model, *args, **kwargs
100 | ): # pylint: disable=signature-differs
101 | return super().training_losses(self._wrap_model(model), *args, **kwargs)
102 |
103 | def _wrap_model(self, model):
104 | if isinstance(model, _WrappedModel):
105 | return model
106 | return _WrappedModel(
107 | model, self.timestep_map, self.rescale_timesteps, self.original_num_steps
108 | )
109 |
110 | def _scale_timesteps(self, t):
111 | # Scaling is done by the wrapped model.
112 | return t
113 |
114 |
115 | class _WrappedModel:
116 | def __init__(self, model, timestep_map, rescale_timesteps, original_num_steps):
117 | self.model = model
118 | self.timestep_map = timestep_map
119 | self.rescale_timesteps = rescale_timesteps
120 | self.original_num_steps = original_num_steps
121 |
122 | def __call__(self, x, ts, **kwargs):
123 | map_tensor = th.tensor(self.timestep_map, device=ts.device, dtype=ts.dtype)
124 | new_ts = map_tensor[ts]
125 | if self.rescale_timesteps:
126 | new_ts = new_ts.float() * (1000.0 / self.original_num_steps)
127 | return self.model(x, new_ts, **kwargs)
128 |
--------------------------------------------------------------------------------
/3dDiffusion/improved_diffusion/slerp.py:
--------------------------------------------------------------------------------
1 | import numpy as np
2 |
3 | def slerp(t, v0, v1, DOT_THRESHOLD=0.9995):
4 | '''
5 | Spherical linear interpolation
6 | Args:
7 | t (float/np.ndarray): Float value between 0.0 and 1.0
8 | v0 (np.ndarray): Starting vector
9 | v1 (np.ndarray): Final vector
10 | DOT_THRESHOLD (float): Threshold for considering the two vectors as
11 | colineal. Not recommended to alter this.
12 | Returns:
13 | v2 (np.ndarray): Interpolation vector between v0 and v1
14 | '''
15 | c = False
16 | if not isinstance(v0,np.ndarray):
17 | c = True
18 | v0 = v0.detach().cpu().numpy()
19 | if not isinstance(v1,np.ndarray):
20 | c = True
21 | v1 = v1.detach().cpu().numpy()
22 | # Copy the vectors to reuse them later
23 | v0_copy = np.copy(v0)
24 | v1_copy = np.copy(v1)
25 | # Normalize the vectors to get the directions and angles
26 | v0 = v0 / np.linalg.norm(v0)
27 | v1 = v1 / np.linalg.norm(v1)
28 | # Dot product with the normalized vectors (can't use np.dot in W)
29 | dot = np.sum(v0 * v1)
30 | # If absolute value of dot product is almost 1, vectors are ~colineal, so use lerp
31 | if np.abs(dot) > DOT_THRESHOLD:
32 | return lerp(t, v0_copy, v1_copy)
33 | # Calculate initial angle between v0 and v1
34 | theta_0 = np.arccos(dot)
35 | sin_theta_0 = np.sin(theta_0)
36 | # Angle at timestep t
37 | theta_t = theta_0 * t
38 | sin_theta_t = np.sin(theta_t)
39 | # Finish the slerp algorithm
40 | s0 = np.sin(theta_0 - theta_t) / sin_theta_0
41 | s1 = sin_theta_t / sin_theta_0
42 | v2 = s0 * v0_copy + s1 * v1_copy
43 | if c:
44 | res = torch.from_numpy(v2).to("cuda")
45 | else:
46 | res = v2
47 | return res
--------------------------------------------------------------------------------
/3dDiffusion/improved_diffusion/triplane_datasets_omni.py:
--------------------------------------------------------------------------------
1 | from torch.utils.data import DataLoader, Dataset
2 | from PIL import Image
3 | import numpy as np
4 | import os, imageio, time, copy, math, json
5 | from random import sample
6 |
7 | from mpi4py import MPI
8 | from improved_diffusion import dist_util, logger
9 |
10 | import torch
11 |
12 | def load_triplane_data(
13 | *,
14 | data_dir,
15 | batch_size,
16 | image_size,
17 | class_cond=False,
18 | deterministic=False,
19 | ):
20 | """
21 | For a dataset, create a generator over (images, kwargs) pairs.
22 |
23 | Each images is an NCHW float tensor, and the kwargs dict contains zero or
24 | more keys, each of which map to a batched Tensor of their own.
25 | The kwargs dict can be used for class labels, in which case the key is "y"
26 | and the values are integer tensors of class labels.
27 |
28 | :param data_dir: a dataset directory.
29 | :param batch_size: the batch size of each returned pair.
30 | :param image_size: the size to which images are resized.
31 | :param class_cond: if True, include a "y" key in returned dicts for class
32 | label. If classes are not available and this is true, an
33 | exception will be raised.
34 | :param deterministic: if True, yield results in a deterministic order.
35 | :param random_crop: if True, randomly crop the images for augmentation.
36 | :param random_flip: if True, randomly flip the images for augmentation.
37 | """
38 | if not data_dir:
39 | raise ValueError("unspecified data directory")
40 |
41 | dataset = TriplaneDataset(
42 | image_size,
43 | data_dir,
44 | classes=class_cond,
45 | shard=MPI.COMM_WORLD.Get_rank(),
46 | num_shards=MPI.COMM_WORLD.Get_size(),
47 | )
48 | if deterministic:
49 | loader = DataLoader(
50 | dataset, batch_size=batch_size, shuffle=False, num_workers=0, drop_last=True
51 | )
52 | else:
53 | loader = DataLoader(
54 | dataset, batch_size=batch_size, shuffle=True, num_workers=8, drop_last=False, persistent_workers=False
55 | )
56 | while True:
57 | yield from loader
58 | class TriplaneDataset(Dataset):
59 | def __init__(
60 | self,
61 | resolution,
62 | data_dir,
63 | classes=None,
64 | shard=0,
65 | num_shards=1,
66 | ):
67 | super().__init__()
68 | self.classes=classes
69 | self.resolution = resolution
70 | allname=os.listdir(data_dir)
71 | allname.sort()
72 | idx=0
73 | label=[]
74 | path=[]
75 | indexfor={}
76 | for name in allname:
77 |
78 | tripath=os.path.join(data_dir,name)
79 | for triname in os.listdir(tripath):
80 | path.append(os.path.join(tripath,triname))
81 | label.append(idx)
82 | indexfor[name]=idx
83 | idx+=1
84 | import json
85 | json_str = json.dumps(indexfor)
86 | with open('class_index.json', 'w') as json_file:
87 | json_file.write(json_str)
88 |
89 |
90 |
91 | self.path=path
92 | self.class_cond=torch.Tensor(label)
93 |
94 |
95 | def __len__(self):
96 | return self.class_cond.shape[0]
97 |
98 | def __getitem__(self, idx):
99 |
100 | tri_planes=torch.load(self.path[idx],map_location='cpu')
101 | norm=torch.abs(tri_planes).max(-1)[0].max(-1)[0].max(-1)[0].unsqueeze(-1).unsqueeze(-1).unsqueeze(-1)
102 |
103 | tri_planes=(tri_planes/norm)[0]
104 | out_dict={}
105 | if self.classes:
106 |
107 | out_dict["y"] = np.array(self.class_cond[idx], dtype=np.int64)
108 |
109 | return tri_planes, out_dict
110 |
--------------------------------------------------------------------------------
/3dDiffusion/improved_diffusion/triplane_datasets_shapenet.py:
--------------------------------------------------------------------------------
1 | from torch.utils.data import DataLoader, Dataset
2 | from PIL import Image
3 | import numpy as np
4 | import os, imageio, time, copy, math, json
5 | from random import sample
6 | from mpi4py import MPI
7 | from improved_diffusion import dist_util, logger
8 |
9 | import torch
10 |
11 | def load_triplane_data(
12 | *,
13 | data_dir,
14 | batch_size,
15 | image_size,
16 | class_cond=False,
17 | deterministic=False,
18 | ):
19 | """
20 | For a dataset, create a generator over (images, kwargs) pairs.
21 |
22 | Each images is an NCHW float tensor, and the kwargs dict contains zero or
23 | more keys, each of which map to a batched Tensor of their own.
24 | The kwargs dict can be used for class labels, in which case the key is "y"
25 | and the values are integer tensors of class labels.
26 |
27 | :param data_dir: a dataset directory.
28 | :param batch_size: the batch size of each returned pair.
29 | :param image_size: the size to which images are resized.
30 | :param class_cond: if True, include a "y" key in returned dicts for class
31 | label. If classes are not available and this is true, an
32 | exception will be raised.
33 | :param deterministic: if True, yield results in a deterministic order.
34 | :param random_crop: if True, randomly crop the images for augmentation.
35 | :param random_flip: if True, randomly flip the images for augmentation.
36 | """
37 | if not data_dir:
38 | raise ValueError("unspecified data directory")
39 |
40 | dataset = TriplaneDataset(
41 | image_size,
42 | data_dir,
43 | classes=class_cond,
44 | shard=MPI.COMM_WORLD.Get_rank(),
45 | num_shards=MPI.COMM_WORLD.Get_size(),
46 | )
47 | if deterministic:
48 | loader = DataLoader(
49 | dataset, batch_size=batch_size, shuffle=False, num_workers=0, drop_last=True
50 | )
51 | else:
52 | loader = DataLoader(
53 | dataset, batch_size=batch_size, shuffle=True, num_workers=8, drop_last=False, persistent_workers=False
54 | )
55 | while True:
56 | yield from loader
57 | class TriplaneDataset(Dataset):
58 | def __init__(
59 | self,
60 | resolution,
61 | data_dir,
62 | classes=None,
63 | shard=0,
64 | num_shards=1,
65 | ):
66 | super().__init__()
67 | self.classes=classes
68 | self.resolution = resolution
69 | allname=os.listdir(data_dir)
70 | allname.sort()
71 | idx=0
72 |
73 |
74 | label=[]
75 | path=[]
76 |
77 | for name in allname:
78 | label.append(idx)
79 | path.append(os.path.join(data_dir,name))
80 |
81 | self.path=path
82 | self.class_cond=torch.Tensor(label)
83 |
84 |
85 | def __len__(self):
86 | return self.class_cond.shape[0]
87 |
88 | def __getitem__(self, idx):
89 |
90 | tri_planes=torch.load(self.path[idx],map_location='cpu')
91 | norm=torch.abs(tri_planes).max(-1)[0].max(-1)[0].max(-1)[0].unsqueeze(-1).unsqueeze(-1).unsqueeze(-1)
92 | tri_planes=(tri_planes/norm)[0]
93 |
94 | out_dict={}
95 | if self.classes:
96 |
97 | out_dict["y"] = np.array(self.class_cond[idx], dtype=np.int64)
98 |
99 | return tri_planes, out_dict
100 |
--------------------------------------------------------------------------------
/3dDiffusion/scripts/image_sample.py:
--------------------------------------------------------------------------------
1 | """
2 | Generate a large batch of image samples from a model and save them as a large
3 | numpy array. This can be used to produce samples for FID evaluation.
4 | """
5 |
6 | import argparse
7 | import os
8 | import numpy as np
9 | import torch as th
10 | import torch.distributed as dist
11 | from improved_diffusion import dist_util, logger
12 | from improved_diffusion.script_util import (
13 | model_and_diffusion_testdefaults_omni,
14 | create_model_and_diffusion,
15 | add_dict_to_argparser,
16 | args_to_dict,
17 | )
18 |
19 |
20 | def main():
21 | args = create_argparser().parse_args()
22 |
23 | dist_util.setup_dist()
24 | logger.configure()
25 |
26 | logger.log("creating model and diffusion...")
27 | model, diffusion = create_model_and_diffusion(
28 | **args_to_dict(args, model_and_diffusion_testdefaults_omni().keys())
29 | )
30 | model.load_state_dict(dist_util.load_state_dict(args.model_path, map_location="cpu"))
31 | model.to(dist_util.dev())
32 | model.eval()
33 |
34 | logger.log("sampling...")
35 | all_images = []
36 | all_labels = []
37 | if args.class_cond:
38 | allclasses = th.arange(0, args.num_class, device=dist_util.dev())
39 |
40 |
41 |
42 | for i in range(args.num_samples):
43 | os.makedirs(os.path.join(args.save_path), exist_ok=True)
44 |
45 |
46 | model_kwargs = {}
47 | if args.class_cond:
48 | classes = allclasses[np.random.randint(args.num_class,size=args.batch_size)]
49 | model_kwargs["y"] = classes
50 | sample_fn = (
51 | diffusion.p_sample_loop if not args.use_ddim else diffusion.ddim_sample_loop
52 | )
53 | sample = sample_fn(
54 | model,
55 | (args.batch_size, 18, args.image_size, args.image_size),
56 | #noise=noise,
57 | clip_denoised=args.clip_denoised,
58 | model_kwargs=model_kwargs,progress=True
59 | )
60 |
61 |
62 | gathered_samples = [th.zeros_like(sample) for _ in range(dist.get_world_size())]
63 | dist.all_gather(gathered_samples, sample) # gather not supported with NCCL
64 | all_images.extend([sample.cpu().numpy() for sample in gathered_samples])
65 | if args.class_cond:
66 | gathered_labels = [
67 | th.zeros_like(classes) for _ in range(dist.get_world_size())
68 | ]
69 | dist.all_gather(gathered_labels, classes)
70 | all_labels.extend([labels.cpu().numpy() for labels in gathered_labels])
71 | logger.log(f"created {len(all_images) * args.batch_size} samples")
72 |
73 | arr = np.concatenate(all_images, axis=0)
74 | if args.class_cond:
75 | label_arr = np.concatenate(all_labels, axis=0)
76 | label_arr = label_arr[: args.num_samples]
77 | if dist.get_rank() == 0:
78 | shape_str = "x".join([str(x) for x in arr.shape])
79 | out_path = os.path.join(args.save_path, f"samples_{shape_str}.npz")
80 | logger.log(f"saving to {out_path}")
81 | if args.class_cond:
82 | np.savez_compressed(out_path, triplane=arr, label=label_arr)
83 | else:
84 | np.savez_compressed(out_path, triplane=arr)
85 |
86 | dist.barrier()
87 | logger.log("sampling complete")
88 |
89 |
90 | def create_argparser():
91 | defaults = dict(
92 | clip_denoised=True,
93 | num_samples=5000,
94 | batch_size=1,
95 | num_class=216,
96 | use_ddim=False,
97 | model_path="./omni/model.pt", # checkpoint of diffusion
98 | save_path='./Checkpoint_all/difftf_omni', #save path
99 | )
100 | defaults.update(model_and_diffusion_testdefaults_omni())
101 | parser = argparse.ArgumentParser()
102 | add_dict_to_argparser(parser, defaults)
103 | return parser
104 |
105 |
106 | if __name__ == "__main__":
107 | main()
108 |
--------------------------------------------------------------------------------
/3dDiffusion/scripts/image_sample_shapenet.py:
--------------------------------------------------------------------------------
1 | """
2 | Generate a large batch of image samples from a model and save them as a large
3 | numpy array. This can be used to produce samples for FID evaluation.
4 | """
5 |
6 | import argparse
7 | import os
8 | import numpy as np
9 | import torch as th
10 | import torch.distributed as dist
11 | from improved_diffusion import dist_util, logger
12 | from improved_diffusion.script_util import (
13 | model_and_diffusion_testdefaults_shapenet,
14 | create_model_and_diffusion,
15 | add_dict_to_argparser,
16 | args_to_dict,
17 | )
18 |
19 |
20 | def main():
21 | args = create_argparser().parse_args()
22 |
23 | dist_util.setup_dist()
24 | logger.configure()
25 |
26 | logger.log("creating model and diffusion...")
27 | model, diffusion = create_model_and_diffusion(
28 | **args_to_dict(args, model_and_diffusion_testdefaults_shapenet().keys())
29 | )
30 | model.load_state_dict(dist_util.load_state_dict(args.model_path, map_location="cpu"))
31 | model.to(dist_util.dev())
32 | model.eval()
33 |
34 | logger.log("sampling...")
35 | all_images = []
36 | all_labels = []
37 | if args.class_cond:
38 | allclasses = th.arange(0, args.num_class, device=dist_util.dev())
39 |
40 |
41 |
42 | for i in range(args.num_samples):
43 | os.makedirs(os.path.join(args.save_path), exist_ok=True)
44 |
45 |
46 | model_kwargs = {}
47 | if args.class_cond:
48 | classes = allclasses[np.random.randint(args.num_class,size=args.batch_size)]
49 | model_kwargs["y"] = classes
50 | sample_fn = (
51 | diffusion.p_sample_loop if not args.use_ddim else diffusion.ddim_sample_loop
52 | )
53 | sample = sample_fn(
54 | model,
55 | (args.batch_size, 18, args.image_size, args.image_size),
56 | #noise=noise,
57 | clip_denoised=args.clip_denoised,
58 | model_kwargs=model_kwargs,progress=True
59 | )
60 |
61 |
62 | gathered_samples = [th.zeros_like(sample) for _ in range(dist.get_world_size())]
63 | dist.all_gather(gathered_samples, sample) # gather not supported with NCCL
64 | all_images.extend([sample.cpu().numpy() for sample in gathered_samples])
65 | if args.class_cond:
66 | gathered_labels = [
67 | th.zeros_like(classes) for _ in range(dist.get_world_size())
68 | ]
69 | dist.all_gather(gathered_labels, classes)
70 | all_labels.extend([labels.cpu().numpy() for labels in gathered_labels])
71 | logger.log(f"created {len(all_images) * args.batch_size} samples")
72 |
73 | arr = np.concatenate(all_images, axis=0)
74 | if args.class_cond:
75 | label_arr = np.concatenate(all_labels, axis=0)
76 | label_arr = label_arr[: args.num_samples]
77 | if dist.get_rank() == 0:
78 | shape_str = "x".join([str(x) for x in arr.shape])
79 | out_path = os.path.join(args.save_path, f"samples_{shape_str}.npz")
80 | logger.log(f"saving to {out_path}")
81 | if args.class_cond:
82 | np.savez_compressed(out_path, triplane=arr, label=label_arr)
83 | else:
84 | np.savez_compressed(out_path, triplane=arr)
85 |
86 | dist.barrier()
87 | logger.log("sampling complete")
88 |
89 |
90 | def create_argparser():
91 | defaults = dict(
92 | clip_denoised=True,
93 | num_samples=5000,
94 | batch_size=1,
95 | num_class=1,
96 | use_ddim=False,
97 | model_path="./shapenet/model.pt", # checkpoint of diffusion
98 | save_path='./Checkpoint_all/difftf_shapenet', #save path
99 | )
100 | defaults.update(model_and_diffusion_testdefaults_shapenet())
101 | parser = argparse.ArgumentParser()
102 | add_dict_to_argparser(parser, defaults)
103 | return parser
104 |
105 |
106 | if __name__ == "__main__":
107 | main()
108 |
--------------------------------------------------------------------------------
/3dDiffusion/scripts/image_train.py:
--------------------------------------------------------------------------------
1 | """
2 | Train a diffusion model on images.
3 | """
4 |
5 | import sys, os
6 | current = os.path.dirname(os.path.realpath(__file__))
7 | sys.path.append(current + "/../")
8 |
9 | import argparse
10 |
11 | from improved_diffusion import dist_util, logger
12 | from improved_diffusion.triplane_datasets_omni import load_triplane_data
13 | from improved_diffusion.resample import create_named_schedule_sampler
14 | from improved_diffusion.script_util import (
15 | model_and_diffusion_defaults_omni,
16 | create_model_and_diffusion,
17 | args_to_dict,
18 | add_dict_to_argparser,
19 | )
20 | from improved_diffusion.train_util import TrainLoop
21 | from torch.utils.tensorboard import SummaryWriter
22 | import torch.distributed as dist
23 | import torch
24 | def main():
25 | args = create_argparser().parse_args()
26 |
27 | dist_util.setup_dist()
28 | logger.configure(dir=args.log_dir)
29 |
30 | if dist.get_rank() == 0:
31 | writer = SummaryWriter(os.path.join(args.log_dir, "runs"))
32 | else:
33 | writer = None
34 |
35 | logger.log("creating model and diffusion...")
36 | model, diffusion = create_model_and_diffusion(
37 | **args_to_dict(args, model_and_diffusion_defaults_omni().keys())
38 | )
39 | model.to(dist_util.dev())
40 | schedule_sampler = create_named_schedule_sampler(args.schedule_sampler, diffusion)
41 |
42 | logger.log("creating data loader...")
43 |
44 | data = load_triplane_data(
45 | data_dir=args.datasetdir,
46 | batch_size=args.batch_size,
47 | image_size=args.image_size,
48 | class_cond=args.class_cond,
49 | )
50 |
51 | logger.log("training...")
52 | TrainLoop(
53 | model=model,
54 | diffusion=diffusion,
55 | data=data,
56 | batch_size=args.batch_size,
57 | microbatch=args.microbatch,
58 | lr=args.lr,
59 | ema_rate=args.ema_rate,
60 | log_interval=args.log_interval,
61 | save_interval=args.save_interval,
62 | resume_checkpoint=args.resume_checkpoint,
63 | use_fp16=args.use_fp16,
64 | fp16_scale_growth=args.fp16_scale_growth,
65 | schedule_sampler=schedule_sampler,
66 | weight_decay=args.weight_decay,
67 | lr_anneal_steps=args.lr_anneal_steps,
68 | writer=writer,
69 | ).run_loop()
70 | if dist.get_rank() == 0:
71 | writer.close()
72 |
73 |
74 | def create_argparser():
75 | datasetdir='./omni/triplane' #triplanes path
76 | data_dir="./Checkpoint_all/" #checkpoint path
77 | expname='difftf'
78 | defaults = dict(
79 | data_name="omni", #omni or shapenet
80 | clip_denoised=False,
81 | data_dir=data_dir,
82 | datasetdir=datasetdir,
83 | log_dir=data_dir+expname,
84 | schedule_sampler="uniform",
85 | lr=1e-4,
86 | num_class=216, #omniobject3d has 216 categories
87 | weight_decay=1e-4,
88 | lr_anneal_steps=0,
89 | batch_size=4,
90 | microbatch=-1,
91 | ema_rate="0.9999",
92 | log_interval=10,
93 | save_interval=50000,
94 | resume_checkpoint="",
95 | use_fp16=False,
96 | fp16_scale_growth=1e-3,
97 | )
98 |
99 | defaults.update(model_and_diffusion_defaults_omni())
100 | parser = argparse.ArgumentParser()
101 | add_dict_to_argparser(parser, defaults)
102 | return parser
103 |
104 |
105 | if __name__ == "__main__":
106 | main()
107 |
--------------------------------------------------------------------------------
/3dDiffusion/scripts/image_train_shapenet.py:
--------------------------------------------------------------------------------
1 | """
2 | Train a diffusion model on images.
3 | """
4 |
5 | import sys, os
6 | current = os.path.dirname(os.path.realpath(__file__))
7 | sys.path.append(current + "/../")
8 |
9 | import argparse
10 |
11 | from improved_diffusion import dist_util, logger
12 | from improved_diffusion.triplane_datasets_shapenet import load_triplane_data
13 | from improved_diffusion.resample import create_named_schedule_sampler
14 | from improved_diffusion.script_util import (
15 | model_and_diffusion_defaults_shapenet,
16 | create_model_and_diffusion,
17 | args_to_dict,
18 | add_dict_to_argparser,
19 | )
20 | from improved_diffusion.train_util import TrainLoop
21 | from torch.utils.tensorboard import SummaryWriter
22 | import torch.distributed as dist
23 | import torch
24 | def main():
25 | args = create_argparser().parse_args()
26 |
27 | dist_util.setup_dist()
28 | logger.configure(dir=args.log_dir)
29 |
30 | if dist.get_rank() == 0:
31 | writer = SummaryWriter(os.path.join(args.log_dir, "runs"))
32 | else:
33 | writer = None
34 |
35 | logger.log("creating model and diffusion...")
36 | model, diffusion = create_model_and_diffusion(
37 | **args_to_dict(args, model_and_diffusion_defaults_shapenet().keys())
38 | )
39 | model.to(dist_util.dev())
40 | schedule_sampler = create_named_schedule_sampler(args.schedule_sampler, diffusion)
41 |
42 | logger.log("creating data loader...")
43 |
44 | data = load_triplane_data(
45 | data_dir=args.datasetdir,
46 | batch_size=args.batch_size,
47 | image_size=args.image_size,
48 | class_cond=args.class_cond,
49 | )
50 |
51 | logger.log("training...")
52 | TrainLoop(
53 | model=model,
54 | diffusion=diffusion,
55 | data=data,
56 | batch_size=args.batch_size,
57 | microbatch=args.microbatch,
58 | lr=args.lr,
59 | ema_rate=args.ema_rate,
60 | log_interval=args.log_interval,
61 | save_interval=args.save_interval,
62 | resume_checkpoint=args.resume_checkpoint,
63 | use_fp16=args.use_fp16,
64 | fp16_scale_growth=args.fp16_scale_growth,
65 | schedule_sampler=schedule_sampler,
66 | weight_decay=args.weight_decay,
67 | lr_anneal_steps=args.lr_anneal_steps,
68 | writer=writer,
69 | ).run_loop()
70 | if dist.get_rank() == 0:
71 | writer.close()
72 |
73 |
74 | def create_argparser():
75 | datasetdir='./shapenet/triplane' #triplanes path
76 | data_dir="./Checkpoint_all/" #checkpoint path
77 | expname='difftf'
78 | defaults = dict(
79 | data_name="shapenet", #omni or shapenet
80 | clip_denoised=False,
81 | data_dir=data_dir,
82 | datasetdir=datasetdir,
83 | log_dir=data_dir+expname,
84 | schedule_sampler="uniform",
85 | lr=1e-4,
86 | weight_decay=1e-4,
87 | num_class=1, # we train the diffusion on a single categoreis. You can train it on more categories.
88 | lr_anneal_steps=0,
89 | batch_size=4,
90 | microbatch=-1,
91 | ema_rate="0.9999",
92 | log_interval=10,
93 | save_interval=50000,
94 | resume_checkpoint="",
95 | use_fp16=False,
96 | fp16_scale_growth=1e-3,
97 | )
98 |
99 | defaults.update(model_and_diffusion_defaults_shapenet())
100 | parser = argparse.ArgumentParser()
101 | add_dict_to_argparser(parser, defaults)
102 | return parser
103 |
104 |
105 | if __name__ == "__main__":
106 | main()
107 |
--------------------------------------------------------------------------------
/3dDiffusion/setup.py:
--------------------------------------------------------------------------------
1 | from setuptools import setup
2 |
3 | setup(
4 | name="improved-diffusion",
5 | py_modules=["improved_diffusion"],
6 | install_requires=["blobfile==2.0.2", "tqdm"],
7 | )
--------------------------------------------------------------------------------
/LICENCE:
--------------------------------------------------------------------------------
1 | S-Lab License 1.0
2 |
3 | Copyright 2023 S-Lab
4 |
5 | Redistribution and use for non-commercial purpose in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
7 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
8 | 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
9 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
10 | 4. In the event that redistribution and/or use for commercial purpose in source or binary forms, with or without modification is required, please contact the contributor(s) of the work.
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 |
Large-Vocabulary 3D Diffusion Model with Transformer
4 |
5 |
12 |
13 | 1S-Lab, Nanyang Technological University 2The Chinese University of Hong Kong; 3Shanghai AI Laboratory
14 |
15 |
21 |
22 |
23 |
24 |
DiffTF can generate large-vocabulary 3D objects with rich semantics and realistic texture.
25 |
26 |
27 |

28 |
29 | :open_book: For more visual results, go checkout our
project page
30 |
31 |
32 | ## Installation
33 |
34 | Clone this repository and navigate to it in your terminal. Then run:
35 |
36 | ```python
37 | bash install_difftf.sh
38 | ```
39 |
40 | This will install the related python package that the scripts depend on.
41 |
42 | ## Preparing data
43 |
44 | [ShapeNet]: dataset/ShapeNet/README.md
45 | [OmniObject3D]: dataset/OmniObject3D/README.md
46 |
47 | ## Training
48 |
49 | #### I. Triplane fitting
50 |
51 | ##### 1. Training the shared decoder
52 |
53 | ```python
54 | conda activate difftf
55 | export CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7
56 | #Omniobject3D
57 | python -m torch.distributed.launch --nproc_per_node 8 ./Triplanerecon/train.py --config ./Triplanerecon/configs/omni/train.txt \\
58 | --datadir ./dataset/Omniobject3D/renders \\# dataset path
59 | --basedir ./Checkpoint \\# basepath
60 | --expname omni_sharedecoder \\# the ckpt will save in ./Checkpoint/omni_sharedecoder
61 | #ShapeNet
62 | python -m torch.distributed.launch --nproc_per_node 8 ./Triplanerecon/train.py --config ./Triplanerecon/configs/shapenet_car/train.txt \\
63 | --datadir ./dataset/ShapeNet/renders_car
64 | --basedir ./Checkpoint \\# basepath
65 | --expname shapenet_sharedecoder \\# the ckpt will save in ./Checkpoint/shapenet_car_sharedecoder
66 | ```
67 |
68 | ##### 2. Triplane fitting
69 |
70 | ```python
71 | conda activate difftf
72 | #Omniobject3D
73 | python ./Triplanerecon/train_single_omni.py \\
74 | --config ./Triplanerecon/configs/omni/train_single.txt \\ #config path
75 | --num_gpu 1 --idx 0 \\ #using 1gpu to fit triplanes
76 | --datadir ./dataset/Omniobject3D/renders \\# dataset path
77 | --basedir ./Checkpoint \\# basepath
78 | --expname omni_triplane \\# triplanes will save in ./Checkpoint/omni_triplane
79 | --decoderdir ./Checkpoint/omni_sharedecoder/300000.tar # ckpt of shared decoder
80 |
81 | #ShapeNet
82 | python ./Triplanerecon/train_single_shapenet.py \\
83 | --config ./Triplanerecon/configs/shapenet_car/train_single.txt \\
84 | --num_gpu 1 --idx 0 \\ #using 1gpu to fit triplanes
85 | --datadir ./dataset/ShapeNet/renders_car \\# dataset path
86 | --basedir ./Checkpoint \\# basepath
87 | --expname shapenet_triplane \\# triplanes will save in ./Checkpoint/shapenet_triplane
88 | --decoderdir ./Checkpoint/shapenet_sharedecoder/300000.tar # ckpt of shared decoder
89 |
90 | #Using 8 gpus
91 | bash multi_omni.sh 8
92 | #Using 8 gpus
93 | bash multi_shapenet.sh 8
94 | ```
95 |
96 | **Note**: We input the related hyperparameters and settings in the config files. You can find them in `./configs/shapenet` or `./configs/omni`.
97 |
98 | ##### 3. Preparing triplane for diffusion
99 |
100 | ```python
101 | #preparing triplanes for training diffusion
102 | python ./Triplanerecon/extract.py
103 | --basepath ./Checkpoint/omni_triplane \\ # path of triplanes
104 | --mode omni \\ # name of dataset (omni or shapenet)
105 | --newpath ./Checkpoint/omni_triplane_fordiffusion #new path of triplanes
106 | ```
107 |
108 | #### II. Training Diffusion
109 |
110 | ```python
111 | cd ./3dDiffusion
112 | export PYTHONPATH=$PWD:$PYTHONPATH
113 | conda activate difftf
114 | cd scripts
115 | python image_train.py
116 | --datasetdir ./Checkpoint/omni_triplane_fordiffusion #path to fitted triplanes
117 | --expname difftf_omni #ckpt will save in ./Checkpoint/difftf_omni
118 | ```
119 |
120 | You may also want to train in a distributed manner. In this case, run the same command with `mpiexec`:
121 |
122 | ```python
123 | mpiexec -n 8 python image_train.py
124 | --datasetdir ./Checkpoint/omni_triplane_fordiffusion #path to fitted triplanes
125 | --expname difftf_omni #ckpt will save in ./Checkpoint/difftf_omni
126 | ```
127 |
128 | **Note**: Hyperparameters about training are set in `image_train.py` while hyperparameters about architecture are set in `./improved_diffusion/script_util.py`.
129 |
130 | **Note**: Our fitted triplane can be downloaded via this [link](https://entuedu-my.sharepoint.com/:u:/g/personal/ziang001_e_ntu_edu_sg/ES7t444P0UxCjX43vBdp9b4BXAoGwTaC0elK33uRhBZHVQ?e=7PHNub).
131 |
132 | ## Inference
133 |
134 | #### I. Sampling triplane using trained diffusion
135 |
136 | Our pre-trained model can be founded in [difftf_checkpoint/omni](https://entuedu-my.sharepoint.com/:f:/g/personal/ziang001_e_ntu_edu_sg/Ev851G-N2oRIsdFfwAXc8LsBGY3MZYIuaxgHDAGQkKIb6g?e=DFpUDy)
137 |
138 | ```python
139 | python image_sample.py \\
140 | --model_path ./Checkpoint/difftf_omni/model.pt #checkpoint_path
141 | --num_samples=5000
142 | --save_path ./Checkpoint/difftf_omni # path of the generated triplanes
143 | ```
144 |
145 | #### II. Rendering triplane using shared decoder
146 |
147 | Our pre-trained share decoder can be founded in [difftf_checkpoint/triplane decoder.zip](https://entuedu-my.sharepoint.com/:f:/g/personal/ziang001_e_ntu_edu_sg/Ev851G-N2oRIsdFfwAXc8LsBGY3MZYIuaxgHDAGQkKIb6g?e=DFpUDy)
148 |
149 | ```python
150 | python ddpm_vis.py --config ./configs/omni/ddpm.txt
151 | --ft_path ./Checkpoint/omni_triplane_fordiffusion/003000.tar #path of shared decoder
152 | --triplanepath ./Checkpoint/difftf_omni/samples_5000x18x256x256.npz # path of generated triplanes
153 | --basedir ./Checkpoint \\# basepath
154 | --expname ddpm_omni_vis \\# triplanes will save in ./Checkpoint/omni_triplane
155 | --mesh 0 \\# whether to save mesh
156 | --testvideo \\# whether to save all images using video
157 |
158 | python ddpm_vis.py --config ./configs/shapenet_car/ddpm.txt
159 | --ft_path ./Checkpoint/shapenet_car_triplane_fordiffusion/003000.tar #path of shared decoder
160 | --triplanepath ./Checkpoint/difftf_shapenet/samples_5000x18x256x256.npz # path of generated triplanes
161 | --basedir ./Checkpoint \\# basepath
162 | --expname ddpm_shapenet_vis \\# triplanes will save in ./Checkpoint/omni_triplane
163 | --mesh 0 \\# whether to save mesh
164 | --testvideo \\# whether to save all images using video
165 | ```
166 |
167 | ## References
168 |
169 | If you find DiffTF useful for your work please cite:
170 | ```
171 | @article{cao2023large,
172 | title={Large-Vocabulary 3D Diffusion Model with Transformer},
173 | author={Cao, Ziang and Hong, Fangzhou and Wu, Tong and Pan, Liang and Liu, Ziwei},
174 | journal={arXiv preprint arXiv:2309.07920},
175 | year={2023}
176 | }
177 | ```
178 | ##### Acknowledgement
179 |
180 | The code is implemented based on [improved-diffusion](https://github.com/openai/improved-diffusion) and [nerf-pytorch](https://github.com/yenchenlin/nerf-pytorch). We would like to express our sincere thanks to the contributors.
181 |
182 | ## :newspaper_roll: License
183 |
184 | Distributed under the S-Lab License. See `LICENSE` for more information.
185 |
186 |
187 |
--------------------------------------------------------------------------------
/Triplanerecon/__pycache__/configparse.cpython-310.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ziangcao0312/DiffTF/296ba1bed593fd9b4aae242f453a2e8c1750cebe/Triplanerecon/__pycache__/configparse.cpython-310.pyc
--------------------------------------------------------------------------------
/Triplanerecon/__pycache__/configparse.cpython-38.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ziangcao0312/DiffTF/296ba1bed593fd9b4aae242f453a2e8c1750cebe/Triplanerecon/__pycache__/configparse.cpython-38.pyc
--------------------------------------------------------------------------------
/Triplanerecon/__pycache__/load_LINEMOD.cpython-38.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ziangcao0312/DiffTF/296ba1bed593fd9b4aae242f453a2e8c1750cebe/Triplanerecon/__pycache__/load_LINEMOD.cpython-38.pyc
--------------------------------------------------------------------------------
/Triplanerecon/__pycache__/load_blender.cpython-38.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ziangcao0312/DiffTF/296ba1bed593fd9b4aae242f453a2e8c1750cebe/Triplanerecon/__pycache__/load_blender.cpython-38.pyc
--------------------------------------------------------------------------------
/Triplanerecon/__pycache__/load_deepvoxels.cpython-38.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ziangcao0312/DiffTF/296ba1bed593fd9b4aae242f453a2e8c1750cebe/Triplanerecon/__pycache__/load_deepvoxels.cpython-38.pyc
--------------------------------------------------------------------------------
/Triplanerecon/__pycache__/load_llff.cpython-38.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ziangcao0312/DiffTF/296ba1bed593fd9b4aae242f453a2e8c1750cebe/Triplanerecon/__pycache__/load_llff.cpython-38.pyc
--------------------------------------------------------------------------------
/Triplanerecon/__pycache__/omni_dataset.cpython-38.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ziangcao0312/DiffTF/296ba1bed593fd9b4aae242f453a2e8c1750cebe/Triplanerecon/__pycache__/omni_dataset.cpython-38.pyc
--------------------------------------------------------------------------------
/Triplanerecon/__pycache__/omni_dataset_ddpm.cpython-38.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ziangcao0312/DiffTF/296ba1bed593fd9b4aae242f453a2e8c1750cebe/Triplanerecon/__pycache__/omni_dataset_ddpm.cpython-38.pyc
--------------------------------------------------------------------------------
/Triplanerecon/__pycache__/omni_dataset_single.cpython-38.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ziangcao0312/DiffTF/296ba1bed593fd9b4aae242f453a2e8c1750cebe/Triplanerecon/__pycache__/omni_dataset_single.cpython-38.pyc
--------------------------------------------------------------------------------
/Triplanerecon/__pycache__/our_dataset.cpython-38.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ziangcao0312/DiffTF/296ba1bed593fd9b4aae242f453a2e8c1750cebe/Triplanerecon/__pycache__/our_dataset.cpython-38.pyc
--------------------------------------------------------------------------------
/Triplanerecon/__pycache__/our_dataset_ddp.cpython-38.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ziangcao0312/DiffTF/296ba1bed593fd9b4aae242f453a2e8c1750cebe/Triplanerecon/__pycache__/our_dataset_ddp.cpython-38.pyc
--------------------------------------------------------------------------------
/Triplanerecon/__pycache__/run_nerf_helpers.cpython-38.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ziangcao0312/DiffTF/296ba1bed593fd9b4aae242f453a2e8c1750cebe/Triplanerecon/__pycache__/run_nerf_helpers.cpython-38.pyc
--------------------------------------------------------------------------------
/Triplanerecon/__pycache__/shape_utils.cpython-38.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ziangcao0312/DiffTF/296ba1bed593fd9b4aae242f453a2e8c1750cebe/Triplanerecon/__pycache__/shape_utils.cpython-38.pyc
--------------------------------------------------------------------------------
/Triplanerecon/__pycache__/shapenet_dataset.cpython-38.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ziangcao0312/DiffTF/296ba1bed593fd9b4aae242f453a2e8c1750cebe/Triplanerecon/__pycache__/shapenet_dataset.cpython-38.pyc
--------------------------------------------------------------------------------
/Triplanerecon/__pycache__/shapenet_dataset_all.cpython-38.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ziangcao0312/DiffTF/296ba1bed593fd9b4aae242f453a2e8c1750cebe/Triplanerecon/__pycache__/shapenet_dataset_all.cpython-38.pyc
--------------------------------------------------------------------------------
/Triplanerecon/__pycache__/shapenet_dataset_ddpm.cpython-38.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ziangcao0312/DiffTF/296ba1bed593fd9b4aae242f453a2e8c1750cebe/Triplanerecon/__pycache__/shapenet_dataset_ddpm.cpython-38.pyc
--------------------------------------------------------------------------------
/Triplanerecon/__pycache__/shapenet_dataset_single.cpython-38.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ziangcao0312/DiffTF/296ba1bed593fd9b4aae242f453a2e8c1750cebe/Triplanerecon/__pycache__/shapenet_dataset_single.cpython-38.pyc
--------------------------------------------------------------------------------
/Triplanerecon/configs/omni/ddpm.txt:
--------------------------------------------------------------------------------
1 | expname = difftf_vis
2 | basedir = ./Checkpoint_all/
3 | triplanepath=./Checkpoint_all/diffusion_rodin/samples_5000x18x256x256.npz
4 | ft_path=./3D_generation/omni/003000.tar
5 | state=testddpm
6 | no_batching = True
7 | train_test=1
8 | triplanechannel=18
9 | chunk=8000
10 | num_instance=1
11 | batch_size=1
12 | testvideo=0
13 | dataset=omni
14 | pos_rate=0.5
15 | mesh=1
16 | mesh_color=0
17 | mesh_mode=.obj
18 | shape_res=128
19 |
20 | use_viewdirs = True
21 | white_bkgd = False
22 | lrate_decay = 500
23 | netdepth=1
24 | netwidth=128
25 | box_warp=4.0
26 |
27 | N_samples = 128
28 | N_importance = 128
29 | N_rand = 8192
30 | multires_views=10
31 |
32 | precrop_iters = 0
33 | precrop_frac = 0.5
34 |
35 | half_res = False
36 |
--------------------------------------------------------------------------------
/Triplanerecon/configs/omni/test_single.txt:
--------------------------------------------------------------------------------
1 | expname = difftf_triplanes_omni
2 | basedir = ./Checkpoint_all
3 | datadir = path to data
4 | state=test_single
5 | no_batching = True
6 | train_test=0.95
7 | triplanechannel=18
8 | triplanesize=256
9 | chunk=8000
10 | num_instance=0
11 | batch_size=1
12 | dataset=omni
13 |
14 | use_viewdirs = True
15 | white_bkgd = False
16 | lrate_decay = 500
17 | netdepth=1
18 | netwidth=128
19 | box_warp=4.0
20 |
21 | N_samples = 128
22 | N_importance = 128
23 | N_rand = 4096
24 | multires_views=10
25 |
26 | precrop_iters = 0
27 | precrop_frac = 0.5
28 |
29 | half_res = False
30 |
--------------------------------------------------------------------------------
/Triplanerecon/configs/omni/train.txt:
--------------------------------------------------------------------------------
1 | expname = difftf_share_decoder_omni
2 | basedir = ./Checkpoint_all
3 | datadir = path to data
4 | load_weight =0
5 | no_batching = True
6 | train_test=1
7 | triplanechannel=18
8 | triplanesize=256
9 | num_instance=1
10 | batch_size=1
11 | num_worker=0
12 | N_iters=300001
13 | lrate=1e-2
14 | dataset=omni
15 | ddp=1
16 | pos_rate=0.5
17 |
18 | use_viewdirs = True
19 | white_bkgd = False
20 | lrate_decay = 100
21 | netdepth=1
22 | netwidth=128
23 | box_warp=4.0
24 |
25 | N_samples = 128
26 | N_importance = 128
27 | N_rand = 4096
28 | multires_views=10
29 |
30 | precrop_iters = 0
31 | precrop_frac = 0.5
32 | i_weights=50000
33 |
34 | half_res = False
35 |
--------------------------------------------------------------------------------
/Triplanerecon/configs/omni/train_single.txt:
--------------------------------------------------------------------------------
1 | expname = difftf_triplanes_omni
2 | basedir = ./Checkpoint_all
3 | datadir = path to data
4 | decoderdir = ./Checkpoint_all/difftf_share_decoder_omni/003000.tar
5 | load_weight =0
6 | finetune =0
7 |
8 | state=train_single
9 | no_batching = True
10 | train_test=1
11 | triplanechannel=18
12 | triplanesize=256
13 | num_instance=1
14 | batch_size=1
15 | num_worker=0
16 | N_iters=3001
17 | lrate=1e-1
18 | dataset=omni
19 | pos_rate=0.2
20 |
21 | use_viewdirs = True
22 | white_bkgd = False
23 | lrate_decay = 6
24 | netdepth=1
25 | netwidth=128
26 | box_warp=4.0
27 | i_print=100
28 |
29 | N_samples = 128
30 | N_importance = 128
31 | N_rand = 4096
32 | multires_views=10
33 |
34 | precrop_iters = 0
35 | precrop_frac = 0.5
36 | i_weights=3000
37 |
38 | half_res = False
39 |
--------------------------------------------------------------------------------
/Triplanerecon/configs/shapenet_car/ddpm.txt:
--------------------------------------------------------------------------------
1 | expname = ddpm_car
2 | basedir = ./Checkpoint_all
3 | datadir = ./Triplanerecon/shapenet_pose
4 | triplanepath=./Checkpoint_all/samples_8x18x256x256_0.npz
5 | ft_path=./Checkpoint_all/shapenet_car/003000.tar
6 | state=testddpm
7 | no_batching = True
8 | train_test=1
9 | triplanechannel=18
10 | chunk=16384
11 | num_instance=1
12 | batch_size=1
13 | testvideo=0
14 | dataset=shapenet
15 | pos_rate=0.5
16 | mesh=1
17 | mesh_color=0
18 | mesh_mode=.obj
19 | shape_res=128
20 |
21 | use_viewdirs = True
22 | white_bkgd = True
23 | lrate_decay = 500
24 | netdepth=1
25 | netwidth=128
26 | box_warp=2.0
27 |
28 | N_samples = 128
29 | N_importance = 128
30 | N_rand = 8192
31 | multires_views=10
32 |
33 | precrop_iters = 0
34 | precrop_frac = 0.5
35 |
36 | half_res = False
37 |
--------------------------------------------------------------------------------
/Triplanerecon/configs/shapenet_car/test_single.txt:
--------------------------------------------------------------------------------
1 | expname = difftf_triplanes_shapenet_car
2 | basedir = ./Checkpoint_all
3 | datadir = path to data
4 | state=test_single
5 | no_batching = True
6 | train_test=0.95
7 | triplanechannel=18
8 | triplanesize=256
9 | chunk=4096
10 | num_instance=0
11 | batch_size=1
12 | dataset=shapenet
13 |
14 | use_viewdirs = True
15 | white_bkgd = True
16 | lrate_decay = 3
17 | netdepth=1
18 | netwidth=128
19 | box_warp=2.0
20 |
21 | N_samples = 128
22 | N_importance = 128
23 | N_rand = 8192
24 | multires_views=10
25 |
26 | precrop_iters = 0
27 | precrop_frac = 0.5
28 | i_weights=3000
29 |
30 | half_res = False
31 |
--------------------------------------------------------------------------------
/Triplanerecon/configs/shapenet_car/train.txt:
--------------------------------------------------------------------------------
1 | expname = nerf-pytorch_finalcode_ddp_triplane_shapenet_chair_new_new
2 | basedir = /mnt/petrelfs/caoziang/3D_generation/Checkpoint_all
3 | datadir = /mnt/petrelfs/share_data/hongfangzhou.p/shapenet/renders/03001627_view200_r1.2
4 | load_weight =0
5 | no_batching = True
6 | train_test=1
7 | triplanechannel=18
8 | triplanesize=256
9 | num_instance=1
10 | batch_size=1
11 | num_worker=0
12 | N_iters=300001
13 | lrate=1e-2
14 | dataset=shapenet
15 | ddp=1
16 | pos_rate=0.5
17 |
18 | use_viewdirs = True
19 | white_bkgd = True
20 | lrate_decay = 100
21 | netdepth=1
22 | netwidth=128
23 | box_warp=2.0
24 |
25 | N_samples = 128
26 | N_importance = 128
27 | N_rand = 4096
28 | multires_views=10
29 |
30 | precrop_iters = 0
31 | precrop_frac = 0.5
32 | i_weights=50000
33 |
34 | half_res = False
35 |
--------------------------------------------------------------------------------
/Triplanerecon/configs/shapenet_car/train_single.txt:
--------------------------------------------------------------------------------
1 | expname = difftf_triplanes_shapenet_car
2 | basedir = ./Checkpoint_all
3 | datadir = path to data
4 | decoderdir = ./Checkpoint_all/difftf_share_decoder_shapenet_car/003000.tar
5 | load_weight =0
6 | finetune =0
7 |
8 | state=train_single
9 | no_batching = True
10 | train_test=1
11 | triplanechannel=18
12 | triplanesize=256
13 | num_instance=1
14 | batch_size=1
15 | num_worker=0
16 | N_iters=3001
17 | lrate=1e-1
18 | perturb=1
19 | dataset=shapenet
20 | pos_rate=1
21 |
22 | use_viewdirs = True
23 | white_bkgd = True
24 | lrate_decay = 3
25 | netdepth=1
26 | netwidth=128
27 | box_warp=2.0
28 |
29 | N_samples = 128
30 | N_importance = 128
31 | N_rand = 4096
32 | multires_views=10
33 |
34 | precrop_iters = 0
35 | precrop_frac = 0.5
36 | i_weights=3000
37 |
38 | half_res = False
39 |
40 |
--------------------------------------------------------------------------------
/Triplanerecon/ddpm_vis.py:
--------------------------------------------------------------------------------
1 | import os, sys
2 | import numpy as np
3 | import imageio
4 | import json
5 | import random
6 | import time
7 | import torch
8 | import torch.nn as nn
9 | import torch.nn.functional as F
10 | from tqdm import tqdm, trange
11 | from configparse import config_parser
12 | import matplotlib.pyplot as plt
13 | import ipdb
14 | from run_nerf_helpers import *
15 | from torch.utils.data import DataLoader
16 | import logging
17 |
18 | parser = config_parser()
19 | args = parser.parse_args()
20 |
21 | def testddpm(args):
22 | if args.dataset=='omni':
23 | from omni_dataset_ddpm import OurtestddDDataset
24 | elif args.dataset=='shapenet':
25 | from shapenet_dataset_ddpm import OurtestddDDataset
26 | useidx=[]
27 | with torch.no_grad():
28 | triplanes=np.load(args.triplanepath)['triplane']
29 |
30 | if len(useidx)==0:
31 | namelist=np.arange(len(triplanes))
32 | gpunum=args.num_gpu
33 | gpuidx=args.idx
34 | if len(namelist)//gpunum*(gpuidx+1)<=len(namelist):
35 | namelist=namelist[len(namelist)//gpunum*gpuidx:len(namelist)//gpunum*(gpuidx+1)]
36 | elif len(namelist)//gpunum*(gpuidx+1)>len(namelist) and len(namelist)//gpunum*(gpuidx)<=len(namelist):
37 | namelist=namelist[len(namelist)//gpunum*gpuidx:]
38 | else:
39 | return
40 | else:
41 | namelist=useidx
42 | for num in namelist:
43 |
44 | idxx=num
45 | triplane=torch.Tensor(triplanes).cuda()[idxx:idxx+1]
46 |
47 | testdata=OurtestddDDataset(args,args.datadir)
48 | K=None
49 |
50 |
51 | test_loader = DataLoader(testdata, batch_size=1, shuffle=False,pin_memory=False, generator=torch.Generator(device='cuda'))
52 |
53 |
54 | savebasedir = args.basedir
55 | expname = args.expname
56 |
57 | testsavedir = os.path.join(savebasedir, expname, 'test',str(idxx))
58 | os.makedirs(testsavedir, exist_ok=True)
59 |
60 | _, render_kwargs_test, start, optimizer,warmUpScheduler = create_nerf(args)
61 | gt_triplane=render_kwargs_test['network_fn'].tri_planes.clone()
62 | render_kwargs_test['network_fn'].eval().cuda()
63 |
64 | triplane=triplane.view(gt_triplane.shape)
65 |
66 |
67 | rgbss=[]
68 | render_kwargs_test['network_fn'].tri_planes.copy_(triplane)
69 | if args.mesh:
70 | if not os.path.exists(os.path.join(testsavedir+'.ply')) or not os.path.exists(os.path.join(testsavedir+'.obj')):
71 | generate_mesh(args,os.path.join(testsavedir+'.ply'),render_kwargs_test['network_query_fn'],render_kwargs_test['network_fn'])
72 | if args.mesh_color:
73 | '''
74 | Note: Although we provide a simple function that can convert triplane to mesh with texture, generation performance is impeded during conversion.
75 | We recommend using the volume rendering to get better generation performance.
76 | '''
77 | generate_rgbmesh(args,os.path.join(testsavedir+'.ply'),render_kwargs_test['network_query_fn'],render_kwargs_test['network_fn'],render_kwargs_test)
78 | continue
79 | else:
80 | continue
81 |
82 | if args.testvideo and os.path.exists(os.path.join(testsavedir+ 'video.mp4')):
83 | print('skip',testsavedir)
84 | continue
85 |
86 | for i, data in enumerate(test_loader):
87 | batch_rays=data['batch_rays'].cuda()
88 | label=data['label'].cuda().squeeze(-1)
89 | if args.using_depth:
90 | depth_s=1/data['depth_s'][...,0].cuda()
91 | near=data['near'].cuda()
92 | far=data['far'].cuda()
93 |
94 | render_kwargs_test['mode']='test'
95 | rgbs, _,_ = render_path2(batch_rays, args.chunk, render_kwargs_test, label=label,savedir=os.path.join(testsavedir,str(i)+'be.png'),savedir1=os.path.join(testsavedir,str(i)+'ddpm.png'),savedir2=os.path.join(testsavedir,str(i)+'ddpm_acc.png'),savedir3=os.path.join(testsavedir,str(i)+'triplane.png'),near=near,far=far)
96 | print(i)
97 | rgbss.append(rgbs)
98 | if args.testvideo!=1 and i>9:
99 | break
100 |
101 | if args.testvideo:
102 | imageio.mimwrite(os.path.join(testsavedir+ 'video.mp4'), np.stack(rgbss), fps=30, quality=8)
103 |
104 |
105 |
106 |
107 |
108 | if __name__=='__main__':
109 | torch.multiprocessing.set_start_method('spawn')
110 |
111 | torch.set_default_tensor_type('torch.cuda.FloatTensor')
112 |
113 | testddpm(args)
114 |
--------------------------------------------------------------------------------
/Triplanerecon/extract.py:
--------------------------------------------------------------------------------
1 |
2 | import os
3 | import re
4 | import torch
5 | import shutil
6 | import configargparse
7 | parser = configargparse.ArgumentParser()
8 |
9 | parser.add_argument("--basepath", type=str, default='./Checkpoint_all/triplane_omni',
10 | help='path of fitted triplane ')
11 | parser.add_argument("--mode", type=str, default='omni',
12 | help='the name of dataset')
13 | parser.add_argument("--newpath", type=str, default='./Checkpoint_all/triplane_omni_fordiffusion',
14 | help='the newpath of fitted triplane')
15 | args = parser.parse_args()
16 |
17 |
18 | if args.mode=='omni':
19 | basepath=args.basepath
20 | sharedecoderpath=args.newpath
21 | newpath=os.path.join(sharedecoderpath,'triplane')
22 | os.makedirs(os.path.join(newpath), exist_ok=True)
23 | allname=[di for di in os.listdir(basepath) if os.path.isdir(os.path.join(basepath,di))]
24 | allname.sort(key=lambda l: int(re.findall('\d+', l)[0]))
25 | names=os.listdir(newpath)
26 | i=0
27 | max_id=[]
28 | for name in allname:
29 | try:
30 | if name+'.tar' in names:
31 | print(name)
32 | continue
33 | if i==0:
34 | shutil.copyfile(os.path.join(basepath,name,'003000.tar'), os.path.join(sharedecoderpath,'003000.tar'))
35 | alldata=torch.Tensor(torch.load(os.path.join(basepath,name,'003000.tar'),map_location='cpu')['network_fn_state_dict']['tri_planes'])
36 | i=i+1
37 | os.makedirs(os.path.join(newpath, name[:-4]), exist_ok=True)
38 | torch.save(alldata,os.path.join(newpath, name[:-4],name+'.tar'))
39 |
40 | except:
41 | print('unfinished',name)
42 |
43 | print(i)
44 | print(max_id)
45 | else:
46 |
47 | basepath=args.basepath
48 | sharedecoderpath=args.newpath
49 | newpath=os.path.join(sharedecoderpath,'triplane')
50 | allname=[di for di in os.listdir(basepath) if os.path.isdir(os.path.join(basepath,di))]
51 | allname.sort(key=lambda l: int(re.findall('\d+', l)[0]))
52 | names=os.listdir(newpath)
53 | i=0
54 |
55 | max_id=[]
56 | for name in allname:
57 | try:
58 | if name+'.tar' in names:
59 | print(name)
60 | continue
61 | if i==0:
62 | shutil.copyfile(os.path.join(basepath,name,'003000.tar'), os.path.join(sharedecoderpath,'003000.tar'))
63 | alldata=torch.Tensor(torch.load(os.path.join(basepath,name,'003000.tar'),map_location='cpu')['network_fn_state_dict']['tri_planes'])
64 | i=i+1
65 | torch.save(alldata,os.path.join(newpath,name+'.tar'))
66 |
67 |
68 | except:
69 | print('unfinished',name)
70 |
71 | print(i)
72 | print(max_id)
73 |
--------------------------------------------------------------------------------
/Triplanerecon/multi_omni.sh:
--------------------------------------------------------------------------------
1 | GPU_NUM=$1
2 | for ((allindex=0;allindex<${GPU_NUM};allindex++));
3 | do
4 | tmux new-session -d -s "alltriplane_fitting_"${allindex} "echo ${allindex}; conda activate difftf; python ./Triplanerecon/train_single_omni.py --config ./Triplanerecon/configs/omni/train_single.txt --num_gpu ${GPU_NUM} --idx ${allindex} --datadir ./dataset/Omniobject3D/renders --basedir ./Checkpoint --expname omni_triplane --decoderdir ./Checkpoint/omni_sharedecoder/300000.tar"
5 |
6 | done
--------------------------------------------------------------------------------
/Triplanerecon/multi_shapenet.sh:
--------------------------------------------------------------------------------
1 | GPU_NUM=$1
2 | for ((allindex=0;allindex<${GPU_NUM};allindex++));
3 | do
4 | tmux new-session -d -s "alltriplane_fitting_"${allindex} "echo ${allindex}; conda activate difftf; python ./Triplanerecon/train_single_shapenet.py --config ./Triplanerecon/configs/shapenet/train_single.txt --num_gpu ${GPU_NUM} --idx ${allindex} --datadir ./dataset/ShapeNet/renders_car --basedir ./Checkpoint --expname shapenet_triplane --decoderdir ./Checkpoint/shapenet_sharedecoder/300000.tar"
5 |
6 | done
--------------------------------------------------------------------------------
/Triplanerecon/omni_dataset.py:
--------------------------------------------------------------------------------
1 | # Standard NeRF Blender dataset loader
2 | import torch
3 | import torch.nn.functional as F
4 | from typing import NamedTuple, Optional, Union
5 | import os
6 | import imageio.v2 as imageio
7 | from tqdm import tqdm
8 | import cv2
9 | import json
10 | import numpy as np
11 | from torch.utils.data import Dataset
12 | from torch.utils.data import DataLoader
13 | import argparse
14 | from os import path
15 | import ipdb
16 | import re
17 |
18 | def get_rays(H, W, K, c2w):
19 | i, j = torch.meshgrid(torch.linspace(0, W-1, W), torch.linspace(0, H-1, H)) # pytorch's meshgrid has indexing='ij'
20 | i = i.t()
21 | j = j.t()
22 | dirs = torch.stack([(i-K[0][2])/K[0][0], (j-K[1][2])/K[1][1], torch.ones_like(i)], -1)
23 | # Rotate ray directions from camera frame to the world frame
24 | rays_d = torch.sum(dirs[..., np.newaxis, :] * c2w[:3,:3], -1) # dot product, equals to: [c2w.dot(dir) for dir in dirs]
25 | # Translate camera frame's origin to the world frame. It is the origin of all rays.
26 | rays_o = c2w[:3,-1].expand(rays_d.shape)
27 | return rays_o, rays_d
28 |
29 |
30 | class OurDDataset(Dataset):
31 | """
32 | NeRF dataset loader
33 | """
34 |
35 | # focal: float
36 | # c2w: torch.Tensor # (n_images, 4, 4)
37 | # gt: torch.Tensor # (n_images, h, w, 3)
38 | # h: int
39 | # w: int
40 | # n_images: int
41 | # split: str
42 |
43 | def __init__(
44 | self,
45 | config,
46 | root,
47 | ):
48 | super(OurDDataset,self).__init__()
49 |
50 |
51 | self.base_path=root
52 | self.config=config
53 |
54 | class_names=os.listdir(root)
55 | class_names.sort()
56 | class_num=len(class_names)
57 |
58 | allc2w=[]
59 | allimgpath=[]
60 | alldpath=[]
61 | allk=[]
62 | label=[]
63 | label_f=0
64 | class_label=0
65 | allclasslabel=[]
66 | cam_trans = np.diag(np.array([1, -1, -1, 1], dtype=np.float32))
67 | self.blender2opencv = np.array([[1, 0, 0, 0], [0, -1, 0, 0], [0, 0, -1, 0], [0, 0, 0, 1]])
68 | for class_name in class_names:
69 | if not os.path.isdir(os.path.join(root,class_name)):
70 | continue
71 | all_instances=os.path.join(root,class_name)
72 | instance_name=[]
73 | for name in os.listdir(all_instances):
74 | if os.path.isdir(os.path.join(root,class_name,name)):
75 | instance_name.append(name)
76 |
77 | instance_num=len(instance_name)
78 | if instance_num<=8:
79 | instance_num=instance_num
80 | else:
81 | instance_num=8
82 |
83 |
84 | instance_name.sort(key=lambda l: int(re.findall('\d+', l)[0]))
85 |
86 |
87 | instance_name=instance_name[:instance_num]
88 | for each_instance in instance_name:
89 | path=os.path.join(all_instances,each_instance)
90 | img_path = os.path.join(path, 'render','images')
91 | num=len(os.listdir(img_path))
92 | img_name=os.listdir(img_path)
93 | img_name.sort(key=lambda l: int(re.findall('\d+', l)[0]))
94 |
95 | if config.using_depth:
96 | d_path = os.path.join(path, 'render','depths')
97 | d_name=os.listdir(d_path)
98 | data_json=os.path.join(path, 'render','transforms.json')
99 | jsonfile = json.load(open(data_json, "r"))
100 |
101 | self.H,self.W,_=imageio.imread(os.path.join(img_path,img_name[0])).shape
102 |
103 | focal = float(
104 | 0.5 * self.W / np.tan(0.5 * jsonfile["camera_angle_x"])
105 | )
106 |
107 |
108 | for i in range(round(num*config.train_test)):
109 | c2w=np.array(jsonfile["frames"][i]["transform_matrix"], dtype=np.float32)
110 | c2w[:,1:3]*=-1
111 | allc2w.append(c2w)
112 | allimgpath.append(os.path.join(img_path,img_name[i]))
113 | if config.using_depth:
114 | alldpath.append(os.path.join(d_path,d_name[i]))
115 | allk.append(np.array([[focal,0,self.W * 0.5],\
116 | [0,focal,self.H * 0.5],\
117 | [0,0,1]]))
118 | label.append(label_f)
119 |
120 | allclasslabel.append(class_label)
121 | label_f+=1
122 | print(label_f)
123 | class_label+=1
124 | self.allc2w=np.stack(allc2w)
125 | self.allimgpath=np.stack(allimgpath)
126 | config.num_instance=label_f
127 | if config.using_depth:
128 | self.alldpath=np.stack(alldpath)
129 | self.allk=np.stack(allk)
130 | self.label=np.stack(label)
131 | self.config=config
132 |
133 | self.num=len(allimgpath)
134 |
135 |
136 |
137 | def __len__(self):
138 | return self.num
139 |
140 |
141 | def __getitem__(self, index) :
142 | target=torch.Tensor(imageio.imread(self.allimgpath[index]))/255.
143 |
144 | if self.config.white_bkgd and target.shape[-1]==4:
145 | target = target[...,:3]*target[...,-1:] + (1.-target[...,-1:])
146 | else:
147 | target = target[...,:3]
148 |
149 | pose=torch.Tensor(self.allc2w[index,:3,:4])
150 | K=torch.Tensor(self.allk[index])
151 | H=self.H
152 | W=self.W
153 | label=torch.Tensor([self.label[index]]).long()
154 | near=torch.Tensor([2])
155 | far=near+4
156 |
157 |
158 | rays_o, rays_d = get_rays(H, W, K, pose) # (H, W, 3), (H, W, 3)
159 |
160 |
161 | if target[:10,:10,:].sum()<1e-4:
162 | mask=(target.mean(-1)>1e-4)
163 | else:
164 | mask=(target.mean(-1)<0.9999)
165 | if np.random.random() > self.config.pos_rate:
166 | coords = torch.stack(torch.meshgrid(torch.linspace(0, H-1, H), torch.linspace(0, W-1, W)), -1)[mask]
167 | else:
168 | coords = torch.stack(torch.meshgrid(torch.linspace(0, H-1, H), torch.linspace(0, W-1, W)), -1)
169 |
170 | coords = torch.reshape(coords, [-1,2]) # (H * W, 2)
171 |
172 | if coords.shape[0]>=self.config.N_rand:
173 | select_inds = np.random.choice(coords.shape[0], size=[self.config.N_rand], replace=False) # (N_rand,)
174 | else:
175 | select_inds = np.random.choice(coords.shape[0], size=[self.config.N_rand], replace=True)
176 |
177 |
178 | select_coords = coords[select_inds].long() # (N_rand, 2)
179 | rays_o = rays_o[select_coords[:, 0], select_coords[:, 1]] # (N_rand, 3)
180 | rays_d = rays_d[select_coords[:, 0], select_coords[:, 1]] # (N_rand, 3)
181 | batch_rays = torch.stack([rays_o, rays_d], 0)
182 | target_s = target[select_coords[:, 0], select_coords[:, 1]] # (N_rand, 3)imageio.imwrite('a.png',np.array(target[select_coords[:, 1], select_coords[:, 0]]).reshape(200,200,4))
183 |
184 | depth_s=None
185 | if self.config.using_depth:
186 | depth=torch.Tensor(imageio.imread(self.alldpath[index]))
187 | depth_s= depth[select_coords[:, 0], select_coords[:, 1]]
188 |
189 | return {
190 | 'batch_rays': batch_rays,
191 | 'label': label,
192 | 'target_s': target_s,
193 | 'depth_s': depth_s,
194 | 'near': near,
195 | 'far': far,
196 | 'hwk': [H,W,K]
197 | }
198 | else:
199 | return {
200 | 'batch_rays': batch_rays,
201 | 'label': label,
202 | 'target_s': target_s,
203 | 'near': near,
204 | 'far': far,
205 | 'hwk': [H,W,K]
206 | }
207 |
--------------------------------------------------------------------------------
/Triplanerecon/omni_dataset_ddpm.py:
--------------------------------------------------------------------------------
1 | # Standard NeRF Blender dataset loader
2 | import torch
3 | import torch.nn.functional as F
4 | from typing import NamedTuple, Optional, Union
5 | import os
6 | import imageio.v2 as imageio
7 | from tqdm import tqdm
8 | import cv2
9 | import json
10 | import numpy as np
11 | from torch.utils.data import Dataset
12 | from torch.utils.data import DataLoader
13 | import argparse
14 | from os import path
15 | import ipdb
16 | import re
17 |
18 | def get_rays(H, W, K, c2w):
19 | i, j = torch.meshgrid(torch.linspace(0, W-1, W), torch.linspace(0, H-1, H)) # pytorch's meshgrid has indexing='ij'
20 | i = i.t()
21 | j = j.t()
22 | dirs = torch.stack([(i-K[0][2])/K[0][0], (j-K[1][2])/K[1][1], torch.ones_like(i)], -1)
23 | # Rotate ray directions from camera frame to the world frame
24 | rays_d = torch.sum(dirs[..., np.newaxis, :] * c2w[:3,:3], -1) # dot product, equals to: [c2w.dot(dir) for dir in dirs]
25 | # Translate camera frame's origin to the world frame. It is the origin of all rays.
26 | rays_o = c2w[:3,-1].expand(rays_d.shape)
27 | return rays_o, rays_d
28 |
29 | trans_t = lambda t : torch.Tensor([
30 | [1,0,0,0],
31 | [0,1,0,0],
32 | [0,0,1,t],
33 | [0,0,0,1]]).float()
34 |
35 | rot_phi = lambda phi : torch.Tensor([
36 | [1,0,0,0],
37 | [0,np.cos(phi),-np.sin(phi),0],
38 | [0,np.sin(phi), np.cos(phi),0],
39 | [0,0,0,1]]).float()
40 |
41 | rot_theta = lambda th : torch.Tensor([
42 | [np.cos(th),0,-np.sin(th),0],
43 | [0,1,0,0],
44 | [np.sin(th),0, np.cos(th),0],
45 | [0,0,0,1]]).float()
46 |
47 |
48 | def pose_spherical(theta, phi, radius):
49 | c2w = trans_t(radius)
50 | c2w = rot_phi(phi/180.*np.pi) @ c2w
51 | c2w = rot_theta(theta/180.*np.pi) @ c2w
52 | c2w = torch.Tensor(np.array([[-1,0,0,0],[0,0,1,0],[0,1,0,0],[0,0,0,1]])) @ c2w
53 | return c2w
54 |
55 | class OurtestddDDataset(Dataset):
56 | """
57 | NeRF dataset loader
58 | """
59 |
60 | # focal: float
61 | # c2w: torch.Tensor # (n_images, 4, 4)
62 | # gt: torch.Tensor # (n_images, h, w, 3)
63 | # h: int
64 | # w: int
65 | # n_images: int
66 | # split: str
67 |
68 | def __init__(
69 | self,
70 | config,
71 | root,
72 | ):
73 | super(OurtestddDDataset,self).__init__()
74 |
75 |
76 | self.config=config
77 |
78 | allc2w=[]
79 | alldpath=[]
80 | allk=[]
81 | label=[]
82 | label_f=0
83 |
84 |
85 | self.H,self.W=800,800
86 |
87 | focal = float(
88 | 0.5 * self.W / np.tan(0.5 * 0.6911112070083618)
89 | )
90 |
91 | render_poses = torch.stack([pose_spherical(angle, -30.0, 4.0) for angle in np.linspace(-180,180,25+1)[:-1]], 0)
92 |
93 |
94 |
95 | if config.testvideo==1:
96 | for i in range(len(render_poses)):
97 | i=i*int(1/config.train_test)
98 | c2w=render_poses[i].cpu().numpy().reshape(4,4)
99 | c2w[:,1:3]*=-1
100 | allc2w.append(c2w)
101 |
102 | allk.append(np.array([[focal,0,self.W * 0.5],\
103 | [0,focal,self.H * 0.5],\
104 | [0,0,1]]))
105 | label.append(label_f)
106 |
107 | else:
108 | render_poses = torch.stack([pose_spherical(angle, -30.0, 4.0) for angle in np.linspace(-180,180,10+1)[:-1]], 0)
109 | for i in range(10):
110 |
111 | c2w=render_poses[i].cpu().numpy().reshape(4,4)
112 | c2w[:,1:3]*=-1
113 |
114 | allc2w.append(c2w)
115 |
116 |
117 | allk.append(np.array([[focal,0,self.W * 0.5],\
118 | [0,focal,self.H * 0.5],\
119 | [0,0,1]]))
120 | label.append(label_f)
121 |
122 |
123 | self.allc2w=np.stack(allc2w)
124 | config.num_instance=1
125 | self.allk=np.stack(allk)
126 | self.label=np.stack(label)
127 |
128 |
129 |
130 |
131 |
132 | self.num=len(self.allc2w)
133 |
134 |
135 |
136 | def __len__(self):
137 | return self.num
138 |
139 |
140 | def __getitem__(self, index) :
141 |
142 |
143 |
144 | pose=torch.Tensor(self.allc2w[index,:3,:4])
145 | K=torch.Tensor(self.allk[index])
146 | H=self.H
147 | W=self.W
148 | label=torch.Tensor([self.label[index]]).long()
149 | near=torch.Tensor([2])
150 | far=near+4
151 |
152 |
153 | rays_o, rays_d = get_rays(H, W, K, pose) # (H, W, 3), (H, W, 3)
154 |
155 | coords = torch.stack(torch.meshgrid(torch.linspace(0, H-1, H), torch.linspace(0, W-1, W)), -1) # (H, W, 2)
156 |
157 | coords = torch.reshape(coords, [-1,2]).long() # (N_rand, 2)
158 | rays_o = rays_o[coords[:, 0], coords[:, 1]] # (N_rand, 3)
159 | rays_d = rays_d[coords[:, 0], coords[:, 1]] # (N_rand, 3)
160 | batch_rays = torch.stack([rays_o, rays_d], 0)
161 |
162 |
163 | return {
164 | 'batch_rays': batch_rays,
165 | 'label': label,
166 | 'near': near,
167 | 'far': far,
168 | 'hwk': [H,W,K]
169 | }
170 |
171 | if __name__=='__main__':
172 | from parser_config import config_parser
173 |
174 | parser = config_parser()
175 | newargs = parser.parse_args()
176 | path='./3D_generation/data/test'
177 | dataset = OurDDataset(newargs,path)
178 | dataloader = DataLoader(
179 | dataset, batch_size=2, shuffle=True, num_workers=0, pin_memory=True)
180 |
181 | for i in range(5):
182 |
183 | with tqdm(dataloader, dynamic_ncols=True) as tqdmDataLoader:
184 | for index, data in tqdmDataLoader:
185 | ipdb.set_trace()
186 | print(i)
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_dataset.py:
--------------------------------------------------------------------------------
1 | # Standard NeRF Blender dataset loader
2 | import torch
3 | import torch.nn.functional as F
4 | from typing import NamedTuple, Optional, Union
5 | import os
6 | import imageio.v2 as imageio
7 | from tqdm import tqdm
8 | import cv2
9 | import json
10 | import numpy as np
11 | from torch.utils.data import Dataset
12 | from torch.utils.data import DataLoader
13 | import argparse
14 | from os import path
15 | import ipdb
16 | import re
17 |
18 | def get_rays(H, W, K, c2w):
19 | i, j = torch.meshgrid(torch.linspace(0, W-1, W), torch.linspace(0, H-1, H)) # pytorch's meshgrid has indexing='ij'
20 | i = i.t()
21 | j = j.t()
22 | dirs = torch.stack([(i-K[0][2])/K[0][0], (j-K[1][2])/K[1][1], torch.ones_like(i)], -1)
23 | # Rotate ray directions from camera frame to the world frame
24 | rays_d = torch.sum(dirs[..., np.newaxis, :] * c2w[:3,:3], -1) # dot product, equals to: [c2w.dot(dir) for dir in dirs]
25 | # Translate camera frame's origin to the world frame. It is the origin of all rays.
26 | rays_o = c2w[:3,-1].expand(rays_d.shape)
27 | return rays_o, rays_d
28 |
29 |
30 | class OurDDataset(Dataset):
31 | """
32 | NeRF dataset loader
33 | """
34 |
35 | # focal: float
36 | # c2w: torch.Tensor # (n_images, 4, 4)
37 | # gt: torch.Tensor # (n_images, h, w, 3)
38 | # h: int
39 | # w: int
40 | # n_images: int
41 | # split: str
42 |
43 | def __init__(
44 | self,
45 | config,
46 | root,
47 | ):
48 | super(OurDDataset,self).__init__()
49 |
50 |
51 | self.base_path=root
52 | self.config=config
53 |
54 | class_names=os.listdir(root)
55 | class_names.sort()
56 | class_num=len(class_names)
57 |
58 | allc2w=[]
59 | allimgpath=[]
60 | alldpath=[]
61 | allk=[]
62 | label=[]
63 | label_f=0
64 | class_label=0
65 | allclasslabel=[]
66 |
67 | instance_num=len(os.listdir(root))
68 |
69 |
70 | instance_name=os.listdir(root)
71 | #we use 1500 objects to train the shared decoder.
72 | instance_name=np.array(instance_name)[np.random.choice(len(instance_name),size=[1500],replace=False)]
73 |
74 | self.H,self.W=512,512
75 |
76 | focal = 525
77 | for each_instance in instance_name:
78 | if os.path.isdir(os.path.join(root,each_instance)):
79 | path=os.path.join(root,each_instance)
80 | img_path = os.path.join(path, 'rgb')
81 | pos_path = os.path.join(path, 'pose')
82 |
83 | num=len(os.listdir(pos_path))
84 | pos_name=os.listdir(pos_path)
85 | pos_name.sort(key=lambda l: int(re.findall('\d+', l)[0]))
86 |
87 | img_name=[f for f in os.listdir(img_path) if f.endswith('.png')]
88 | img_name.sort(key=lambda l: int(re.findall('\d+', l)[0]))
89 |
90 | for i in range(round(num*config.train_test)):
91 | c2w=np.loadtxt(os.path.join(pos_path,pos_name[i])).reshape(4,4)
92 | c2w[:3, 3] *=1.8
93 |
94 | allc2w.append(c2w)
95 | allimgpath.append(os.path.join(img_path,img_name[i]))
96 |
97 | allk.append(np.array([[focal,0,self.W * 0.5],\
98 | [0,focal,self.H * 0.5],\
99 | [0,0,1]]))
100 | label.append(label_f)
101 |
102 | allclasslabel.append(class_label)
103 | label_f+=1
104 | print(label_f)
105 | self.allc2w=np.stack(allc2w)
106 | self.allimgpath=allimgpath
107 | config.num_instance=label_f
108 |
109 | self.allk=np.stack(allk)
110 | self.label=np.stack(label)
111 | self.config=config
112 |
113 |
114 |
115 | self.num=len(allimgpath)
116 |
117 |
118 |
119 | def __len__(self):
120 | return self.num
121 |
122 |
123 | def __getitem__(self, index) :
124 | target=torch.Tensor(imageio.imread(self.allimgpath[index]))/255.
125 |
126 | if self.config.white_bkgd and target.shape[-1]==4:
127 | target = target[...,:3]*target[...,-1:] + (1.-target[...,-1:])
128 | else:
129 | target = target[...,:3]
130 |
131 | pose=torch.Tensor(self.allc2w[index,:3,:4])
132 | K=torch.Tensor(self.allk[index])
133 | H=self.H
134 | W=self.W
135 | label=torch.Tensor([self.label[index]]).long()
136 | near=torch.Tensor([0.2])
137 | far=near+2
138 |
139 |
140 |
141 | rays_o, rays_d = get_rays(H, W, K, pose) # (H, W, 3), (H, W, 3)
142 |
143 |
144 | if target[:10,:10,:].sum()<1e-4:
145 | mask=(target.mean(-1)>1e-4)
146 | else:
147 | mask=(target.mean(-1)<0.9999)
148 | if np.random.random() > self.config.pos_rate:
149 | coords = torch.stack(torch.meshgrid(torch.linspace(0, H-1, H), torch.linspace(0, W-1, W)), -1)[mask]
150 | else:
151 | coords = torch.stack(torch.meshgrid(torch.linspace(0, H-1, H), torch.linspace(0, W-1, W)), -1) # (H, W, 2)
152 |
153 |
154 | coords = torch.reshape(coords, [-1,2]) # (H * W, 2)
155 | if coords.shape[0]>=self.config.N_rand:
156 | select_inds = np.random.choice(coords.shape[0], size=[self.config.N_rand], replace=False) # (N_rand,)
157 | else:
158 | select_inds = np.random.choice(coords.shape[0], size=[self.config.N_rand], replace=True)
159 |
160 | select_coords = coords[select_inds].long() # (N_rand, 2)
161 | rays_o = rays_o[select_coords[:, 0], select_coords[:, 1]] # (N_rand, 3)
162 | rays_d = rays_d[select_coords[:, 0], select_coords[:, 1]] # (N_rand, 3)
163 | batch_rays = torch.stack([rays_o, rays_d], 0)
164 | target_s = target[select_coords[:, 0], select_coords[:, 1]] # (N_rand, 3)
165 |
166 |
167 | depth_s=None
168 | if self.config.using_depth:
169 | depth=torch.Tensor(imageio.imread(self.alldpath[index]))
170 | depth_s= depth[select_coords[:, 0], select_coords[:, 1]]
171 |
172 |
173 | return {
174 | 'batch_rays': batch_rays,
175 | 'label': label,
176 | 'target_s': target_s,
177 | 'depth_s': depth_s,
178 | 'near': near,
179 | 'far': far,
180 | 'hwk': [H,W,K]
181 | }
182 | else:
183 | return {
184 | 'batch_rays': batch_rays,
185 | 'label': label,
186 | 'target_s': target_s,
187 | 'near': near,
188 | 'far': far,
189 | 'hwk': [H,W,K]
190 | }
191 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_dataset_ddpm.py:
--------------------------------------------------------------------------------
1 | # Standard NeRF Blender dataset loader
2 | import torch
3 | import torch.nn.functional as F
4 | from typing import NamedTuple, Optional, Union
5 | import os
6 | import imageio.v2 as imageio
7 | from tqdm import tqdm
8 | import cv2
9 | import json
10 | import numpy as np
11 | from torch.utils.data import Dataset
12 | from torch.utils.data import DataLoader
13 | import argparse
14 | from os import path
15 | import ipdb
16 | import re
17 |
18 | def get_rays(H, W, K, c2w):
19 | i, j = torch.meshgrid(torch.linspace(0, W-1, W), torch.linspace(0, H-1, H)) # pytorch's meshgrid has indexing='ij'
20 | i = i.t()
21 | j = j.t()
22 | dirs = torch.stack([(i-K[0][2])/K[0][0], (j-K[1][2])/K[1][1], torch.ones_like(i)], -1)
23 | # Rotate ray directions from camera frame to the world frame
24 | rays_d = torch.sum(dirs[..., np.newaxis, :] * c2w[:3,:3], -1) # dot product, equals to: [c2w.dot(dir) for dir in dirs]
25 | # Translate camera frame's origin to the world frame. It is the origin of all rays.
26 | rays_o = c2w[:3,-1].expand(rays_d.shape)
27 | return rays_o, rays_d
28 |
29 |
30 |
31 | trans_t = lambda t : torch.Tensor([
32 | [1,0,0,0],
33 | [0,1,0,0],
34 | [0,0,1,t],
35 | [0,0,0,1]]).float()
36 |
37 | rot_phi = lambda phi : torch.Tensor([
38 | [1,0,0,0],
39 | [0,np.cos(phi),-np.sin(phi),0],
40 | [0,np.sin(phi), np.cos(phi),0],
41 | [0,0,0,1]]).float()
42 |
43 | rot_theta = lambda th : torch.Tensor([
44 | [np.cos(th),0,-np.sin(th),0],
45 | [0,1,0,0],
46 | [np.sin(th),0, np.cos(th),0],
47 | [0,0,0,1]]).float()
48 |
49 |
50 | def pose_spherical(theta, phi, radius):
51 | c2w = trans_t(radius)
52 | c2w = rot_phi(phi/180.*np.pi) @ c2w
53 | c2w = rot_theta(theta/180.*np.pi) @ c2w
54 | c2w = torch.Tensor(np.array([[-1,0,0,0],[0,0,1,0],[0,1,0,0],[0,0,0,1]])) @ c2w
55 | return c2w
56 |
57 |
58 | class OurtestddDDataset(Dataset):
59 | """
60 | NeRF dataset loader
61 | """
62 |
63 | # focal: float
64 | # c2w: torch.Tensor # (n_images, 4, 4)
65 | # gt: torch.Tensor # (n_images, h, w, 3)
66 | # h: int
67 | # w: int
68 | # n_images: int
69 | # split: str
70 |
71 | def __init__(
72 | self,
73 | config,
74 | root,
75 | ):
76 | super(OurtestddDDataset,self).__init__()
77 |
78 |
79 | self.config=config
80 |
81 |
82 |
83 | allc2w=[]
84 | allimgpath=[]
85 | alldpath=[]
86 | allk=[]
87 | label=[]
88 | label_f=0
89 | class_label=0
90 | allclasslabel=[]
91 |
92 | instance_num=1
93 | instance_name=os.listdir(root)
94 |
95 | instance_name=instance_name[:instance_num]
96 | self.H,self.W=512,512
97 | oric2w=[]
98 | focal = 525
99 | for each_instance in instance_name:
100 | path=os.path.join(root,each_instance)
101 | pos_path = os.path.join(path, 'pose')
102 | num=len(os.listdir(pos_path))
103 | pos_name=os.listdir(pos_path)
104 | pos_name.sort(key=lambda l: int(re.findall('\d+', l)[0]))
105 |
106 |
107 |
108 |
109 | if config.testvideo==1:
110 | for i in range(round(num*(config.train_test))):
111 | i=i*int(1/config.train_test)
112 | c2w=np.loadtxt(os.path.join(pos_path,pos_name[i])).reshape(4,4)
113 | c2w[:3, 3] *=1.8
114 |
115 | allc2w.append(c2w)
116 |
117 | allk.append(np.array([[focal,0,self.W * 0.5],\
118 | [0,focal,self.H * 0.5],\
119 | [0,0,1]]))
120 | label.append(label_f)
121 | else:
122 | for i in range(10):
123 | i=i*int(10)+100
124 | c2w=np.loadtxt(os.path.join(pos_path,pos_name[i])).reshape(4,4)
125 | oric2w.append(c2w)
126 | c2w[:3, 3] *=1.8
127 |
128 | allc2w.append(c2w)
129 |
130 | allk.append(np.array([[focal,0,self.W * 0.5],\
131 | [0,focal,self.H * 0.5],\
132 | [0,0,1]]))
133 | label.append(label_f)
134 |
135 | allclasslabel.append(class_label)
136 |
137 | self.allc2w=np.stack(allc2w)
138 | config.num_instance=1
139 |
140 | self.allk=np.stack(allk)
141 | self.label=np.stack(label)
142 |
143 |
144 |
145 |
146 |
147 | self.num=len(allc2w)
148 |
149 |
150 |
151 | def __len__(self):
152 | return self.num
153 |
154 |
155 | def __getitem__(self, index) :
156 |
157 | pose=torch.Tensor(self.allc2w[index,:3,:4])
158 | K=torch.Tensor(self.allk[index])
159 | H=self.H
160 | W=self.W
161 | label=torch.Tensor([self.label[index]]).long()
162 | near=torch.Tensor([0.2])
163 | far=near+2
164 |
165 |
166 | rays_o, rays_d = get_rays(H, W, K, pose) # (H, W, 3), (H, W, 3)
167 |
168 | coords = torch.stack(torch.meshgrid(torch.linspace(0, H-1, H), torch.linspace(0, W-1, W)), -1) # (H, W, 2)
169 |
170 | coords = torch.reshape(coords, [-1,2]).long() # (N_rand, 2)
171 | rays_o = rays_o[coords[:, 0], coords[:, 1]] # (N_rand, 3)
172 | rays_d = rays_d[coords[:, 0], coords[:, 1]] # (N_rand, 3)
173 | batch_rays = torch.stack([rays_o, rays_d], 0)
174 |
175 |
176 |
177 | return {
178 | 'batch_rays': batch_rays,
179 | 'label': label,
180 | 'near': near,
181 | 'far': far,
182 | 'hwk': [H,W,K]
183 | }
184 |
185 |
186 | if __name__=='__main__':
187 | from parser_config import config_parser
188 |
189 | parser = config_parser()
190 | newargs = parser.parse_args()
191 | path='./3D_generation/data/test'
192 | dataset = OurDDataset(newargs,path)
193 | dataloader = DataLoader(
194 | dataset, batch_size=2, shuffle=True, num_workers=0, pin_memory=True)
195 |
196 | for i in range(5):
197 |
198 | with tqdm(dataloader, dynamic_ncols=True) as tqdmDataLoader:
199 | for index, data in tqdmDataLoader:
200 | ipdb.set_trace()
201 | print(i)
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000000.txt:
--------------------------------------------------------------------------------
1 | -0.8414713144302368 -0.5386366844177246 -0.04239124804735184 0.05086996778845787 3.72529200376448e-07 -0.07845887541770935 0.9969174861907959 -1.1963008642196655 -0.5403022766113281 0.838877260684967 0.06602128595113754 -0.07922526448965073 0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000001.txt:
--------------------------------------------------------------------------------
1 | -0.9320390224456787 -0.3607495129108429 -0.03410102799534798 0.04092103987932205 -2.0861622829215776e-07 -0.0941082164645195 0.9955618977546692 -1.1946742534637451 -0.3623576760292053 0.9279026389122009 0.08771242946386337 -0.105255126953125 0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000002.txt:
--------------------------------------------------------------------------------
1 | -0.9854495525360107 -0.1689407229423523 -0.0186510868370533 0.022381475195288658 1.5646213569198153e-07 -0.10973447561264038 0.9939608573913574 -1.1927531957626343 -0.1699671447277069 0.9794984459877014 0.10813764482736588 -0.12976518273353577 0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000003.txt:
--------------------------------------------------------------------------------
1 | -0.9995737075805664 0.028960729017853737 0.0036580152809619904 -0.0043916041031479836 -5.648469141306123e-07 -0.12533310055732727 0.9921146631240845 -1.1905378103256226 0.02919083461165428 0.9916918873786926 0.1252794861793518 -0.15033574402332306 -0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000004.txt:
--------------------------------------------------------------------------------
1 | -0.973847508430481 0.2249356210231781 0.03201328590512276 -0.03841566666960716 1.5646217832454568e-07 -0.14090147614479065 0.9900236129760742 -1.188028335571289 0.22720229625701904 0.9641320705413818 0.1372164487838745 -0.16465960443019867 -0.0 -0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000005.txt:
--------------------------------------------------------------------------------
1 | -0.9092977046966553 0.4110230505466461 0.06509938091039658 -0.078119657933712 -3.83704957584996e-07 -0.15643461048603058 0.987688422203064 -1.1852262020111084 0.416146457195282 0.8981026411056519 0.14224585890769958 -0.17069458961486816 -0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000006.txt:
--------------------------------------------------------------------------------
1 | -0.8084962368011475 0.5797380208969116 0.1011803075671196 -0.12141657620668411 -2.2351736461700966e-08 -0.17192888259887695 0.9851093292236328 -1.1821314096450806 0.5885012149810791 0.7964572906494141 0.13900375366210938 -0.16680487990379333 -0.0 -0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000007.txt:
--------------------------------------------------------------------------------
1 | -0.6754631996154785 0.7243322134017944 0.13817371428012848 -0.1658085733652115 -1.6391271628890536e-07 -0.18738147616386414 0.9822871685028076 -1.1787446737289429 0.7373935580253601 0.6634989380836487 0.1265692412853241 -0.15188303589820862 -0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000008.txt:
--------------------------------------------------------------------------------
1 | -0.5155014991760254 0.8390849828720093 0.17376619577407837 -0.20851942896842957 1.2665987014770508e-07 -0.20278730988502502 0.9792228937149048 -1.175067663192749 0.8568887114524841 0.5047908425331116 0.1045369878411293 -0.12544460594654083 -0.0 -0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000009.txt:
--------------------------------------------------------------------------------
1 | -0.3349881172180176 0.91953045129776 0.20553946495056152 -0.24664731323719025 -1.0430810704065152e-07 -0.21814337372779846 0.9759166836738586 -1.1710999011993408 0.9422222375869751 0.3269205689430237 0.07307547330856323 -0.08769046515226364 -0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000010.txt:
--------------------------------------------------------------------------------
1 | -0.1411200612783432 0.9626389741897583 0.23110917210578918 -0.2773309648036957 -1.8998981943241233e-07 -0.2334454208612442 0.9723699688911438 -1.1668438911437988 0.9899925589561462 0.13722087442874908 0.03294399753212929 -0.03953259065747261 -0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000011.txt:
--------------------------------------------------------------------------------
1 | 0.05837392061948776 0.9669322967529297 0.24826295673847198 -0.29791900515556335 -1.9557775843281888e-08 -0.2486870288848877 0.9685839414596558 -1.1622999906539917 0.9982947707176208 -0.05654003843665123 -0.014516821131110191 0.01742047443985939 -0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000012.txt:
--------------------------------------------------------------------------------
1 | 0.2555410861968994 0.9325323700904846 0.255111962556839 -0.3061343729496002 -7.450580596923828e-09 -0.26387304067611694 0.964557409286499 -1.1574687957763672 0.9667981863021851 -0.24648404121398926 -0.06743041425943375 0.08091648668050766 -0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000013.txt:
--------------------------------------------------------------------------------
1 | 0.4425203502178192 0.861151397228241 0.25018739700317383 -0.300225168466568 -2.458690460116486e-07 -0.2789909243583679 0.9602935910224915 -1.1523523330688477 0.8967583179473877 -0.42494940757751465 -0.12345901876688004 0.14815115928649902 -0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000014.txt:
--------------------------------------------------------------------------------
1 | 0.6118577718734741 0.7560015320777893 0.23257626593112946 -0.27909165620803833 2.9802322387695312e-08 -0.29404014348983765 0.955793023109436 -1.146951675415039 0.7909678220748901 -0.584809422492981 -0.1799107939004898 0.21589307487010956 -0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000015.txt:
--------------------------------------------------------------------------------
1 | 0.756802499294281 0.6216520071029663 0.2019868791103363 -0.2423844039440155 -1.4901159417490817e-08 -0.3090169131755829 0.9510564804077148 -1.1412678956985474 0.6536435484886169 -0.7197620272636414 -0.23386473953723907 0.28063780069351196 -0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000016.txt:
--------------------------------------------------------------------------------
1 | 0.8715758323669434 0.46382859349250793 0.15880392491817474 -0.19056479632854462 -8.940693874137651e-08 -0.3239172697067261 0.9460852146148682 -1.1353023052215576 0.4902608096599579 -0.8245849609375 -0.28231847286224365 0.33878225088119507 -0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000017.txt:
--------------------------------------------------------------------------------
1 | 0.951602041721344 0.2891636788845062 0.10410525649785995 -0.1249263659119606 7.450580596923828e-09 -0.33873775601387024 0.9408808350563049 -1.1290569305419922 0.30733293294906616 -0.8953441381454468 -0.32234352827072144 0.3868124783039093 -0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000018.txt:
--------------------------------------------------------------------------------
1 | 0.9936910271644592 0.1049124225974083 0.039643093943595886 -0.04757172241806984 -0.0 -0.35347482562065125 0.9354441165924072 -1.1225329637527466 0.11215253174304962 -0.9295423626899719 -0.3512447774410248 0.421493798494339 -0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000019.txt:
--------------------------------------------------------------------------------
1 | 0.9961645603179932 -0.08135451376438141 -0.032210517674684525 0.038652628660202026 1.862645149230957e-09 -0.3681243658065796 0.9297765493392944 -1.1157318353652954 -0.0874989926815033 -0.9262105226516724 -0.3667125105857849 0.4400551915168762 -0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000020.txt:
--------------------------------------------------------------------------------
1 | 0.9589242935180664 -0.2620696723461151 -0.10855279117822647 0.13026338815689087 1.4901161193847656e-08 -0.38268333673477173 0.9238795638084412 -1.108655333518982 -0.28366219997406006 -0.8859305381774902 -0.36696434020996094 0.4403572976589203 -0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000021.txt:
--------------------------------------------------------------------------------
1 | 0.8834545612335205 -0.4299834668636322 -0.18607036769390106 0.22328442335128784 4.470348002882929e-08 -0.39714762568473816 0.9177546501159668 -1.101305603981018 -0.4685167372226715 -0.8107945919036865 -0.35086193680763245 0.4210345447063446 -0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000022.txt:
--------------------------------------------------------------------------------
1 | 0.7727645039558411 -0.578461229801178 -0.2611852288246155 0.3134223520755768 -2.980232949312267e-08 -0.41151440143585205 0.9114034175872803 -1.093684196472168 -0.6346929669380188 -0.7043001651763916 -0.31800374388694763 0.38160452246665955 -0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000023.txt:
--------------------------------------------------------------------------------
1 | 0.6312665939331055 -0.7017531991004944 -0.33021968603134155 0.3962639272212982 1.4901161193847656e-08 -0.4257790148258209 0.9048272371292114 -1.0857925415039062 -0.775566041469574 -0.5711871385574341 -0.26878002285957336 0.32253631949424744 -0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000024.txt:
--------------------------------------------------------------------------------
1 | 0.46460211277008057 -0.7952209711074829 -0.38957479596138 0.467489629983902 -0.0 -0.4399392306804657 0.8980275988578796 -1.0776331424713135 -0.8855195641517639 -0.4172254800796509 -0.20439667999744415 0.2452760487794876 -0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000025.txt:
--------------------------------------------------------------------------------
1 | 0.279415488243103 -0.8555179834365845 -0.43590813875198364 0.5230898261070251 -7.450580596923828e-09 -0.4539904296398163 0.8910065293312073 -1.069207787513733 -0.960170328617096 -0.24896103143692017 -0.12685194611549377 0.1522223800420761 -0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000026.txt:
--------------------------------------------------------------------------------
1 | 0.08308916538953781 -0.8807101845741272 -0.4663105905056 0.5595741271972656 2.7939665869780583e-07 -0.46792876720428467 0.8837661147117615 -1.060518741607666 -0.9965419769287109 -0.07343138754367828 -0.0388796441257 0.046656012535095215 -0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000027.txt:
--------------------------------------------------------------------------------
1 | -0.11654932051897049 -0.8703341484069824 -0.4784710705280304 0.5741645693778992 1.1175869474300271e-07 -0.481754332780838 0.8763062953948975 -1.0515679121017456 -0.9931849241256714 0.1021328940987587 0.05614820867776871 -0.06737759709358215 0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000028.txt:
--------------------------------------------------------------------------------
1 | -0.31154143810272217 -0.8254019618034363 -0.4708009660243988 0.5649611949920654 1.4901161193847656e-08 -0.4954586327075958 0.8686314821243286 -1.0423579216003418 -0.9502326250076294 0.27061471343040466 0.15435591340065002 -0.18522702157497406 0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000029.txt:
--------------------------------------------------------------------------------
1 | -0.494113564491272 -0.7483266592025757 -0.44255948066711426 0.5310712456703186 -1.4901161193847656e-07 -0.5090416669845581 0.860741913318634 -1.0328905582427979 -0.8693974018096924 0.4253043532371521 0.25152426958084106 -0.3018290102481842 0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000030.txt:
--------------------------------------------------------------------------------
1 | -0.6569865345954895 -0.6428073644638062 -0.3939129412174225 0.4726954400539398 1.4901162970204496e-08 -0.522498607635498 0.8526401519775391 -1.0231680870056152 -0.7539023160934448 0.5601730942726135 0.3432745933532715 -0.41192948818206787 0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000031.txt:
--------------------------------------------------------------------------------
1 | -0.7936679124832153 -0.5136478543281555 -0.3259711265563965 0.39116519689559937 -2.2351741790771484e-07 -0.5358269214630127 0.8443279266357422 -1.0131936073303223 -0.6083512902259827 0.6701160073280334 0.4252684712409973 -0.5103223323822021 0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000032.txt:
--------------------------------------------------------------------------------
1 | -0.8987078070640564 -0.36654093861579895 -0.2407723218202591 0.28892695903778076 1.639126594454865e-07 -0.5490229725837708 0.8358070850372314 -1.0029689073562622 -0.43854713439941406 0.7511465549468994 0.49341118335723877 -0.5920935273170471 0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000033.txt:
--------------------------------------------------------------------------------
1 | -0.9679195880889893 -0.2078111618757248 -0.14122851192951202 0.1694747358560562 -1.8626440123625798e-07 -0.56208336353302 0.827080488204956 -0.9924965500831604 -0.2512587904930115 0.8005476593971252 0.5440514087677002 -0.6528617739677429 0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000034.txt:
--------------------------------------------------------------------------------
1 | -0.9985430240631104 -0.04414258524775505 -0.031028015539050102 0.03722957894206047 -3.3453090964030707e-06 -0.5750053524971008 0.8181495666503906 -0.9817797541618347 -0.053956516087055206 0.8169578313827515 0.5741673707962036 -0.6890010833740234 0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000035.txt:
--------------------------------------------------------------------------------
1 | -0.9893580675125122 0.11771200597286224 0.08552265912294388 -0.10262733697891235 -1.043080928297968e-07 -0.5877853035926819 0.8090168237686157 -0.970820426940918 0.14549998939037323 0.8004074692726135 0.5815301537513733 -0.6978363394737244 -0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000036.txt:
--------------------------------------------------------------------------------
1 | -0.940730631351471 0.2712166905403137 0.20363546907901764 -0.24436251819133759 1.6391278734317893e-07 -0.6004202365875244 0.7996845841407776 -0.9596214294433594 0.3391546905040741 0.7522878646850586 0.5648337006568909 -0.6778002977371216 -0.0 -0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000037.txt:
--------------------------------------------------------------------------------
1 | -0.8545990586280823 0.4103184938430786 0.31827494502067566 -0.3819308578968048 -5.513428504855256e-07 -0.6129069924354553 0.7901549935340881 -0.9481860995292664 0.519288182258606 0.6752656102180481 0.5237899422645569 -0.6285476088523865 -0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000038.txt:
--------------------------------------------------------------------------------
1 | -0.7343969345092773 0.5296936631202698 0.42436450719833374 -0.5092376470565796 -5.9604616353681195e-08 -0.6252426505088806 0.7804303765296936 -0.936516523361206 0.6787199378013611 0.5731458067893982 0.45917630195617676 -0.5510116219520569 -0.0 -0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000039.txt:
--------------------------------------------------------------------------------
1 | -0.5849173665046692 0.6249576807022095 0.5170100331306458 -0.6204122304916382 -5.960463056453591e-08 -0.6374240517616272 0.770513117313385 -0.9246158599853516 0.811092734336853 0.4506864845752716 0.37284043431282043 -0.4474082589149475 -0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000040.txt:
--------------------------------------------------------------------------------
1 | -0.4121185541152954 0.692828893661499 0.5917317271232605 -0.7100781798362732 -1.341104507446289e-07 -0.6494481563568115 0.7604060173034668 -0.9124871492385864 0.9111302495002747 0.31337738037109375 0.26764971017837524 -0.32117941975593567 -0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000041.txt:
--------------------------------------------------------------------------------
1 | -0.22289007902145386 0.7312408685684204 0.6446757316589355 -0.7736107707023621 -1.1920927533992653e-07 -0.6613120436668396 0.7501108646392822 -0.9001333117485046 0.9748435020446777 0.1671922653913498 0.14739994704723358 -0.1768796592950821 -0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000042.txt:
--------------------------------------------------------------------------------
1 | -0.02477543242275715 0.7394039630889893 0.6728058457374573 -0.8073671460151672 -1.7136329688582919e-07 -0.6730126738548279 0.7396309971809387 -0.887557327747345 0.9996929168701172 0.018324699252843857 0.01667424477636814 -0.020009009167551994 -0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000043.txt:
--------------------------------------------------------------------------------
1 | 0.17432667315006256 0.7178065776824951 0.6740651726722717 -0.8088783025741577 -5.215405707303944e-08 -0.6845470666885376 0.7289686799049377 -0.8747623562812805 0.9846878051757812 -0.12707868218421936 -0.11933477967977524 0.14320188760757446 -0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000044.txt:
--------------------------------------------------------------------------------
1 | 0.3664790987968445 0.6681637167930603 0.6474955081939697 -0.7769947052001953 -2.9802322387695312e-08 -0.6959127187728882 0.7181264162063599 -0.8617515563964844 0.9304263591766357 -0.263178288936615 -0.25503745675086975 0.3060450553894043 -0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000045.txt:
--------------------------------------------------------------------------------
1 | 0.5440210700035095 0.5933132171630859 0.5933132171630859 -0.7119758129119873 1.4901161193847656e-08 -0.7071067690849304 0.7071068286895752 -0.8485281467437744 0.8390715718269348 -0.38468101620674133 -0.38468098640441895 0.46161726117134094 -0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000046.txt:
--------------------------------------------------------------------------------
1 | 0.699874758720398 0.4970666766166687 0.5129328966140747 -0.6155195832252502 -1.4901161193847656e-08 -0.7181262969970703 0.6959128975868225 -0.8350953459739685 0.7142656445503235 -0.4870518445968628 -0.5025984048843384 0.6031181812286377 -0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000047.txt:
--------------------------------------------------------------------------------
1 | 0.8278263807296753 0.38402023911476135 0.408939927816391 -0.49072784185409546 4.470348358154297e-08 -0.728968620300293 0.6845471262931824 -0.8214565515518188 0.5609843134880066 -0.56668621301651 -0.6034594774246216 0.7241514921188354 -0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000048.txt:
--------------------------------------------------------------------------------
1 | 0.9227754473686218 0.2593373954296112 0.28500810265541077 -0.3420097231864929 -0.0 -0.7396311163902283 0.6730124950408936 -0.8076150417327881 0.38533815741539 -0.6210393905639648 -0.682513415813446 0.81901615858078 -0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000049.txt:
--------------------------------------------------------------------------------
1 | 0.9809362888336182 0.1285126805305481 0.14576902985572815 -0.17492283880710602 -7.450581485102248e-09 -0.7501111030578613 0.66131192445755 -0.7935742139816284 0.19432991743087769 -0.6487048268318176 -0.7358112335205078 0.8829733729362488 -0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000050.txt:
--------------------------------------------------------------------------------
1 | 0.9999901652336121 -0.0028742607682943344 -0.0033653262071311474 0.004038391634821892 -2.3283061589829401e-10 -0.7604058980941772 0.6494479179382324 -0.7793375253677368 -0.00442569749429822 -0.6494415998458862 -0.7603984475135803 0.9124780297279358 -0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000051.txt:
--------------------------------------------------------------------------------
1 | 0.979177713394165 -0.12940019369125366 -0.15641796588897705 0.1877015084028244 -7.450580596923828e-09 -0.7705132365226746 0.6374240517616272 -0.7649087905883789 -0.2030048966407776 -0.624151349067688 -0.7544693946838379 0.9053632020950317 -0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000052.txt:
--------------------------------------------------------------------------------
1 | 0.9193285703659058 -0.24602729082107544 -0.30709224939346313 0.3685106933116913 -0.0 -0.7804304361343384 0.6252426505088806 -0.7502912282943726 -0.39349088072776794 -0.5748034119606018 -0.7174719572067261 0.8609663844108582 -0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000053.txt:
--------------------------------------------------------------------------------
1 | 0.8228285908699036 -0.3483087122440338 -0.4490368962287903 0.5388442873954773 -0.0 -0.7901550531387329 0.6129070520401001 -0.7354884147644043 -0.5682896375656128 -0.5043174624443054 -0.6501621007919312 0.7801946997642517 -0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000054.txt:
--------------------------------------------------------------------------------
1 | 0.6935251355171204 -0.4325622320175171 -0.5761187076568604 0.6913425326347351 -1.4901159417490817e-08 -0.7996845245361328 0.6004201769828796 -0.7205043435096741 -0.7204324007034302 -0.4164064824581146 -0.5546013116836548 0.6655217409133911 -0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000055.txt:
--------------------------------------------------------------------------------
1 | 0.5365728735923767 -0.49600499868392944 -0.6826922297477722 0.8192306160926819 4.470348713425665e-08 -0.8090170621871948 0.5877854228019714 -0.7053423523902893 -0.8438540697097778 -0.3153897225856781 -0.4340965449810028 0.5209159851074219 -0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000056.txt:
--------------------------------------------------------------------------------
1 | 0.3582288920879364 -0.5368444323539734 -0.7638519406318665 0.9166225790977478 1.490115550950577e-07 -0.8181496262550354 0.575005292892456 -0.6900063157081604 -0.93363356590271 -0.20598354935646057 -0.2930847704410553 0.3517022430896759 -0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000057.txt:
--------------------------------------------------------------------------------
1 | 0.1656038910150528 -0.5543226599693298 -0.8156602382659912 0.9787925481796265 7.4505797087454084e-09 -0.8270803093910217 0.5620836615562439 -0.6744999885559082 -0.9861923456192017 -0.0930832177400589 -0.136967733502388 0.1643616110086441 -0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000058.txt:
--------------------------------------------------------------------------------
1 | -0.03362308070063591 -0.5487122535705566 -0.8353347778320312 1.0024018287658691 4.749744064724837e-08 -0.8358075618743896 0.5490226745605469 -0.6588274240493774 -0.9994345307350159 0.01845986768603325 0.028102422133088112 -0.03372287005186081 0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000059.txt:
--------------------------------------------------------------------------------
1 | -0.23150981962680817 -0.5212697386741638 -0.8213896751403809 0.9856675863265991 7.450580596923828e-09 -0.8443279266357422 0.5358267426490784 -0.6429921984672546 -0.9728325605392456 0.12404916435480118 0.1954701989889145 -0.23456427454948425 0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000060.txt:
--------------------------------------------------------------------------------
1 | -0.42016705870628357 -0.474139541387558 -0.7737252116203308 0.9284706711769104 1.4901151246249356e-07 -0.8526401519775391 0.5224984884262085 -0.6269983053207397 -0.9074463844299316 0.2195366770029068 0.35825133323669434 -0.4299015402793884 0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000061.txt:
--------------------------------------------------------------------------------
1 | -0.5920736193656921 -0.4102281630039215 -0.6936582326889038 0.8323898315429688 -2.980232594040899e-08 -0.8607421517372131 0.5090413093566895 -0.6108497381210327 -0.8058839440345764 0.3013899028301239 0.5096226930618286 -0.6115471720695496 0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000062.txt:
--------------------------------------------------------------------------------
1 | -0.7403759360313416 -0.3330437242984772 -0.5838878750801086 0.7006657123565674 1.043080928297968e-07 -0.8686315417289734 0.4954584836959839 -0.5945504903793335 -0.6721928119659424 0.36682555079460144 0.6431138515472412 -0.7717366218566895 0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000063.txt:
--------------------------------------------------------------------------------
1 | -0.8591620922088623 -0.2465151995420456 -0.44840940833091736 0.5380914807319641 4.4703490686970326e-08 -0.8763067126274109 0.4817536771297455 -0.5781044363975525 -0.5117037892341614 0.4139043986797333 0.7528894543647766 -0.9034671783447266 0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000064.txt:
--------------------------------------------------------------------------------
1 | -0.9436956644058228 -0.15479804575443268 -0.29236292839050293 0.35083532333374023 -1.043081283569336e-07 -0.8837655782699585 0.46792975068092346 -0.5615156292915344 -0.3308148980140686 0.4415833055973053 0.8340057730674744 -1.0008068084716797 0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000065.txt:
--------------------------------------------------------------------------------
1 | -0.9906071424484253 -0.06207740679383278 -0.12183358520269394 0.146200492978096 8.195635103902532e-08 -0.891006588935852 0.45399045944213867 -0.5447887182235718 -0.13673707842826843 0.44972628355026245 0.8826374411582947 -1.0591652393341064 0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000066.txt:
--------------------------------------------------------------------------------
1 | -0.9980266094207764 0.027624979615211487 0.0563855841755867 -0.06766645610332489 -1.7657868056630832e-06 -0.8980275988578796 0.4399391710758209 -0.5279269218444824 0.06278911978006363 0.43907099962234497 0.8962554335594177 -1.0755064487457275 -0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000067.txt:
--------------------------------------------------------------------------------
1 | -0.9656579494476318 0.11062507331371307 0.23508931696414948 -0.28210771083831787 -4.023314090773056e-07 -0.9048269987106323 0.4257793426513672 -0.5109351277351379 0.2598170340061188 0.4111570417881012 0.8737534880638123 -1.0485038757324219 -0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000068.txt:
--------------------------------------------------------------------------------
1 | -0.894791305065155 0.18373513221740723 0.40692755579948425 -0.48831334710121155 -2.682209014892578e-07 -0.9114032983779907 0.41151440143585205 -0.4938172996044159 0.4464847445487976 0.36821937561035156 0.8155156970024109 -0.9786188006401062 -0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000069.txt:
--------------------------------------------------------------------------------
1 | -0.7882521152496338 0.24438586831092834 0.5647425055503845 -0.6776911020278931 2.9802318834981634e-08 -0.9177546501159668 0.39714789390563965 -0.47657743096351624 0.6153523921966553 0.3130526840686798 0.7234220504760742 -0.8681064248085022 -0.0 -0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000070.txt:
--------------------------------------------------------------------------------
1 | -0.6502879858016968 0.29071998596191406 0.7018599510192871 -0.8422322273254395 -2.9802318834981634e-08 -0.9238795638084412 0.38268351554870605 -0.45922014117240906 0.7596877217292786 0.24885447323322296 0.6007877588272095 -0.7209452986717224 -0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000071.txt:
--------------------------------------------------------------------------------
1 | -0.48639875650405884 0.3216439187526703 0.8123796582221985 -0.9748559594154358 -7.450575623124678e-08 -0.9297764897346497 0.36812451481819153 -0.4417493939399719 0.873736560344696 0.1790553480386734 0.4522421360015869 -0.5426904559135437 -0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000072.txt:
--------------------------------------------------------------------------------
1 | -0.30311834812164307 0.33684486150741577 0.8914337754249573 -1.069720983505249 -9.68574909165909e-08 -0.9354440569877625 0.35347482562065125 -0.4241698682308197 0.95295250415802 0.10714472085237503 0.2835502326488495 -0.3402603268623352 -0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000073.txt:
--------------------------------------------------------------------------------
1 | -0.10775362700223923 0.3367651700973511 0.9354028105735779 -1.122483253479004 1.1175870895385742e-08 -0.9408808946609497 0.33873745799064636 -0.40648552775382996 0.9941775798797607 0.03650019317865372 0.10138332843780518 -0.1216600239276886 -0.0 -0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000074.txt:
--------------------------------------------------------------------------------
1 | 0.09190679341554642 0.3225465416908264 0.9420811533927917 -1.1304973363876343 -7.450580596923828e-09 -0.9460853934288025 0.3239174783229828 -0.3887008726596832 0.9957676529884338 -0.02977021597325802 -0.08695167303085327 0.10434205830097198 -0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000075.txt:
--------------------------------------------------------------------------------
1 | 0.2879031300544739 0.2959333658218384 0.910788357257843 -1.0929460525512695 -0.0 -0.9510565400123596 0.3090173006057739 -0.37082037329673767 0.9576596021652222 -0.08896704763174057 -0.27381211519241333 0.3285748362541199 -0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000076.txt:
--------------------------------------------------------------------------------
1 | 0.4724216163158417 0.25915926694869995 0.8424096703529358 -1.0108915567398071 -5.960463056453591e-08 -0.9557929039001465 0.2940405011177063 -0.3528483808040619 0.8813725709915161 -0.13891111314296722 -0.45153722167015076 0.5418452024459839 -0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000077.txt:
--------------------------------------------------------------------------------
1 | 0.6381067037582397 0.2148085981607437 0.7393761277198792 -0.8872514367103577 -1.4901159417490817e-08 -0.9602935910224915 0.27899107336997986 -0.3347893953323364 0.7699478268623352 -0.17802608013153076 -0.6127697825431824 0.7353238463401794 -0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000078.txt:
--------------------------------------------------------------------------------
1 | 0.7783521413803101 0.1656668782234192 0.6055761575698853 -0.726691484451294 7.450580596923828e-09 -0.964557409286499 0.26387304067611694 -0.31664761900901794 0.6278279423713684 -0.20538613200187683 -0.7507652640342712 0.9009183049201965 -0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000079.txt:
--------------------------------------------------------------------------------
1 | 0.8875669240951538 0.1145661398768425 0.4462054967880249 -0.5354465842247009 7.4505797087454084e-09 -0.9685830473899841 0.2486899495124817 -0.29842785000801086 0.4606785774230957 -0.22072899341583252 -0.8596823811531067 1.0316189527511597 -0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000080.txt:
--------------------------------------------------------------------------------
1 | 0.9613975286483765 0.0642356276512146 0.26756060123443604 -0.3210725784301758 -0.0 -0.9723699688911438 0.233445405960083 -0.2801344394683838 0.27516335248947144 -0.22443383932113647 -0.9348340034484863 1.1218007802963257 -0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000081.txt:
--------------------------------------------------------------------------------
1 | 0.9969000816345215 0.017163122072815895 0.07678337395191193 -0.09214004129171371 1.862645371275562e-09 -0.9759168028831482 0.2181432992219925 -0.26177191734313965 0.078678198158741 -0.2174670696258545 -0.9728915691375732 1.16746985912323 -0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000082.txt:
--------------------------------------------------------------------------------
1 | 0.9926593899726868 -0.024525828659534454 -0.1184307411313057 0.14211684465408325 -0.0 -0.9792227745056152 0.20278730988502502 -0.2433447241783142 -0.12094360589981079 -0.20129872858524323 -0.972034752368927 1.1664414405822754 -0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000083.txt:
--------------------------------------------------------------------------------
1 | 0.9488444924354553 -0.05916447937488556 -0.310151070356369 0.372181236743927 3.725290742551124e-09 -0.9822872877120972 0.187381312251091 -0.22485758364200592 -0.3157437741756439 -0.17779573798179626 -0.932037889957428 1.1184452772140503 -0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000084.txt:
--------------------------------------------------------------------------------
1 | 0.8672021627426147 -0.08561316877603531 -0.4905413091182709 0.588649570941925 -0.0 -0.9851093292236328 0.17192910611629486 -0.20631492137908936 -0.49795621633529663 -0.1490972936153412 -0.8542889356613159 1.0251468420028687 -0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000085.txt:
--------------------------------------------------------------------------------
1 | 0.7509872913360596 -0.10329629480838776 -0.6521871089935303 0.7826245427131653 -0.0 -0.9876883625984192 0.15643447637557983 -0.1877213567495346 -0.6603167057037354 -0.11748029291629791 -0.7417413592338562 0.8900896906852722 -0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000086.txt:
--------------------------------------------------------------------------------
1 | 0.6048324704170227 -0.11220713704824448 -0.7884079813957214 0.946089506149292 4.470348002882929e-08 -0.9900237321853638 0.14090131223201752 -0.16908152401447296 -0.7963526844978333 -0.08522169291973114 -0.5987984538078308 0.718558669090271 -0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000087.txt:
--------------------------------------------------------------------------------
1 | 0.43456563353538513 -0.1128801479935646 -0.8935384154319763 1.0722460746765137 3.725290298461914e-09 -0.9921147227287292 0.12533323466777802 -0.15039989352226257 -0.9006401896476746 -0.05446551740169525 -0.43113893270492554 0.5173667073249817 -0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000088.txt:
--------------------------------------------------------------------------------
1 | 0.24697357416152954 -0.10633499920368195 -0.9631701111793518 1.15580415725708 1.8626447051417472e-09 -0.9939608573913574 0.10973432660102844 -0.1316811591386795 -0.9690220952033997 -0.02710147760808468 -0.24548210203647614 0.29457858204841614 -0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000089.txt:
--------------------------------------------------------------------------------
1 | 0.049535539001226425 -0.09399279206991196 -0.9943397641181946 1.1932077407836914 6.51925802230835e-09 -0.9955620169639587 0.09410832822322845 -0.11292997747659683 -0.9987723231315613 -0.0046617123298347 -0.04931569844484329 0.05917895957827568 -0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000090.txt:
--------------------------------------------------------------------------------
1 | -0.14987720549106598 -0.07757285982370377 -0.98565673828125 1.1827882528305054 -0.0 -0.9969173669815063 0.07845908403396606 -0.09415092319250107 -0.9887046217918396 0.011759229004383087 0.14941516518592834 -0.1792982518672943 0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000091.txt:
--------------------------------------------------------------------------------
1 | -0.34331491589546204 -0.058974120765924454 -0.937366783618927 1.1248406171798706 3.7252885221050747e-09 -0.9980267882347107 0.06279051303863525 -0.0753486305475235 -0.939220130443573 0.021556934341788292 0.34263747930526733 -0.4111650288105011 0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000092.txt:
--------------------------------------------------------------------------------
1 | -0.5230658054351807 -0.04014846310019493 -0.8513460755348206 1.0216155052185059 3.7252898543727042e-09 -0.9988899230957031 0.04710644856095314 -0.05652773752808571 -0.8522922396659851 0.02463977038860321 0.5224851369857788 -0.6269820332527161 0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000093.txt:
--------------------------------------------------------------------------------
1 | -0.6819634437561035 -0.022973379120230675 -0.7310251593589783 0.8772302269935608 -9.313223969797946e-09 -0.9995065331459045 0.03141074627637863 -0.03769290819764137 -0.7313860654830933 0.02142098918557167 0.6816269159317017 -0.8179523944854736 0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000094.txt:
--------------------------------------------------------------------------------
1 | -0.8136734962463379 -0.009131004102528095 -0.5812501311302185 0.6975001096725464 -4.190950253502024e-09 -0.9998766779899597 0.015707319602370262 -0.018848778679966927 -0.5813218355178833 0.012780634686350822 0.8135731816291809 -0.9762880206108093 0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000095.txt:
--------------------------------------------------------------------------------
1 | -0.9129449129104614 -1.2935611884759817e-15 -0.4080818295478821 0.4896984398365021 4.2351617070456256e-22 -1.0 3.169856057190978e-15 -3.8038288779917735e-15 -0.4080818295478821 2.8939047931950254e-15 0.9129449129104614 -1.0955342054367065 0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000096.txt:
--------------------------------------------------------------------------------
1 | -0.9758200645446777 0.003433206817135215 -0.21854621171951294 0.2622557282447815 -8.381896066111949e-09 -0.9998766183853149 -0.015707315877079964 0.018848782405257225 -0.2185731828212738 -0.015327518805861473 0.9756997227668762 -1.1708403825759888 -0.0 0.0 0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000097.txt:
--------------------------------------------------------------------------------
1 | -0.9997926354408264 0.0006389844347722828 -0.020337846130132675 0.024408958852291107 1.5809190756499447e-07 -0.9995064735412598 -0.03141075372695923 0.037692904472351074 -0.02034788206219673 -0.03140425682067871 0.9992992877960205 -1.1991593837738037 -0.0 0.0 0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000098.txt:
--------------------------------------------------------------------------------
1 | -0.9839062690734863 -0.00841712299734354 0.17848443984985352 -0.2141815721988678 1.3038505386475663e-08 -0.9988898634910583 -0.04710642620921135 0.05652773752808571 0.1786828190088272 -0.04634832963347435 0.9828140139579773 -1.1793771982192993 -0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000099.txt:
--------------------------------------------------------------------------------
1 | -0.9287950992584229 -0.023269735276699066 0.36986207962036133 -0.4438343644142151 -1.4901159417490817e-08 -0.9980266094207764 -0.06279050558805466 0.0753486156463623 0.3705933690071106 -0.05831952393054962 0.9269623160362244 -1.1123547554016113 -0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000100.txt:
--------------------------------------------------------------------------------
1 | -0.8366557955741882 -0.04297434538602829 0.5460407733917236 -0.6552488803863525 -3.725291186640334e-09 -0.9969173669815063 -0.07845912128686905 0.09415092319250107 0.5477291941642761 -0.06564325839281082 0.8340766429901123 -1.000891923904419 -0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000101.txt:
--------------------------------------------------------------------------------
1 | -0.7111608982086182 -0.06616085022687912 0.6999088525772095 -0.839890718460083 -1.4901154088420299e-08 -0.9955620169639587 -0.09410828351974487 0.11292998492717743 0.7030289173126221 -0.06692616641521454 0.7080047130584717 -0.8496062159538269 -0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000102.txt:
--------------------------------------------------------------------------------
1 | -0.557314932346344 -0.09111247956752777 0.8252866864204407 -0.9903444051742554 7.450577044210149e-09 -0.993960976600647 -0.10973427444696426 0.1316811740398407 0.8303009271621704 -0.06115657836198807 0.5539493560791016 -0.6647393703460693 -0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000103.txt:
--------------------------------------------------------------------------------
1 | -0.3812505602836609 -0.115867018699646 0.9171820282936096 -1.1006184816360474 -3.725290298461914e-09 -0.9921146631240845 -0.12533321976661682 0.15039989352226257 0.9244717359542847 -0.04778335988521576 0.3782442808151245 -0.4538930654525757 -0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000104.txt:
--------------------------------------------------------------------------------
1 | -0.1899867206811905 -0.13833492994308472 0.971992015838623 -1.1663905382156372 7.450580596923828e-09 -0.990023672580719 -0.14090122282505035 0.16908153891563416 0.9817867279052734 -0.026769354939460754 0.18809135258197784 -0.22570960223674774 -0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000105.txt:
--------------------------------------------------------------------------------
1 | 0.008851335383951664 -0.15642881393432617 0.9876496195793152 -1.185179591178894 1.7462300494486271e-09 -0.9876883029937744 -0.15643493831157684 0.1877213567495346 0.9999608993530273 0.0013846629299223423 -0.008742359466850758 0.01049080304801464 -0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000106.txt:
--------------------------------------------------------------------------------
1 | 0.20733638107776642 -0.16819317638874054 0.9637025594711304 -1.1564432382583618 -7.450580596923828e-09 -0.9851093292236328 -0.171929270029068 0.20631493628025055 0.9782696962356567 0.035647179931402206 -0.20424900949001312 0.24509884417057037 -0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000107.txt:
--------------------------------------------------------------------------------
1 | 0.39755570888519287 -0.1719369888305664 0.9013251662254333 -1.081590175628662 -2.2351741790771484e-08 -0.9822872877120972 -0.1873813271522522 0.22485756874084473 0.9175780415534973 0.07449448853731155 -0.39051389694213867 0.4686166048049927 -0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000108.txt:
--------------------------------------------------------------------------------
1 | 0.5719255805015564 -0.16634754836559296 0.8032617568969727 -0.9639140367507935 2.9802318834981634e-08 -0.9792227745056152 -0.20278732478618622 0.2433447390794754 0.8203054070472717 0.11597928404808044 -0.5600425601005554 0.672051191329956 -0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000109.txt:
--------------------------------------------------------------------------------
1 | 0.7234946489334106 -0.1505908966064453 0.6737046241760254 -0.8084455132484436 -7.450580596923828e-09 -0.9759168028831482 -0.21814334392547607 0.26177188754081726 0.6903300285339355 0.1578255444765091 -0.7060705423355103 0.8472847938537598 -0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000110.txt:
--------------------------------------------------------------------------------
1 | 0.8462203741073608 -0.12438744306564331 0.5181108713150024 -0.6217329502105713 -0.0 -0.972369909286499 -0.2334454357624054 0.2801344394683838 0.5328330993652344 0.19754627346992493 -0.8228392004966736 0.9874071478843689 -0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000111.txt:
--------------------------------------------------------------------------------
1 | 0.9352098703384399 -0.08805953711271286 0.34296926856040955 -0.41156312823295593 -0.0 -0.9685831069946289 -0.24868986010551453 0.2984278202056885 0.3540937900543213 0.23257721960544586 -0.9058284759521484 1.0869944095611572 -0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000112.txt:
--------------------------------------------------------------------------------
1 | 0.9869155883789062 -0.04254636913537979 0.15552331507205963 -0.18662789463996887 -7.450581485102248e-09 -0.9645574688911438 -0.26387304067611694 0.31664755940437317 0.16123799979686737 0.26042044162750244 -0.9519367218017578 1.1423239707946777 -0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000113.txt:
--------------------------------------------------------------------------------
1 | 0.9992760419845581 0.010614471510052681 -0.036535248160362244 0.04384230822324753 9.313225746154785e-10 -0.960293710231781 -0.27899110317230225 0.3347893953323364 -0.038045912981033325 0.27878910303115845 -0.9595984220504761 1.1515181064605713 -0.0 0.0 0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000114.txt:
--------------------------------------------------------------------------------
1 | 0.9717984795570374 0.06933855265378952 -0.2253885120153427 0.2704661190509796 -1.4901162970204496e-08 -0.9557930827140808 -0.29404035210609436 0.3528483510017395 -0.23581309616565704 0.2857479453086853 -0.9288381934165955 1.1146059036254883 -0.0 0.0 0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000115.txt:
--------------------------------------------------------------------------------
1 | 0.9055783748626709 0.1310785412788391 -0.40341824293136597 0.4841018319129944 1.4901162970204496e-08 -0.9510565996170044 -0.30901703238487244 0.37082037329673767 -0.4241790473461151 0.2798391580581665 -0.8612562417984009 1.0335074663162231 -0.0 0.0 0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000116.txt:
--------------------------------------------------------------------------------
1 | 0.8032556176185608 0.19293642044067383 -0.5635209679603577 0.6762250065803528 -0.0 -0.9460852742195129 -0.3239175081253052 0.3887009024620056 -0.595634400844574 0.2601885497570038 -0.7599483132362366 0.9119382500648499 -0.0 0.0 0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000117.txt:
--------------------------------------------------------------------------------
1 | 0.6689097285270691 0.2517986595630646 -0.6993976831436157 0.8392772674560547 -2.9802322387695312e-08 -0.9408807754516602 -0.3387379050254822 0.40648549795150757 -0.7433436512947083 0.22658511996269226 -0.6293643712997437 0.7552372217178345 -0.0 0.0 0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000118.txt:
--------------------------------------------------------------------------------
1 | 0.5078965425491333 0.30448970198631287 -0.805808424949646 0.966969907283783 -2.9802322387695312e-08 -0.9354440569877625 -0.3534749150276184 0.4241698086261749 -0.8614181280136108 0.17952869832515717 -0.4751087725162506 0.5701305866241455 -0.0 0.0 0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000119.txt:
--------------------------------------------------------------------------------
1 | 0.32663485407829285 0.34793341159820557 -0.8787785172462463 1.0545341968536377 -4.4703469370688254e-08 -0.9297763109207153 -0.3681248426437378 0.4417494237422943 -0.9451503753662109 0.12024238705635071 -0.3036973476409912 0.3644372224807739 -0.0 0.0 0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000120.txt:
--------------------------------------------------------------------------------
1 | 0.1323518306016922 0.3793167471885681 -0.9157520532608032 1.0989023447036743 1.4901161193847656e-08 -0.9238796234130859 -0.38268330693244934 0.4592200517654419 -0.9912027716636658 0.05064881592988968 -0.1222771555185318 0.14673250913619995 -0.0 0.0 0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000121.txt:
--------------------------------------------------------------------------------
1 | -0.06720828264951706 0.3962496519088745 -0.9156795144081116 1.0988155603408813 -3.166496043149891e-08 -0.9177546501159668 -0.39714762568473816 0.476577490568161 -0.9977388381958008 -0.0266916174441576 0.06168072298169136 -0.07401663064956665 -0.0 0.0 0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000122.txt:
--------------------------------------------------------------------------------
1 | -0.2640887498855591 0.39690470695495605 -0.8790467977523804 1.0548564195632935 -1.0430807861894209e-07 -0.9114033579826355 -0.4115141034126282 0.4938172996044159 -0.9644981622695923 -0.1086762398481369 0.2406913787126541 -0.28882941603660583 -0.0 0.0 0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000123.txt:
--------------------------------------------------------------------------------
1 | -0.45044049620628357 0.3801383674144745 -0.807835042476654 0.9694024920463562 -1.0430805730266002e-07 -0.9048270583152771 -0.42577916383743286 0.5109351277351379 -0.8928060531616211 -0.19178827106952667 0.4075707793235779 -0.489084929227829 -0.0 0.0 0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000124.txt:
--------------------------------------------------------------------------------
1 | -0.6188351511955261 0.3455813229084015 -0.7054193019866943 0.8465033173561096 -4.470347292340193e-08 -0.8980275392532349 -0.439939022064209 0.5279269218444824 -0.7855206727981567 -0.2722497582435608 0.5557310581207275 -0.6668769717216492 -0.0 0.0 0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000125.txt:
--------------------------------------------------------------------------------
1 | -0.7625583410263062 0.2936951220035553 -0.576409101486206 0.6916911005973816 -4.4703462265260896e-08 -0.8910065293312073 -0.4539904296398163 0.5447885990142822 -0.6469191312789917 -0.3461942672729492 0.6794444918632507 -0.8153334856033325 -0.0 0.0 0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000126.txt:
--------------------------------------------------------------------------------
1 | -0.8758810758590698 0.22578869760036469 -0.42644059658050537 0.5117289423942566 -4.470348002882929e-08 -0.8837655782699585 -0.4679297208786011 0.5615156888961792 -0.48252683877944946 -0.4098508059978485 0.774073600769043 -0.9288883209228516 -0.0 0.0 0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000127.txt:
--------------------------------------------------------------------------------
1 | -0.9542849063873291 0.14399497210979462 -0.2619266211986542 0.3143114745616913 3.650783639841393e-07 -0.8763066530227661 -0.4817536175251007 0.5781043767929077 -0.2988981604576111 -0.459730327129364 0.8362461924552917 -1.003495693206787 -0.0 0.0 0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000128.txt:
--------------------------------------------------------------------------------
1 | -0.9946445822715759 0.05120658501982689 -0.08977368474006653 0.1077304556965828 -5.103644298287691e-07 -0.8686315417289734 -0.4954585134983063 0.5945504903793335 -0.10335099697113037 -0.49280521273612976 0.8639796376228333 -1.0367757081985474 -0.0 0.0 0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000129.txt:
--------------------------------------------------------------------------------
1 | -0.9953508973121643 -0.04902723804116249 0.08289926499128342 -0.09948068112134933 6.332989528345934e-07 -0.8607419729232788 -0.5090413689613342 0.6108497381210327 0.0963117778301239 -0.5066748857498169 0.8567403554916382 -1.0280886888504028 -0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000130.txt:
--------------------------------------------------------------------------------
1 | -0.9563760161399841 -0.1526419222354889 0.24908897280693054 -0.2989071309566498 7.450580596923828e-09 -0.8526401519775391 -0.5224985480308533 0.6269983053207397 0.2921384572982788 -0.49970507621765137 0.8154445886611938 -0.9785334467887878 -0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000131.txt:
--------------------------------------------------------------------------------
1 | -0.8792728781700134 -0.2552239000797272 0.4021683931350708 -0.48260238766670227 7.450576333667414e-08 -0.844327986240387 -0.5358267426490784 0.6429921984672546 0.476317822933197 -0.47113797068595886 0.7423946261405945 -0.8908737301826477 -0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000132.txt:
--------------------------------------------------------------------------------
1 | -0.767116367816925 -0.35220232605934143 0.536176860332489 -0.6434125900268555 -0.0 -0.8358073830604553 -0.5490227341651917 0.6588274240493774 0.6415076851844788 -0.4211643934249878 0.6411615014076233 -0.7693938612937927 -0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000133.txt:
--------------------------------------------------------------------------------
1 | -0.6243770122528076 -0.4390561878681183 0.6460515856742859 -0.7752619981765747 5.960462345910855e-08 -0.8270806670188904 -0.5620833039283752 0.674500048160553 0.7811228632926941 -0.3509519398212433 0.5164101123809814 -0.6196922063827515 -0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000134.txt:
--------------------------------------------------------------------------------
1 | -0.45674604177474976 -0.5115229487419128 0.7278236150741577 -0.8733885884284973 4.470348002882929e-08 -0.8181498050689697 -0.5750052332878113 0.6900063753128052 0.8895970582962036 -0.26263129711151123 0.37368670105934143 -0.4484238922595978 -0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000135.txt:
--------------------------------------------------------------------------------
1 | -0.27090585231781006 -0.5658054351806641 0.7787646651268005 -0.9345173835754395 1.4901162970204496e-08 -0.8090171217918396 -0.5877851843833923 0.7053421139717102 0.962605893611908 -0.159234419465065 0.21916747093200684 -0.26300084590911865 -0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000136.txt:
--------------------------------------------------------------------------------
1 | -0.0742654800415039 -0.5987615585327148 0.7974767088890076 -0.9569714665412903 -7.4505797087454084e-09 -0.7996850609779358 -0.6004195213317871 0.7205042839050293 0.9972383975982666 -0.04459046944975853 0.059388987720012665 -0.07126673310995102 -0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000137.txt:
--------------------------------------------------------------------------------
1 | 0.12533560395240784 -0.6080741286277771 0.7839240431785583 -0.9407090544700623 3.725290298461914e-09 -0.7901548743247986 -0.6129072308540344 0.7354885339736938 0.9921144247055054 0.07681908458471298 -0.09903453290462494 0.1188414990901947 -0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000138.txt:
--------------------------------------------------------------------------------
1 | 0.3199399411678314 -0.5923787355422974 0.7394092082977295 -0.8872910737991333 -0.0 -0.7804303765296936 -0.6252428889274597 0.7502911686897278 0.9474378824234009 0.20004017651081085 -0.24969083070755005 0.2996290326118469 -0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000139.txt:
--------------------------------------------------------------------------------
1 | 0.5017891526222229 -0.5513653755187988 0.6664860248565674 -0.7997834086418152 1.192092469182171e-07 -0.770513117313385 -0.6374239921569824 0.7649087309837341 0.8649898171424866 0.3198525011539459 -0.38663509488105774 0.4639623761177063 -0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000140.txt:
--------------------------------------------------------------------------------
1 | 0.6636338233947754 -0.4858245551586151 0.5688273906707764 -0.6825927495956421 8.940696716308594e-08 -0.7604058980941772 -0.6494481563568115 0.7793376445770264 0.7480576038360596 0.43099576234817505 -0.5046311020851135 0.6055574417114258 -0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000141.txt:
--------------------------------------------------------------------------------
1 | 0.7990213632583618 -0.3976486325263977 0.4510436952114105 -0.5412524342536926 2.9802318834981634e-08 -0.7501109838485718 -0.66131192445755 0.793574333190918 0.6013026237487793 0.5284023284912109 -0.5993546843528748 0.7192258834838867 -0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000142.txt:
--------------------------------------------------------------------------------
1 | 0.9025545120239258 -0.2897827625274658 0.31846699118614197 -0.38216039538383484 -2.9802322387695312e-08 -0.7396310567855835 -0.6730126142501831 0.8076150417327881 0.43057551980018616 0.607430636882782 -0.6675573587417603 0.8010690212249756 -0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000143.txt:
--------------------------------------------------------------------------------
1 | 0.970105767250061 -0.16612771153450012 0.17690807580947876 -0.21228961646556854 7.450580596923828e-09 -0.728968620300293 -0.6845470666885376 0.8214565515518188 0.24268268048763275 0.6640830039978027 -0.707176685333252 0.8486118316650391 -0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000144.txt:
--------------------------------------------------------------------------------
1 | 0.9989818334579468 -0.03139603137969971 0.03239819407463074 -0.038877833634614944 1.862645371275562e-09 -0.7181263566017151 -0.6959128975868225 0.8350954055786133 0.04511489346623421 0.6952042579650879 -0.7173951864242554 0.8608742952346802 -0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000145.txt:
--------------------------------------------------------------------------------
1 | 0.9880316853523254 0.1090722382068634 -0.1090722382068634 0.13088670372962952 -0.0 -0.7071068286895752 -0.7071068286895752 0.848528265953064 -0.15425144135951996 0.6986439228057861 -0.6986439228057861 0.8383726477622986 -0.0 0.0 0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000146.txt:
--------------------------------------------------------------------------------
1 | 0.9376917481422424 0.2495262175798416 -0.24180757999420166 0.2901691794395447 2.980232594040899e-08 -0.6959127187728882 -0.7181264758110046 0.8617516160011292 -0.3474683463573456 0.6733812093734741 -0.6525515913963318 0.7830621004104614 -0.0 0.0 0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000147.txt:
--------------------------------------------------------------------------------
1 | 0.8499690294265747 0.38404446840286255 -0.3606417775154114 0.4327700436115265 -1.4901161193847656e-08 -0.6845471262931824 -0.728968620300293 0.8747624158859253 -0.5268326997756958 0.619600772857666 -0.5818438529968262 0.6982126832008362 -0.0 0.0 0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000148.txt:
--------------------------------------------------------------------------------
1 | 0.7283607721328735 0.5067906975746155 -0.46114397048950195 0.553372859954834 2.9802322387695312e-08 -0.6730124950408936 -0.7396311163902283 0.8875573873519897 -0.6851938366889954 0.5387182831764221 -0.4901959300041199 0.588235080242157 -0.0 0.0 0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000149.txt:
--------------------------------------------------------------------------------
1 | 0.5777150988578796 0.6122695207595825 -0.5397883057594299 0.6477459669113159 5.960465188081798e-08 -0.6613119840621948 -0.7501110434532166 0.9001331925392151 -0.8162385821342468 0.4333503842353821 -0.38204991817474365 0.4584598243236542 -0.0 0.0 0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000150.txt:
--------------------------------------------------------------------------------
1 | 0.4040374457836151 0.6955756545066833 -0.5940772891044617 0.7128933072090149 -2.2351731843173184e-07 -0.6494478583335876 -0.760405957698822 0.912487268447876 -0.9147422909736633 0.30723246932029724 -0.26240116357803345 0.3148817718029022 -0.0 0.0 0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000151.txt:
--------------------------------------------------------------------------------
1 | 0.21425242722034454 0.7526208758354187 -0.622621476650238 0.7471462488174438 -5.215405352032576e-08 -0.6374234557151794 -0.7705134749412537 0.924615740776062 -0.9767781496047974 0.1650843769311905 -0.1365695297718048 0.16388361155986786 -0.0 0.0 0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000152.txt:
--------------------------------------------------------------------------------
1 | 0.01592571847140789 0.7803348898887634 -0.6251589059829712 0.7501961588859558 -6.938351759799843e-08 -0.6252382397651672 -0.7804338932037354 0.936516523361206 -0.9998730421066284 0.01242893747985363 -0.009957351721823215 0.01194903813302517 -0.0 0.0 0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000153.txt:
--------------------------------------------------------------------------------
1 | -0.18303552269935608 0.7768062353134155 -0.6025526523590088 0.7230633497238159 -1.043080928297968e-07 -0.6129070520401001 -0.7901548743247986 0.9481860995292664 -0.9831060767173767 -0.14462649822235107 0.11218380182981491 -0.13462068140506744 -0.0 0.0 0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000154.txt:
--------------------------------------------------------------------------------
1 | -0.3747004270553589 0.7414241433143616 -0.5566772818565369 0.6680126190185547 -4.470347292340193e-08 -0.6004204750061035 -0.799684464931488 0.9596216082572937 -0.9271458387374878 -0.2996421754360199 0.2249777913093567 -0.26997312903404236 -0.0 0.0 0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000155.txt:
--------------------------------------------------------------------------------
1 | -0.5514266490936279 0.6749008893966675 -0.49034419655799866 0.5884130001068115 1.4901161193847656e-08 -0.5877853035926819 -0.80901700258255 0.970820426940918 -0.8342233896255493 -0.44611358642578125 0.32412049174308777 -0.38894450664520264 -0.0 0.0 0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000156.txt:
--------------------------------------------------------------------------------
1 | -0.7061696648597717 0.5792850852012634 -0.40712860226631165 0.48855406045913696 1.4901168299275014e-08 -0.5750053524971008 -0.818149745464325 0.9817796945571899 -0.7080430388450623 -0.5777523517608643 0.4060514271259308 -0.48726147413253784 -0.0 0.0 0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000157.txt:
--------------------------------------------------------------------------------
1 | -0.8327592015266418 0.4579005837440491 -0.3111884593963623 0.37342676520347595 -3.7252868878567824e-07 -0.5620833039283752 -0.827080488204956 0.9924965500831604 -0.553634524345398 -0.6887590885162354 0.4680800437927246 -0.5616962909698486 -0.0 0.0 0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000158.txt:
--------------------------------------------------------------------------------
1 | -0.9261496067047119 0.3152289092540741 -0.2070665806531906 0.24848027527332306 -7.45057349149647e-08 -0.5490228533744812 -0.835807204246521 1.0029689073562622 -0.3771549463272095 -0.7740828990936279 0.5084771513938904 -0.6101730465888977 -0.0 0.0 0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000159.txt:
--------------------------------------------------------------------------------
1 | -0.9826175570487976 0.15674014389514923 -0.09946972131729126 0.11936488747596741 -4.917378646496218e-07 -0.5358267426490784 -0.8443277478218079 1.0131934881210327 -0.18563862144947052 -0.8296516537666321 0.5265126824378967 -0.6318156123161316 -0.0 0.0 0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000160.txt:
--------------------------------------------------------------------------------
1 | -0.9999117851257324 -0.011320343241095543 0.006937115918844938 -0.008324497379362583 -0.0 -0.522498607635498 -0.8526401519775391 1.0231682062149048 0.013276812620460987 -0.8525649905204773 0.5224524140357971 -0.626943051815033 -0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000161.txt:
--------------------------------------------------------------------------------
1 | -0.9773425459861755 -0.18218766152858734 0.10774486511945724 -0.12929487228393555 5.662440685227921e-07 -0.5090415477752686 -0.8607418537139893 1.0328903198242188 0.2116631716489792 -0.8412397503852844 0.49750807881355286 -0.5970093607902527 -0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000162.txt:
--------------------------------------------------------------------------------
1 | -0.9158093929290771 -0.3488530218601227 0.1989825814962387 -0.2387789785861969 -2.6822073095900123e-07 -0.49545881152153015 -0.8686313033103943 1.0423578023910522 0.40161237120628357 -0.7955010533332825 0.45374563336372375 -0.5444949865341187 -0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000163.txt:
--------------------------------------------------------------------------------
1 | -0.8177659511566162 -0.5043586492538452 0.2772735059261322 -0.3327282667160034 1.4901154088420299e-08 -0.48175370693206787 -0.8763065338134766 1.051567792892456 0.575550377368927 -0.7166138887405396 0.39396175742149353 -0.47275421023368835 -0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000164.txt:
--------------------------------------------------------------------------------
1 | -0.6871210336685181 -0.6420933604240417 0.33997073769569397 -0.4079653024673462 3.1292415769712534e-07 -0.4679299294948578 -0.8837653398513794 1.0605188608169556 0.7265424728393555 -0.6072539687156677 0.3215245306491852 -0.385829359292984 -0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000165.txt:
--------------------------------------------------------------------------------
1 | -0.5290825366973877 -0.7560816407203674 0.3852425813674927 -0.4622913897037506 1.3411039390121005e-07 -0.4539903998374939 -0.8910064697265625 1.069207787513733 0.8485701680183411 -0.47141605615615845 0.24019837379455566 -0.28823819756507874 -0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000166.txt:
--------------------------------------------------------------------------------
1 | -0.3499513566493988 -0.8412432074546814 0.4121206998825073 -0.49454501271247864 2.0861612881617475e-07 -0.4399392604827881 -0.8980274200439453 1.0776331424713135 0.936767578125 -0.3142661154270172 0.15395735204219818 -0.18474876880645752 -0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000167.txt:
--------------------------------------------------------------------------------
1 | -0.15686866641044617 -0.8936248421669006 0.42050766944885254 -0.5046095252037048 8.940696005765858e-08 -0.4257791042327881 -0.9048271179199219 1.0857925415039062 0.9876194596290588 -0.14193904399871826 0.06679143011569977 -0.08014968037605286 -0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000168.txt:
--------------------------------------------------------------------------------
1 | 0.04246791824698448 -0.910581648349762 0.4111417531967163 -0.4933716952800751 2.60770320892334e-08 -0.41151300072669983 -0.9114038348197937 1.0936838388442993 0.9990978240966797 0.03870541974902153 -0.017476091161370277 0.020971447229385376 -0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000169.txt:
--------------------------------------------------------------------------------
1 | 0.2401116043329239 -0.890906035900116 0.3855292797088623 -0.462635338306427 -1.4901161193847656e-08 -0.3971477150917053 -0.9177546501159668 1.1013054847717285 0.970745325088501 0.2203635573387146 -0.09535978734493256 0.11443176120519638 -0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000170.txt:
--------------------------------------------------------------------------------
1 | 0.42818257212638855 -0.834902822971344 0.34582775831222534 -0.41499361395835876 -2.9802318834981634e-08 -0.3826831877231598 -0.9238796234130859 1.1086554527282715 0.9036921262741089 0.39558911323547363 -0.1638583242893219 0.1966300755739212 -0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000171.txt:
--------------------------------------------------------------------------------
1 | 0.5991833806037903 -0.744390070438385 0.29472458362579346 -0.35366982221603394 1.4901157641133977e-08 -0.3681242763996124 -0.9297765493392944 1.1157318353652954 0.8006117343902588 0.557106614112854 -0.22057394683361053 0.26468899846076965 -0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000172.txt:
--------------------------------------------------------------------------------
1 | 0.7462967038154602 -0.6226441264152527 0.23527754843235016 -0.282333105802536 2.9802318834981634e-08 -0.35347476601600647 -0.9354439973831177 1.1225329637527466 0.6656134724617004 0.6981187462806702 -0.26379701495170593 0.31655651330947876 -0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000173.txt:
--------------------------------------------------------------------------------
1 | 0.8636573553085327 -0.47427839040756226 0.1707507073879242 -0.20490090548992157 -0.0 -0.3387379050254822 -0.9408807158470154 1.1290568113327026 0.5040791630744934 0.8125985264778137 -0.29255348443984985 0.3510642647743225 -0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000174.txt:
--------------------------------------------------------------------------------
1 | 0.9465868473052979 -0.30506426095962524 0.10444684326648712 -0.12533621490001678 1.4901162970204496e-08 -0.32391735911369324 -0.9460853934288025 1.1353024244308472 0.3224489986896515 0.8955519795417786 -0.306615948677063 0.3679392337799072 -0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000175.txt:
--------------------------------------------------------------------------------
1 | 0.9917788505554199 -0.1217007040977478 0.03954293206334114 -0.04745154082775116 -3.725290298461914e-09 -0.3090168833732605 -0.9510565400123596 1.141268014907837 0.12796369194984436 0.9432377815246582 -0.3064764142036438 0.36777186393737793 -0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000176.txt:
--------------------------------------------------------------------------------
1 | 0.997431755065918 0.06845686584711075 -0.021060077473521233 0.025272099301218987 -0.0 -0.2940402626991272 -0.955793023109436 1.146951675415039 -0.07162310928106308 0.9533383250236511 -0.2932851016521454 0.35194218158721924 -0.0 0.0 0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000177.txt:
--------------------------------------------------------------------------------
1 | 0.9633201360702515 0.257699191570282 -0.07486848533153534 0.08984224498271942 -6.705520405603238e-08 -0.27899086475372314 -0.9602935314178467 1.1523525714874268 -0.26835453510284424 0.9250701665878296 -0.26875752210617065 0.3225092887878418 -0.0 0.0 0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000178.txt:
--------------------------------------------------------------------------------
1 | 0.8908040523529053 0.4382828176021576 -0.1199006661772728 0.143880695104599 -0.0 -0.2638731598854065 -0.9645572900772095 1.1574686765670776 -0.45438748598098755 0.8592315912246704 -0.23505929112434387 0.2820710241794586 -0.0 0.0 0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000179.txt:
--------------------------------------------------------------------------------
1 | 0.7827745079994202 0.6027545928955078 -0.15476103127002716 0.1857132613658905 -1.4901161193847656e-08 -0.24868980050086975 -0.9685832262039185 1.1622997522354126 -0.6223054528236389 0.7581822276115417 -0.1946680247783661 0.23360170423984528 -0.0 0.0 0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000180.txt:
--------------------------------------------------------------------------------
1 | 0.6435381174087524 0.7442656755447388 -0.17868220806121826 0.21441881358623505 -5.960463766996327e-08 -0.23344513773918152 -0.972369909286499 1.1668438911437988 -0.7654140591621399 0.625757098197937 -0.15023081004619598 0.18027718365192413 -0.0 0.0 0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000181.txt:
--------------------------------------------------------------------------------
1 | 0.4786456823348999 0.8568629026412964 -0.1915312558412552 0.2298377901315689 -1.4901159417490817e-08 -0.21814295649528503 -0.9759168028831482 1.1711000204086304 -0.8780080676078796 0.46711835265159607 -0.10441319644451141 0.12529604136943817 -0.0 0.0 0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000182.txt:
--------------------------------------------------------------------------------
1 | 0.2946713864803314 0.9357439875602722 -0.19378307461738586 0.23253990709781647 2.607702853651972e-08 -0.2027871459722519 -0.9792227745056152 1.17506742477417 -0.9555985927581787 0.28854894638061523 -0.05975561589002609 0.07170679420232773 -0.0 0.0 0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000183.txt:
--------------------------------------------------------------------------------
1 | 0.09894955158233643 0.9774670600891113 -0.186459481716156 0.22375409305095673 4.6566128730773926e-08 -0.18737904727458954 -0.9822876453399658 1.1787446737289429 -0.9950924515724182 0.09719691425561905 -0.01854112185537815 0.022249583154916763 -0.0 0.0 0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000184.txt:
--------------------------------------------------------------------------------
1 | -0.10071694850921631 0.9801000952720642 -0.17105454206466675 0.2052658498287201 -6.89178563106907e-08 -0.17192883789539337 -0.985109269618988 1.1821311712265015 -0.9949150085449219 -0.0992172583937645 0.01731616072356701 -0.0207794401794672 -0.0 0.0 0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000185.txt:
--------------------------------------------------------------------------------
1 | -0.29636847972869873 0.9433149099349976 -0.14940685033798218 0.17928773164749146 -1.527368311826649e-07 -0.15643510222434998 -0.9876880645751953 1.1852260828018188 -0.9550734162330627 -0.2927198112010956 0.046362414956092834 -0.05563471466302872 -0.0 0.0 0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000186.txt:
--------------------------------------------------------------------------------
1 | -0.4802047610282898 0.8684056997299194 -0.12359234690666199 0.14831088483333588 -1.527369306586479e-07 -0.14090117812156677 -0.9900237321853638 1.188028335571289 -0.8771565556526184 -0.4754140377044678 0.06766162067651749 -0.0811937153339386 -0.0 0.0 0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000187.txt:
--------------------------------------------------------------------------------
1 | -0.6448968648910522 0.7582430243492126 -0.0957883819937706 0.11494607478380203 -1.4156101713069802e-07 -0.12533338367938995 -0.9921146631240845 1.190537691116333 -0.7642695903778076 -0.6398116946220398 0.08082716166973114 -0.0969923734664917 -0.0 0.0 0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000188.txt:
--------------------------------------------------------------------------------
1 | -0.783878743648529 0.6171642541885376 -0.06813523918390274 0.08176270127296448 -3.2782554626464844e-07 -0.10973420739173889 -0.9939610362052917 1.1927533149719238 -0.6209139823913574 -0.7791448831558228 0.08601849526166916 -0.1032220870256424 -0.0 0.0 0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000189.txt:
--------------------------------------------------------------------------------
1 | -0.8916096687316895 0.45079466700553894 -0.04261254519224167 0.05113517865538597 -8.19563368281706e-08 -0.09410841017961502 -0.9955618381500244 1.1946742534637451 -0.45280423760414124 -0.8876528143882751 0.08390773087739944 -0.10068946331739426 -0.0 0.0 0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000190.txt:
--------------------------------------------------------------------------------
1 | -0.9637949466705322 0.2658207416534424 -0.020919324830174446 0.02510467730462551 -1.2833611435780767e-06 -0.07845940440893173 -0.9969170093536377 1.196300745010376 -0.26664260029792786 -0.9608241319656372 0.07561864703893661 -0.09074220806360245 -0.0 0.0 0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000191.txt:
--------------------------------------------------------------------------------
1 | -0.9975574016571045 0.06970969587564468 -0.004386159125715494 0.005263194907456636 3.86498697935167e-07 -0.06279079616069794 -0.9980266094207764 1.1976321935653687 -0.06984754651784897 -0.9955891370773315 0.06263715028762817 -0.07516458630561829 -0.0 0.0 0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000192.txt:
--------------------------------------------------------------------------------
1 | -0.9915500283241272 -0.1295798271894455 0.0061101061291992664 -0.007333071436733007 7.31088050542894e-07 -0.0471065416932106 -0.9988898634910583 1.1986677646636963 0.12972381711006165 -0.9904493689537048 0.04670844227075577 -0.05605006963014603 -0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000193.txt:
--------------------------------------------------------------------------------
1 | -0.9460127353668213 -0.32396966218948364 0.0101803382858634 -0.012217401526868343 8.381903739973495e-07 -0.03141067922115326 -0.9995065927505493 1.199407935142517 0.324129581451416 -0.9455459117889404 0.02971518225967884 -0.03565797209739685 -0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/shapenet_pose/example/pose/000194.txt:
--------------------------------------------------------------------------------
1 | -0.8627605438232422 -0.5055502653121948 0.007941310293972492 -0.009530180133879185 6.407498744920304e-07 -0.01570744998753071 -0.9998766183853149 1.1998521089553833 0.5056126117706299 -0.8626541495323181 0.013552011922001839 -0.016261987388134003 -0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/Triplanerecon/train.py:
--------------------------------------------------------------------------------
1 | import os, sys
2 | import numpy as np
3 | import imageio
4 | import json
5 | import random
6 | import time
7 | import torch
8 | import torch.nn as nn
9 | import torch.nn.functional as F
10 | from tqdm import tqdm, trange
11 | from configparse import config_parser
12 | import matplotlib.pyplot as plt
13 | import ipdb
14 | from run_nerf_helpers import *
15 | from torch.utils.data import DataLoader
16 | import logging
17 | from torch.nn.parallel import DistributedDataParallel as DDP
18 | import torch.distributed as dist
19 | import torch.nn as nn
20 |
21 | parser = config_parser()
22 | args = parser.parse_args()
23 | torch.cuda.set_device(int(os.environ['LOCAL_RANK']))
24 | WORLD_SIZE = int(os.environ['WORLD_SIZE'])
25 | WORLD_RANK = int(os.environ['RANK'])
26 | dist.init_process_group(backend='nccl',rank=WORLD_RANK, world_size=WORLD_SIZE)
27 | np.random.seed(0)
28 |
29 |
30 |
31 |
32 | def train(args):
33 | if args.dataset=='omni':
34 | from omni_dataset import OurDDataset
35 | elif args.dataset=='shapenet':
36 | from shapenet_dataset import OurDDataset
37 | elif args.dataset=='shapenet_alldecoder':
38 | from shapenet_dataset_all import OurDDataset
39 | else:
40 | print('error dataset')
41 | traindata=OurDDataset(args,args.datadir)
42 | train_sampler = torch.utils.data.distributed.DistributedSampler(traindata)
43 |
44 | training_loader = torch.utils.data.DataLoader(traindata, batch_size=args.batch_size,num_workers=args.num_worker, sampler=train_sampler,generator=torch.Generator(device='cuda'))
45 |
46 | # Create log dir and copy the config file
47 | basedir = args.basedir
48 | expname = args.expname
49 | os.makedirs(os.path.join(basedir, expname), exist_ok=True)
50 | f = os.path.join(basedir, expname, 'args.txt')
51 | with open(f, 'w') as file:
52 | for arg in sorted(vars(args)):
53 | attr = getattr(args, arg)
54 | file.write('{} = {}\n'.format(arg, attr))
55 | if args.config is not None:
56 | f = os.path.join(basedir, expname, 'config.txt')
57 | with open(f, 'w') as file:
58 | file.write(open(args.config, 'r').read())
59 |
60 | # Create nerf model
61 | render_kwargs_train, render_kwargs_test, start, grad_vars, optimizer = create_nerf(args)
62 | global_step = start
63 |
64 |
65 | iter_per_epoch = len(training_loader)
66 | logger = get_logger(os.path.join(basedir,expname,str(dist.get_rank())+'exp.log'))
67 |
68 | logger.info('start training!')
69 |
70 |
71 | while global_step < args.N_iters:
72 | epoch = global_step // iter_per_epoch
73 | training_loader.sampler.set_epoch(epoch)
74 | time0 = time.time()
75 | for data in training_loader:
76 |
77 | batch_rays=data['batch_rays'].cuda()
78 | label=data['label'].cuda().squeeze(-1)
79 | target_s=data['target_s'].cuda()
80 | if args.using_depth:
81 | depth_s=1/data['depth_s'][...,0].cuda()
82 | near=data['near'].cuda()
83 | far=data['far'].cuda()
84 |
85 | rgb, disp, acc, extras = render(chunk=args.chunk, rays=batch_rays,near=near,far=far,label=label, retraw=True,
86 | **render_kwargs_train)
87 |
88 | optimizer.zero_grad()
89 | mask_img=torch.zeros_like(acc).to(device=acc.device)
90 | if args.white_bkgd:
91 | mask=(target_s.mean(-1)<0.9999)
92 | else:
93 | mask=(target_s.mean(-1)>1e-4)
94 | mask_img[mask]=1
95 |
96 | loss = img2mse(rgb,target_s)+img2mse(acc,mask_img)
97 | trans = extras['raw'][...,-1]
98 |
99 |
100 | triplane=render_kwargs_train['network_fn'].module.tri_planes[label]
101 |
102 | tvloss_y = torch.abs(triplane[:, :,:-1] - triplane[:, :, 1:]).mean()
103 | tvloss_x = torch.abs(triplane[:, :, :,:-1] - triplane[:, :, :, 1:]).mean()
104 | tvloss = tvloss_y + tvloss_x
105 | loss += tvloss * 1e-4
106 | l1_loss = (triplane ** 2).mean()
107 | loss += l1_loss * 5e-5
108 |
109 | psnr = mse2psnr(img2mse(rgb,target_s))
110 |
111 | if 'rgb0' in extras:
112 | img_loss0 = (img2mse(extras['rgb0'],target_s)+img2mse(extras['acc0'],mask_img))#img2mse(extras['rgb0'], target_s)
113 | loss = loss + img_loss0
114 |
115 | loss.backward()
116 | optimizer.step()
117 |
118 |
119 |
120 | # NOTE: IMPORTANT!
121 | ### update learning rate ###
122 | decay_rate = 0.1
123 | decay_steps = args.lrate_decay * 1000
124 | new_lrate = args.lrate * (decay_rate ** (global_step / decay_steps))
125 |
126 | threshold=0
127 | new_lrate2 = args.lrate * (decay_rate ** ((global_step+threshold) / decay_steps))
128 | for param_group in optimizer.param_groups:
129 | if len(param_group['params'][0])==args.num_instance and param_group['params'][0].shape[1]==args.triplanechannel:
130 | param_group['lr'] = new_lrate*10
131 |
132 | else:
133 | if global_step>=threshold:
134 | param_group['lr'] = new_lrate2
135 | else:
136 | param_group['lr'] =0
137 |
138 | dt = time.time()-time0
139 |
140 | if global_step%args.i_weights==0 and dist.get_rank() == 0:
141 | path = os.path.join(basedir, expname, '{:06d}.tar'.format(global_step))
142 | torch.save({
143 | 'global_step': global_step,
144 | 'network_fn_state_dict': render_kwargs_train['network_fn'].module.state_dict(),
145 | 'optimizer_state_dict': optimizer.state_dict(),
146 | }, path)
147 | print('Saved checkpoints at', path)
148 |
149 | if global_step%args.i_print==0:
150 | logger.info('Epoch:[{}/{}]\t loss={:f}\t psnr={:f}'.format(global_step , args.N_iters, float(loss.item()), float(psnr.item()) ))
151 | tqdm.write(f"[TRAIN] Iter: {global_step} Loss: {loss.item()} PSNR: {psnr.item()}")
152 |
153 | global_step += 1
154 |
155 |
156 |
157 | if __name__=='__main__':
158 | torch.multiprocessing.set_start_method('spawn')
159 |
160 | torch.set_default_tensor_type('torch.cuda.FloatTensor')
161 |
162 | train(args)
163 |
164 |
--------------------------------------------------------------------------------
/dataset/Omniobject3D/README.md:
--------------------------------------------------------------------------------
1 | ## OmniObject3D
2 | You can download the data from
3 |
4 | [this website]: https://opendatalab.com/OpenXDLab/OmniObject3D-New/tree/main/raw/blender_renders
5 |
6 | And unzip them like we provided in `./dataset/Omniobject3D/renders`
7 |
--------------------------------------------------------------------------------
/dataset/Omniobject3D/renders/apple/apple_001/render/depths/r_0_depth.exr:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ziangcao0312/DiffTF/296ba1bed593fd9b4aae242f453a2e8c1750cebe/dataset/Omniobject3D/renders/apple/apple_001/render/depths/r_0_depth.exr
--------------------------------------------------------------------------------
/dataset/Omniobject3D/renders/apple/apple_001/render/images/r_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ziangcao0312/DiffTF/296ba1bed593fd9b4aae242f453a2e8c1750cebe/dataset/Omniobject3D/renders/apple/apple_001/render/images/r_0.png
--------------------------------------------------------------------------------
/dataset/Omniobject3D/renders/apple/apple_001/render/normals/r_0_normal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ziangcao0312/DiffTF/296ba1bed593fd9b4aae242f453a2e8c1750cebe/dataset/Omniobject3D/renders/apple/apple_001/render/normals/r_0_normal.png
--------------------------------------------------------------------------------
/dataset/ShapeNet/README.md:
--------------------------------------------------------------------------------
1 | ## ShapeNet
2 | 1. Download the ShapeNet data from this
3 |
4 | [website]: https://shapenet.org/
5 |
6 | 2. Rendering the multi-view images using this
7 |
8 | [repo]: https://github.com/vsitzmann/shapenet_renderer/tree/master
9 |
10 | ```
11 | bash render.sh #rendering a serial of objects
12 | ```
13 |
14 | We give a simple example in this folder
15 |
16 | ```
17 | renders
18 | --ShapeNet_Car
19 | ----Car_1_name
20 | ------pose
21 | --------000000.txt
22 | --------000001.txt
23 | …………
24 | --------000194.txt # determined by the number of rendering images
25 | ------rgb
26 | --------000000.png
27 | --------000001.png
28 | …………
29 | --------000194.png # determined by the number of rendering images
30 | ------intrinsics.txt
31 | ----Car_2_name
32 | …………
33 | ----Car_n_name
34 | --ShapeNet_plane
35 | --ShapeNet_chair
36 | ```
37 |
38 |
--------------------------------------------------------------------------------
/dataset/ShapeNet/renders/car/1a0bc9ab92c915167ae33d942430658c/intrinsics.txt:
--------------------------------------------------------------------------------
1 | 525.000000 256.000000 256.000000 0.
2 | 0. 0. 0.
3 | 1.
4 | 512 512
5 |
--------------------------------------------------------------------------------
/dataset/ShapeNet/renders/car/1a0bc9ab92c915167ae33d942430658c/pose/000000.txt:
--------------------------------------------------------------------------------
1 | -0.8414713144302368 -0.5386366844177246 -0.04239124804735184 0.05086996778845787 3.72529200376448e-07 -0.07845887541770935 0.9969174861907959 -1.1963008642196655 -0.5403022766113281 0.838877260684967 0.06602128595113754 -0.07922526448965073 0.0 0.0 -0.0 1.0
2 |
--------------------------------------------------------------------------------
/dataset/ShapeNet/renders/car/1a0bc9ab92c915167ae33d942430658c/rgb/000000.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ziangcao0312/DiffTF/296ba1bed593fd9b4aae242f453a2e8c1750cebe/dataset/ShapeNet/renders/car/1a0bc9ab92c915167ae33d942430658c/rgb/000000.png
--------------------------------------------------------------------------------
/dataset/ShapeNet/shapenet_renderer/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2020 Vincent Sitzmann
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/dataset/ShapeNet/shapenet_renderer/README.md:
--------------------------------------------------------------------------------
1 | This is a compact implementation of a batched OBJ- and PLY-renderer in blender. The inspiration was drawn
2 | from the "Stanford Shapenet Renderer". This code can be used to render datasets such as the ones used in the
3 | "Scene Representation Networks" paper.
4 |
5 | It assumes blender < 2.8, as it uses the blender-internal renderer.
6 |
7 | To render a batch of ply files in parallel, use the "find" command in conjunction with xargs:
8 |
9 | find ~/Downloads/02691156/ -name *.ply -print0 | xargs -0 -n1 -P1 -I {} blender --background --python shapenet_spherical_renderer.py -- --output_dir /tmp --mesh_fpath {} --num_observations 50 --sphere_radius 1 --mode=train
--------------------------------------------------------------------------------
/dataset/ShapeNet/shapenet_renderer/render.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | set -x
3 |
4 | # input parameter
5 | obj_id=$1
6 | split=$2
7 |
8 | # rendering parameters
9 | dataset_path=./shapenet/ShapeNetCore.v2 #mesh path
10 | blender_path=./blender-2.79b-linux-glibc219-x86_64
11 | output_path=./shapenet/renders
12 | view=200
13 | radius=1.2
14 | mode=test
15 |
16 |
17 | find ${dataset_path}* -name *.obj -print0 | xargs -0 -n1 -P1 -I {} ${blender_path}/blender --background --python shapenet_spherical_renderer.py -- --output_dir ${output_path}/${obj_id}_view${view}_r${radius} --mesh_fpath {} --num_observations ${view} --sphere_radius ${radius} --mode=${mode}
18 |
19 |
--------------------------------------------------------------------------------
/dataset/ShapeNet/shapenet_renderer/shapenet_spherical_renderer.py:
--------------------------------------------------------------------------------
1 | import argparse
2 | import numpy as np
3 | import os
4 | import sys
5 | sys.path.append(os.path.dirname(__file__))
6 |
7 | import util
8 | import blender_interface
9 |
10 | p = argparse.ArgumentParser(description='Renders given obj file by rotation a camera around it.')
11 | p.add_argument('--mesh_fpath', type=str, required=True, help='The path the output will be dumped to.')
12 | p.add_argument('--output_dir', type=str, required=True, help='The path the output will be dumped to.')
13 | p.add_argument('--num_observations', type=int, required=True, help='The path the output will be dumped to.')
14 | p.add_argument('--sphere_radius', type=float, required=True, help='The path the output will be dumped to.')
15 | p.add_argument('--mode', type=str, required=True, help='Options: train and test')
16 |
17 | argv = sys.argv
18 | argv = sys.argv[sys.argv.index("--") + 1:]
19 |
20 | opt = p.parse_args(argv)
21 |
22 | instance_name = opt.mesh_fpath.split('/')[-3]
23 | instance_dir = os.path.join(opt.output_dir, instance_name)
24 |
25 | renderer = blender_interface.BlenderInterface(resolution=512)
26 |
27 | if opt.mode == 'train':
28 | cam_locations = util.sample_spherical(opt.num_observations, opt.sphere_radius)
29 | elif opt.mode == 'test':
30 | cam_locations = util.get_archimedean_spiral(opt.sphere_radius, opt.num_observations)
31 |
32 | obj_location = np.zeros((1,3))
33 |
34 | cv_poses = util.look_at(cam_locations, obj_location)
35 | blender_poses = [util.cv_cam2world_to_bcam2world(m) for m in cv_poses]
36 |
37 | shapenet_rotation_mat = np.array([[1.0000000e+00, 0.0000000e+00, 0.0000000e+00],
38 | [0.0000000e+00, -1.0000000e+00, -1.2246468e-16],
39 | [0.0000000e+00, 1.2246468e-16, -1.0000000e+00]])
40 | rot_mat = np.eye(3)
41 | hom_coords = np.array([[0., 0., 0., 1.]]).reshape(1, 4)
42 | obj_pose = np.concatenate((rot_mat, obj_location.reshape(3,1)), axis=-1)
43 | obj_pose = np.concatenate((obj_pose, hom_coords), axis=0)
44 |
45 | renderer.import_mesh(opt.mesh_fpath, scale=1., object_world_matrix=obj_pose)
46 | renderer.render(instance_dir, blender_poses, write_cam_params=True)
47 |
48 | # find /data/shapenet/test_folder/obj/ -name *.obj -print0 | xargs -0 -n1 -P1 -I {} /data/blender-2.79b-linux-glibc219-x86_64/blender --background --python shapenet_spherical_renderer.py -- --output_dir /data/shapenet/test_folder/render --mesh_fpath {} --num_observations 10 --sphere_radius 2 --mode=train
49 |
--------------------------------------------------------------------------------
/img/img11.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ziangcao0312/DiffTF/296ba1bed593fd9b4aae242f453a2e8c1750cebe/img/img11.png
--------------------------------------------------------------------------------
/install_difftf.sh:
--------------------------------------------------------------------------------
1 | conda create -n difftf python=3.10
2 | conda activate difftf
3 |
4 | pip install conda install pytorch==2.1.0 torchvision==0.16.0 torchaudio==2.1.0 pytorch-cuda=11.8 -c pytorch -c nvidia
5 | conda install mpi4py
6 | pip install opencv-python imageio tqdm blobfile==2.0.2 einops scikit-image logging configargparse ipdb matplotlib kaolin h5py
7 | pip install meshio
8 | pip install plyfile
9 |
10 | cd ./3dDiffusion
11 | python setup.py install
12 | cd ..
13 |
--------------------------------------------------------------------------------