Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Solves issue #3 #10

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
pixel-nerf/checkpoints
*.pyc
533 changes: 533 additions & 0 deletions pixel-nerf/.ipynb_checkpoints/pose_estimation-checkpoint.ipynb

Large diffs are not rendered by default.

105 changes: 104 additions & 1 deletion pixel-nerf/conf/exp/srn.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,108 @@
# SRN experiments config
include required("../default_mv.conf")
# Single-view only base model
# (Not used in experiments; resnet_fine_mv.conf inherits)
model {
# MLP architecture
# Adapted for multiview
# Possibly too big

# Condition on local encoder
use_encoder = True

# Condition also on a global encoder?
use_global_encoder = False

# Use xyz input instead of just z
# (didn't ablate)
use_xyz = True

# Canonical space xyz (default view space)
canon_xyz = False

# Positional encoding
use_code = True
code {
num_freqs = 6
freq_factor = 1.5
include_input = True
}

# View directions
use_viewdirs = True
# Apply pos. enc. to viewdirs?
use_code_viewdirs = False

# MLP architecture
mlp_coarse {
type = resnet # Can change to mlp
n_blocks = 3
d_hidden = 512
# Combine after 3rd layer by average
combine_layer = 3
combine_type = average
}
mlp_fine {
type = resnet
n_blocks = 3
d_hidden = 512
combine_layer = 3
combine_type = average
}

# Encoder architecture
encoder {
backbone = resnet34
pretrained = True
num_layers = 4
}
}
renderer {
n_coarse = 64
n_fine = 32
# Try using expected depth sample
n_fine_depth = 16
# Noise to add to depth sample
depth_std = 0.01
# Decay schedule, not used
sched = []
# White background color (false : black)
white_bkgd = True
}
loss {
# RGB losses coarse/fine
rgb {
use_l1 = False
}
rgb_fine {
use_l1 = False
}
# Alpha regularization (disabled in final version)
alpha {
# lambda_alpha = 0.0001
lambda_alpha = 0.0
clamp_alpha = 100
init_epoch = 5
}
# Coarse/fine weighting (nerf = equal)
lambda_coarse = 1.0 # loss = lambda_coarse * loss_coarse + loss_fine
lambda_fine = 1.0 # loss = lambda_coarse * loss_coarse + loss_fine
}
train {
# Training
print_interval = 2
save_interval = 50
vis_interval = 100
eval_interval = 50

# Accumulating gradients. Not really recommended.
# 1 = disable
accu_grad = 1

# Number of times to repeat dataset per 'epoch'
# Useful if dataset is extremely small, like DTU
num_epoch_repeats = 1
}

data {
format = srn
}
7 changes: 4 additions & 3 deletions pixel-nerf/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ dependencies:
- python>=3.8
- pip
- pip:
- pyhocon
- pyhocon==0.3.6
- pyparsing==2.3.1
- opencv-python
- dotmap
- tensorboard
Expand All @@ -19,7 +20,7 @@ dependencies:
- scipy
- numpy
- matplotlib
- pytorch==1.6.0
- torchvision==0.7.0
- pytorch==1.8.0
- torchvision==0.9.0
- scikit-image==0.17.2
- tqdm
102 changes: 21 additions & 81 deletions pixel-nerf/pose_estimation.ipynb

Large diffs are not rendered by default.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion pixel-nerf/src/model/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ def forward(self, xyz, coarse=True, viewdirs=None, far=False):
output = output.reshape(SB, B, -1)
return output

def load_weights(self, args, opt_init=False, strict=True, device=None):
def load_weights(self, args, opt_init=False, strict=False, device=None):
"""
Helper for loading weights according to argparse arguments.
Your can put a checkpoint at checkpoints/<exp>/pixel_nerf_init to use as initialization.
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.