示例#1
0
    def get_lazy_dataset(self):
        from shapenet.core.point_clouds import get_point_cloud_dataset
        from util3d.point_cloud import sample_points
        from template_ffd.model import get_builder
        from template_ffd.inference.predictions import get_predictions_dataset
        builder = get_builder(self._model_id)
        cat_id = builder.cat_id
        template_ids = builder.template_ids
        clouds = []

        def sample_fn(cloud):
            return sample_points(np.array(cloud), self._n_samples)

        gt_clouds = get_point_cloud_dataset(
            cat_id, builder.n_samples).map(sample_fn)
        with gt_clouds:
            for example_id in template_ids:
                clouds.append(np.array(gt_clouds[example_id]))

        predictions = get_predictions_dataset(self._model_id)
        inf_cloud_ds = predictions.map(lambda i: clouds[i].copy())
        return _get_lazy_emd_dataset(inf_cloud_ds, cat_id, self._n_samples)
示例#2
0
    def get_lazy_dataset(self):
        from shapenet.core.point_clouds import get_point_cloud_dataset
        from util3d.point_cloud import sample_points
        from template_ffd.model import get_builder
        from template_ffd.inference.predictions import get_predictions_dataset
        builder = get_builder(self._model_id)
        cat_id = builder.cat_id
        template_ids = builder.template_ids
        clouds = []

        def sample_fn(cloud):
            return sample_points(np.array(cloud), self._n_samples)

        gt_clouds = get_point_cloud_dataset(
            cat_id, builder.n_samples).map(sample_fn)
        with gt_clouds:
            for example_id in template_ids:
                clouds.append(np.array(gt_clouds[example_id]))

        predictions = get_predictions_dataset(self._model_id)
        inf_cloud_ds = predictions.map(lambda i: clouds[i].copy())
        return _get_lazy_emd_dataset(inf_cloud_ds, cat_id, self._n_samples)