snerf.py 1011 Bytes
Newer Older
Nianchen Deng's avatar
sync    
Nianchen Deng committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import math
from .nerf import *


class SNeRF(NeRF):
    SamplerClass = SphericalSampler

    def __init__(self, args0: dict, args1: dict = {}):
        """
        Initialize a multi-sphere-layer net

        :param fc_params: parameters for full-connection network
        :param sampler_params: parameters for sampler
        :param normalize_coord: whether normalize the spherical coords to [0, 2pi] before encode
        :param c: color mode
        :param encode_to_dim: encode input to number of dimensions
        """
        sample_range = [1 / args0['depth_range'][0], 1 / args0['depth_range'][1]] \
            if args0.get('depth_range') else [1, 0]
        rot_range = [[-180, -90], [180, 90]]
        args1['bbox'] = [
            [sample_range[0], math.radians(rot_range[0][0]), math.radians(rot_range[0][1])],
            [sample_range[1], math.radians(rot_range[1][0]), math.radians(rot_range[1][1])]
        ]
        args1['sample_range'] = sample_range
        super().__init__(args0, args1)