Example #1
0
    def __getitem__(self, item):
        pointcloud = self.data[item].astype(np.float32)[:, :3]
        label = self.data[item].astype(np.long)[:, 3] - 1  # labels 1-8

        # apply data rotation and augmentation on train samples
        if self.partition == 'train':
            pointcloud = jitter_pointcloud(
                random_rotate_one_axis(pointcloud, "z"))

        return (pointcloud, label)
Example #2
0
    def __getitem__(self, item):
        pointcloud = np.load(self.pc_list[item])[:, :3].astype(np.float32)
        label = np.copy(self.label[item])
        pointcloud = scale_to_unit_cube(pointcloud)
        # sample according to farthest point sampling
        if pointcloud.shape[0] > NUM_POINTS:
            pointcloud = np.swapaxes(np.expand_dims(pointcloud, 0), 1, 2)
            _, pointcloud = farthest_point_sample_np(pointcloud, NUM_POINTS)
            pointcloud = np.swapaxes(pointcloud.squeeze(), 1,
                                     0).astype('float32')

        # apply data rotation and augmentation on train samples
        if self.partition == 'train' and item not in self.val_ind:
            pointcloud = jitter_pointcloud(
                random_rotate_one_axis(pointcloud, "z"))
        return (pointcloud, label)
Example #3
0
    def __getitem__(self, item):
        pointcloud = np.load(self.pc_list[item])[:, :3].astype(np.float32)
        label = np.copy(self.centroid[self.pc_list[item].split('/')[-1][:-4]])
        #label = np.copy(self.label[item])

        #label = np.load(add_pd_path(self.pc_list[item], pre="pd4")) #load from npy file
        #label = get_pd_vector(self.pc_list[item], self.rips)
        pointcloud = scale_to_unit_cube(pointcloud)
        # Rotate ShapeNet by -90 degrees
        pointcloud = self.rotate_pc(pointcloud, label)
        # sample according to farthest point sampling
        if pointcloud.shape[0] > NUM_POINTS:
            pointcloud = np.swapaxes(np.expand_dims(pointcloud, 0), 1, 2)
            _, pointcloud = farthest_point_sample_np(pointcloud, NUM_POINTS)
            pointcloud = np.swapaxes(pointcloud.squeeze(), 1,
                                     0).astype('float32')

        # apply data rotation and augmentation on train samples
        if self.partition == 'train' and item not in self.val_ind:
            pointcloud = jitter_pointcloud(
                random_rotate_one_axis(pointcloud, "z"))
        return (pointcloud, label)