Commit 6294701e authored by Nianchen Deng's avatar Nianchen Deng
Browse files

sync

parent 2824f796
def update_config(config):
# Net parameters
config.net = 'nnerf4'
config.n_pos_encode = 10
config.encode_x = 10
config.fc.update({
'nf': 128,
'n_layers': 4
......
def update_config(config):
# Net parameters
config.net = 'oracle'
config.n_pos_encode = 0
config.encode_x = 0
config.fc.update({
'nf': 256,
'n_layers': 8,
'activation': 'selu',
'act': 'selu',
})
config.sa.update({
'sample_range': (0.4, 6),
......
def update_config(config):
# Net parameters
config.net = 'snerffast2'
config.n_pos_encode = 6
#config.n_dir_encode = 4
config.encode_x = 6
#config.encode_d = 4
config.fc.update({
'nf': 256,
'n_layers': 4
......
def update_config(config):
# Net parameters
config.net = 'snerffast4'
config.n_pos_encode = 6
#config.n_dir_encode = 4
config.encode_x = 6
#config.encode_d = 4
config.fc.update({
'nf': 256,
'n_layers': 4
......
def update_config(config):
# Net parameters
config.net = 'snerffast4'
config.n_pos_encode = 6
#config.n_dir_encode = 4
config.encode_x = 6
#config.encode_d = 4
config.fc.update({
'nf': 128,
'n_layers': 4
......
def update_config(config):
# Net parameters
config.net = 'snerffastx4'
config.n_pos_encode = 6
#config.n_dir_encode = 4
config.encode_x = 6
#config.encode_d = 4
config.fc.update({
'nf': 512,
'n_layers': 8
......
def update_config(config):
# Net parameters
config.net = 'snerffastnew'
config.n_pos_encode = 6
#config.n_dir_encode = 4
config.encode_x = 6
#config.encode_d = 4
config.fc.update({
'nf': 256,
'n_layers': 8
......
import os
import importlib
import re
from utils.constants import *
from utils import color
from nets.snerf_fast import SnerfFast
from nets.snerf import Snerf
......@@ -17,14 +16,14 @@ class SphericalViewSynConfig(object):
self.name = 'default'
self.c = color.RGB
self.net = 'nerf'
self.n_pos_encode = 10
self.n_dir_encode = None
self.encode_x = 10
self.encode_d = None
self.depth_ref = False
self.fc = {
'nf': 256,
'n_layers': 8,
'skips': [],
'activation': 'relu'
'act': 'relu'
}
self.sa = {
'sample_range': (1, 50),
......@@ -57,14 +56,14 @@ class SphericalViewSynConfig(object):
id = f"{self.name}@{self.net}"
if self.c != color.RGB:
id += f"-{color.to_str(self.c)}"
id += f"_e{self.n_pos_encode}"
if self.n_dir_encode is not None:
id += f"_ed{self.n_dir_encode}"
id += f"_e{self.encode_x}"
if self.encode_d is not None:
id += f"_ed{self.encode_d}"
id += f"_fc{self.fc['nf']}x{self.fc['n_layers']}"
if len(self.fc['skips']) > 0:
id += "_^%s" % ','.join([f'{val}' for val in self.fc['skips']])
if self.fc['activation'] != 'relu':
id += f"_*{self.fc['activation']}"
if self.fc['act'] != 'relu':
id += f"_*{self.fc['act']}"
id += "_d{0:.2f}-{1:.2f}".format(*self.sa['sample_range'])
id += f"_s{self.sa['n_samples']}"
if self.nerf_coarse is not None:
......@@ -107,15 +106,15 @@ class SphericalViewSynConfig(object):
self.fc['skips'] = [int(str) for str in seg[4:].split(',')]
continue
if seg.startswith('*'): # Activation
self.fc['activation'] = seg[1:]
self.fc['act'] = seg[1:]
continue
if seg.startswith('ed'): # Encode direction
self.n_dir_encode = int(seg[2:])
if self.n_dir_encode == 0:
self.n_dir_encode = None
self.encode_d = int(seg[2:])
if self.encode_d == 0:
self.encode_d = None
continue
if seg.startswith('e'): # Encode
self.n_pos_encode = int(seg[1:])
self.encode_x = int(seg[1:])
continue
if seg.startswith('d'): # Depth range
try:
......@@ -158,10 +157,10 @@ class SphericalViewSynConfig(object):
def print(self):
print('==== Config %s ====' % self.name)
print('Net type: ', self.net)
print('Encode dim: ', self.n_pos_encode)
print('Encode dim: ', self.encode_x)
print('Train with depth: ', self.depth_ref)
print('Support direction: ', False if self.n_dir_encode is None
else f'encode to {self.n_dir_encode}')
print('Support direction: ', False if self.encode_d is None
else f'encode to {self.encode_d}')
print('Full-connected network parameters:', self.fc)
print('Sample parameters', self.sa)
if self.nerf_coarse:
......@@ -183,51 +182,51 @@ class SphericalViewSynConfig(object):
})
coarse_net = Nerf(coarse_fc, coarse_sa,
c=self.c,
pos_encode=self.n_pos_encode,
dir_encode=self.n_dir_encode)
pos_encode=self.encode_x,
dir_encode=self.encode_d)
else:
coarse_net = None
return Nerf(fc_params=self.fc,
return Nerf(core_params=self.fc,
sampler_params=self.sa,
fine_params=self.nerf_coarse,
c=self.c,
pos_encode=self.n_pos_encode,
dir_encode=self.n_dir_encode,
pos_encode=self.encode_x,
dir_encode=self.encode_d,
coarse_net=coarse_net)
if net == 'bgnet':
return BgNet(fc_params=self.fc,
encode=self.n_pos_encode,
return BgNet(core_params=self.fc,
encode=self.encode_x,
c=self.c)
if net.startswith('oracle'):
return Oracle(fc_params=self.fc,
return Oracle(core_params=self.fc,
sampler_params=self.sa,
pos_encode=self.n_pos_encode,
pos_encode=self.encode_x,
out_activation=self.net[6:] if len(self.net) > 6 else 'sigmoid')
if net == 'dnerfa':
return NerfDepth(fc_params=self.fc,
return NerfDepth(core_params=self.fc,
sampler_params=self.sa,
c=self.c,
pos_encode=self.n_pos_encode,
pos_encode=self.encode_x,
n_bins=multiple or 128,
include_neighbor_bins=False)
if net == 'dnerf':
return NerfDepth(fc_params=self.fc,
return NerfDepth(core_params=self.fc,
sampler_params=self.sa,
c=self.c,
pos_encode=self.n_pos_encode,
pos_encode=self.encode_x,
n_bins=multiple or 128)
if net == 'snerf':
return Snerf(fc_params=self.fc,
return Snerf(core_params=self.fc,
sampler_params=self.sa,
n_parts=multiple or 1,
c=self.c,
pos_encode=self.n_pos_encode,
dir_encode=self.n_dir_encode)
pos_encode=self.encode_x,
dir_encode=self.encode_d)
if net == 'snerffast':
return SnerfFast(fc_params=self.fc,
return SnerfFast(core_params=self.fc,
sampler_params=self.sa,
n_parts=multiple or 1,
c=self.c,
pos_encode=self.n_pos_encode,
dir_encode=self.n_dir_encode)
pos_encode=self.encode_x,
dir_encode=self.encode_d)
raise ValueError(f'Invalid net type: {net} - {multiple}')
{
"model": "MNeRF",
"args": {
"spherical": true,
"color": "rgb",
"encode_x": 10,
"encode_d": 4,
"core_params": [
{
"nf": 256,
"n_layers": 2
},
{
"nf": 256,
"n_layers": 2
},
{
"nf": 256,
"n_layers": 4
}
],
"n_featdim": 0,
"space": "voxels",
"steps": [ 4, 16, 8 ],
"n_samples": 32
},
"train": {
"prune_epochs": [3],
"split_epochs": [6, 12, 24],
"frozen_epochs": [12, 24],
"checkpoint_interval": 3,
"density_regularization_weight": 1e-4,
"density_regularization_scale": 1e4
}
}
\ No newline at end of file
{
"model": "MNeRFAdvance",
"args": {
"spherical": true,
"color": "rgb",
"encode_x": 10,
"encode_d": 4,
"core_params": [
{
"nf": 256,
"n_layers": 2
},
{
"nf": 256,
"n_layers": 2
},
{
"nf": 256,
"n_layers": 4
}
],
"n_featdim": 0,
"space": "voxels",
"steps": [ 4, 16, 8 ],
"n_samples_list": [ 16, 32, 64 ]
},
"train": {
"max_epochs": 30,
"prune_epochs": [3],
"split_epochs": [6, 18],
"checkpoint_interval": 3,
"density_regularization_weight": 1e-4,
"density_regularization_scale": 1e4
}
}
\ No newline at end of file
{
"model": "SNeRF",
"model": "NeRF",
"args": {
"spherical": true,
"color": "rgb",
"n_pot_encode": 10,
"n_dir_encode": 4,
"fc_params": {
"nf": 256,
"encode_x": 10,
"encode_d": 4,
"core_params": {
"nf": 128,
"n_layers": 8,
"activation": "relu",
"skips": [ 4 ]
},
"n_featdim": 0,
"space": "voxels",
"steps": [4, 16, 8],
"n_samples": 16,
"perturb_sample": true,
"multi_nets": 4
},
"train": {
"max_epochs": 50,
"prune_epochs": [5],
"split_epochs": [10],
"density_regularization_weight": 1e-4,
"density_regularization_scale": 1e4
}
......
{
"model": "SNeRF",
"args": {
"color": "rgb",
"n_pot_encode": 10,
"n_dir_encode": 4,
"fc_params": {
"nf": 256,
"n_layers": 8,
"activation": "relu",
"skips": [ 4 ]
},
"n_featdim": 0,
"space": "voxels",
"steps": [8, 32, 16],
"n_samples": 16,
"perturb_sample": true,
"raymarching_tolerance": 0,
"raymarching_chunk_size": -1
}
}
\ No newline at end of file
{
"model": "SNeRF",
"model": "NeRF",
"args": {
"spherical": true,
"color": "rgb",
"n_pot_encode": 10,
"n_dir_encode": 4,
"fc_params": {
"encode_x": 10,
"encode_d": 4,
"core_params": {
"nf": 256,
"n_layers": 8,
"activation": "relu",
"skips": [ 4 ]
},
"n_featdim": 0,
"space": "voxels",
"steps": [4, 16, 8],
"n_samples": 16,
"perturb_sample": true
"n_samples": 16
},
"train": {
"max_epochs": 50,
"prune_epochs": [5],
"split_epochs": [10],
"density_regularization_weight": 1e-4,
"density_regularization_scale": 1e4
}
}
\ No newline at end of file
{
"model": "SNeRF",
"args": {
"color": "rgb",
"n_pot_encode": 10,
"n_dir_encode": 4,
"fc_params": {
"nf": 128,
"n_layers": 8,
"activation": "relu",
"skips": [ 4 ]
},
"n_featdim": 0,
"space": "voxels",
"steps": [4, 16, 8],
"n_samples": 16,
"perturb_sample": true,
"raymarching_tolerance": 0,
"raymarching_chunk_size": -1,
"multi_nets": 2
}
}
\ No newline at end of file
{
"model": "SNeRF",
"args": {
"color": "rgb",
"n_pot_encode": 10,
"n_dir_encode": 4,
"fc_params": {
"nf": 128,
"n_layers": 8,
"activation": "relu",
"skips": [ 4 ]
},
"n_featdim": 0,
"space": "voxels",
"steps": [4, 16, 8],
"n_samples": 16,
"perturb_sample": true,
"raymarching_tolerance": 0,
"raymarching_chunk_size": -1,
"multi_nets": 4
}
}
\ No newline at end of file
{
"model": "SNeRF",
"args": {
"color": "rgb",
"n_pot_encode": 10,
"n_dir_encode": 4,
"fc_params": {
"nf": 256,
"n_layers": 8,
"activation": "relu",
"skips": [ 4 ]
},
"n_featdim": 32,
"space": "voxels",
"steps": [4, 16, 8],
"n_samples": 16,
"perturb_sample": true,
"raymarching_tolerance": 0,
"raymarching_chunk_size": -1
}
}
\ No newline at end of file
{
"model": "SNeRFAdvance",
"args": {
"color": "rgb",
"n_pot_encode": 10,
"n_dir_encode": 4,
"density_net": {
"nf": 256,
"n_layers": 2,
"act": "relu",
"skips": []
},
"color_net": {
"nf": 256,
"n_layers": 3,
"act": "relu",
"skips": []
},
"specular_net": {
"nf": 128,
"n_layers": 1,
"act": "relu"
},
"n_featdim": 0,
"space": "voxels",
"steps": [16, 64, 32],
"n_samples": 64,
"perturb_sample": true,
"raymarching_tolerance": 0,
"raymarching_chunk_size": -1,
"density_regularization_weight": 1e-4,
"density_regularization_scale": 1e4
}
}
\ No newline at end of file
{
"model": "SNeRFAdvance",
"args": {
"color": "rgb",
"n_pot_encode": 10,
"n_dir_encode": 4,
"density_net": {
"nf": 256,
"n_layers": 4,
"act": "relu",
"skips": []
},
"color_net": {
"nf": 256,
"n_layers": 3,
"act": "relu",
"skips": []
},
"specular_net": {
"nf": 128,
"n_layers": 1,
"act": "relu"
},
"n_featdim": 0,
"space": "voxels",
"steps": [4, 16, 8],
"n_samples": 16,
"perturb_sample": true,
"appearance": "newtype",
"density_color_connection": true,
"density_regularization_weight": 1e-4,
"density_regularization_scale": 1e4,
"specular_regularization_weight": 1e-1,
"specular_regularization_scale": 1e4
}
}
\ No newline at end of file
{
"model": "SNeRFAdvance",
"args": {
"color": "rgb",
"n_pot_encode": 10,
"n_dir_encode": 4,
"density_net": {
"nf": 512,
"n_layers": 4,
"act": "relu",
"skips": []
},
"color_net": {
"nf": 512,
"n_layers": 3,
"act": "relu",
"skips": []
},
"specular_net": {
"nf": 256,
"n_layers": 1,
"act": "relu"
},
"n_featdim": 0,
"space": "voxels",
"steps": [4, 16, 8],
"n_samples": 16,
"perturb_sample": true,
"appearance": "combined",
"density_color_connection": true,
"density_regularization_weight": 1e-4,
"density_regularization_scale": 1e4
}
}
\ No newline at end of file
{
"model": "NeRF",
"args": {
"spherical": true,
"color": "rgb",
"encode_x": 10,
"encode_d": 4,
"core": "nerfadv",
"core_params": {
"density_net": {
"nf": 256,
"n_layers": 4
},
"color_net": {
"nf": 256,
"n_layers": 3
},
"specular_net": {
"nf": 128,
"n_layers": 1
},
"appearance": "combined"
},
"n_featdim": 0,
"space": "voxels",
"steps": [4, 16, 8],
"n_samples": 16
},
"train": {
"max_epochs": 50,
"prune_epochs": [5],
"split_epochs": [10],
"density_regularization_weight": 1e-4,
"density_regularization_scale": 1e4
}
}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment