(encoding, input_dim=3,
multires=6,
degree=4,
num_levels=16, level_dim=2, base_resolution=16, log2_hashmap_size=19, desired_resolution=2048, align_corners=False,
**kwargs)
| 4 | |
| 5 | |
| 6 | def get_encoder(encoding, input_dim=3, |
| 7 | multires=6, |
| 8 | degree=4, |
| 9 | num_levels=16, level_dim=2, base_resolution=16, log2_hashmap_size=19, desired_resolution=2048, align_corners=False, |
| 10 | **kwargs): |
| 11 | |
| 12 | if encoding == 'None': |
| 13 | return lambda x, **kwargs: x, input_dim |
| 14 | |
| 15 | elif encoding == 'frequency': |
| 16 | from freqencoder import FreqEncoder |
| 17 | encoder = FreqEncoder(input_dim=input_dim, degree=multires) |
| 18 | |
| 19 | elif encoding == 'spherical_harmonics': |
| 20 | from shencoder import SHEncoder |
| 21 | encoder = SHEncoder(input_dim=input_dim, degree=degree) |
| 22 | |
| 23 | elif encoding == 'hashgrid': |
| 24 | from gridencoder import GridEncoder |
| 25 | encoder = GridEncoder(input_dim=input_dim, num_levels=num_levels, level_dim=level_dim, base_resolution=base_resolution, log2_hashmap_size=log2_hashmap_size, desired_resolution=desired_resolution, gridtype='hash', align_corners=align_corners) |
| 26 | |
| 27 | elif encoding == 'tiledgrid': |
| 28 | from gridencoder import GridEncoder |
| 29 | encoder = GridEncoder(input_dim=input_dim, num_levels=num_levels, level_dim=level_dim, base_resolution=base_resolution, log2_hashmap_size=log2_hashmap_size, desired_resolution=desired_resolution, gridtype='tiled', align_corners=align_corners) |
| 30 | |
| 31 | elif encoding == 'ash': |
| 32 | from ashencoder import AshEncoder |
| 33 | encoder = AshEncoder(input_dim=input_dim, output_dim=16, log2_hashmap_size=log2_hashmap_size, resolution=desired_resolution) |
| 34 | |
| 35 | else: |
| 36 | raise NotImplementedError('Unknown encoding mode, choose from [None, frequency, spherical_harmonics, hashgrid, tiledgrid]') |
| 37 | |
| 38 | return encoder, encoder.output_dim |
no test coverage detected