Пример #1
0
 def near_surface_samples(self):
   """The xyz-sdf samples that are biased to be near the GT surface."""
   if self._near_surface_samples is None:
     if self.is_from_directory:
       nss_sample_path = f'{self._directory_root}/nss_points.sdf'
       nss = gaps_util.read_pts_file(nss_sample_path)
       # log.info(f'The points have shape {nss.shape}')
     else:
       nss = self._archive['axis_samples']
     self._near_surface_samples = np.reshape(nss,
                                             [100000, 4]).astype(np.float32)
   return self._near_surface_samples
Пример #2
0
 def uniform_samples(self):
   """1000 XYZ-sign samples generated uniformly in the volume."""
   if self._uniform_samples is None:
     if self.is_from_directory:
       uniform_sample_path = f'{self._directory_root}/uniform_points.sdf'
       uniform_samples = gaps_util.read_pts_file(uniform_sample_path)
       # log.info(f'The uniform points have shape {uniform_samples.shape}')
     else:
       uniform_samples = self._archive['uniform_samples']
     self._uniform_samples = np.reshape(uniform_samples,
                                        [100000, 4]).astype(np.float32)
   return self._uniform_samples
Пример #3
0
 def precomputed_surface_samples_from_dodeca(self):
   if not hasattr(self, '_precomputed_surface_samples_from_dodeca'):
     if not self.is_from_directory:
       raise ValueError('Precomputed surface samples are only'
                        ' available with a from_directory example.')
     if not os.path.isfile(self.precomputed_surface_samples_from_dodeca_path):
       raise ValueError('Dodeca surface samples have not been precomputed at '
                        f'{self.precomputed_surface_samples_from_dodeca_path}')
     full_samples = gaps_util.read_pts_file(
         self.precomputed_surface_samples_from_dodeca_path)
     orig_count = 100000
     assert full_samples.shape[0] == orig_count
     assert full_samples.shape[1] == 6
     assert full_samples.dtype == np.float32
     assert full_samples.shape[0] > 1
     while full_samples.shape[0] < self.surface_sample_count:
       log.verbose(f'Doubling samples from {full_samples.shape[0]} to'
                   f' {2*full_samples.shape[0]}')
       full_samples = np.tile(full_samples, [2, 1])
     self._precomputed_surface_samples_from_dodeca = (
         full_samples[np.random.choice(orig_count, self.surface_sample_count, replace=False), :])
   return self._precomputed_surface_samples_from_dodeca