Exemplo n.º 1
0
def augment_fn(batch_input, batch_label, batch_inner):
    bsize, num_point, _ = batch_input.shape

    # shuffle the orders of samples in a batch
    idx = np.arange(bsize)
    np.random.shuffle(idx)
    batch_input = batch_input[idx, :, :]
    batch_label = batch_label[idx, :]
    batch_inner = batch_inner[idx, :]

    # shuffle the point orders of each sample
    idx = np.arange(num_point)
    np.random.shuffle(idx)
    batch_input = batch_input[:, idx, :]
    batch_label = batch_label[:, idx]
    batch_inner = batch_inner[:, idx]

    # perform augmentation on the first np.int32(augment_ratio*bsize) samples
    augSize = np.int32(1 / 3.0 * bsize)
    augment_xyz = batch_input[0:augSize, :, 0:3]
    augment_xyz = data_util.rotate_point_cloud(augment_xyz)
    augment_xyz = data_util.rotate_perturbation_point_cloud(augment_xyz)
    augment_xyz = data_util.random_scale_point_cloud(augment_xyz)
    augment_xyz = data_util.shift_point_cloud(augment_xyz)
    augment_xyz = data_util.jitter_point_cloud(augment_xyz)
    batch_input[0:augSize, :, 0:3] = augment_xyz

    augment_xyz = batch_input[augSize:2 * augSize, :, 0:3]
    augment_xyz = data_util.rotate_perturbation_point_cloud(augment_xyz)
    augment_xyz = data_util.random_scale_point_cloud(augment_xyz)
    augment_xyz = data_util.shift_point_cloud(augment_xyz)
    augment_xyz = data_util.jitter_point_cloud(augment_xyz)
    batch_input[augSize:2 * augSize, :, 0:3] = augment_xyz

    return batch_input, batch_label, batch_inner
Exemplo n.º 2
0
def augment_fn(batch_input, batch_feature, augment_ratio=0.5):
    bsize, num_point, _ = batch_input.shape

    # shuffle the orders of samples in a batch
    idx = np.arange(bsize)
    np.random.shuffle(idx)
    batch_input = batch_input[idx, :, :]
    # batch_rho = batch_rho[idx,:]
    # batch_engy = batch_engy[idx,:]
    batch_feature = batch_feature[idx]

    # shuffle the point orders of each sample
    idx = np.arange(num_point)
    np.random.shuffle(idx)
    batch_input = batch_input[:, idx, :]
    # batch_rho = batch_rho[:,idx]
    # batch_engy = batch_engy[:,idx]
    # batch_xyz = data_util.shuffle_points(batch_xyz)

    # perform augmentation on the first np.int32(augment_ratio*bsize) samples
    augSize = np.int32(augment_ratio * bsize)
    augment_xyz = batch_input[0:augSize, :, 0:3]

    augment_xyz = data_util.rotate_point_cloud(augment_xyz)
    augment_xyz = data_util.rotate_perturbation_point_cloud(augment_xyz)
    augment_xyz = data_util.random_scale_point_cloud(augment_xyz)
    augment_xyz = data_util.shift_point_cloud(augment_xyz)

    batch_input[0:augSize, :, 0:3] = augment_xyz

    return batch_input, batch_feature
Exemplo n.º 3
0
def augment_fn(batch_xyz):
    # perform augmentation on the first np.int32(augment_ratio*bsize) samples
    augment_xyz = data_util.rotate_point_cloud(batch_xyz)
    augment_xyz = data_util.rotate_perturbation_point_cloud(augment_xyz)
    augment_xyz = data_util.random_scale_point_cloud(augment_xyz)
    augment_xyz = data_util.shift_point_cloud(augment_xyz)

    return augment_xyz
def augment_fn(batch_input):
    augment_xyz = batch_input[:, :, 0:3]
    augment_xyz = data_util.rotate_perturbation_point_cloud(augment_xyz)
    augment_xyz = data_util.random_scale_point_cloud(augment_xyz)
    augment_xyz = data_util.shift_point_cloud(augment_xyz)
    augment_xyz = data_util.jitter_point_cloud(augment_xyz)
    batch_input[:, :, 0:3] = augment_xyz

    return batch_input
def augment_fn2(batch_xyz):
    augment_xyz = batch_xyz
    augment_xyz = data_util.rotate_perturbation_point_cloud(augment_xyz)
    augment_xyz = data_util.random_scale_point_cloud(augment_xyz)
    augment_xyz = data_util.shift_point_cloud(augment_xyz)
    augment_xyz = data_util.jitter_point_cloud(augment_xyz)
    batch_xyz = augment_xyz

    return batch_xyz
def augment_fn1(batch_input):
    # perform augmentation on the first np.int32(augment_ratio*bsize) samples
    augment_xyz = batch_input[:, :, 0:3]
    augment_xyz = data_util.rotate_perturbation_point_cloud(augment_xyz)
    augment_xyz = data_util.random_scale_point_cloud(augment_xyz)
    augment_xyz = data_util.shift_point_cloud(augment_xyz)
    augment_xyz = data_util.jitter_point_cloud(augment_xyz)
    batch_input[:, :, 0:3] = augment_xyz

    return batch_input
def augment_fn(batch_input, batch_label):
    if INPUT_DIM == 6:
        augment_xyz = batch_input[:, :, 0:3]
        augment_xyz = data_util.rotate_point_cloud(augment_xyz)
        augment_xyz = data_util.rotate_perturbation_point_cloud(augment_xyz)
        batch_input[:, :, 0:3] = augment_xyz
    elif INPUT_DIM == 9:
        augment_xyz = batch_input[:, :, 0:6]
        augment_xyz = data_util.rotate_point_cloud_with_normal(augment_xyz)
        augment_xyz = data_util.rotate_perturbation_point_cloud_with_normal(
            augment_xyz)
        batch_input[:, :, 0:6] = augment_xyz

    return batch_input, batch_label
Exemplo n.º 8
0
def augment_fn(batch_input, batch_label):
    bsize, num_point, _ = batch_input.shape

    # shuffle the orders of samples in a batch
    idx = np.arange(bsize)
    np.random.shuffle(idx)
    batch_input = batch_input[idx,:,:]
    batch_label = batch_label[idx,:]

    # shuffle the point orders of each sample
    idx = np.arange(num_point)
    np.random.shuffle(idx)
    batch_input = batch_input[:,idx,:]
    batch_label = batch_label[:,idx]

    # perform augmentation on the first np.int32(augment_ratio*bsize) samples
    augSize = np.int32(1/3.0 * bsize)
    if INPUT_DIM==6:
        augment_xyz = batch_input[0:augSize, :, 0:3]
        augment_xyz = data_util.rotate_point_cloud(augment_xyz)
        augment_xyz = data_util.rotate_perturbation_point_cloud(augment_xyz)
    elif INPUT_DIM==9:
        augment_xyz = batch_input[0:augSize, :, 0:6]
        augment_xyz = data_util.rotate_point_cloud_with_normal(augment_xyz)
        augment_xyz = data_util.rotate_perturbation_point_cloud_with_normal(augment_xyz)
    augment_xyz[:,:,0:3] = data_util.random_scale_point_cloud(augment_xyz[:,:,0:3])
    augment_xyz[:,:,0:3] = data_util.shift_point_cloud(augment_xyz[:,:,0:3])
    augment_xyz[:,:,0:3] = data_util.jitter_point_cloud(augment_xyz[:,:,0:3])
    if INPUT_DIM==6:
        batch_input[0:augSize, :, 0:3] = augment_xyz
    elif INPUT_DIM==9:
        batch_input[0:augSize, :, 0:6] = augment_xyz

    # one third of data without rotation augmentation
    augment_xyz = batch_input[augSize:2*augSize,:,0:3]
    augment_xyz = data_util.random_scale_point_cloud(augment_xyz)
    augment_xyz = data_util.shift_point_cloud(augment_xyz)
    augment_xyz = data_util.jitter_point_cloud(augment_xyz)
    batch_input[augSize:2*augSize,:,0:3] = augment_xyz

    return batch_input, batch_label
Exemplo n.º 9
0
def augment_fn(batch_xyz, batch_label, augment_ratio=0.5):
    bsize, num_point, _ = batch_xyz.shape

    # shuffle the orders of samples in a batch
    idx = np.arange(bsize)
    np.random.shuffle(idx)
    batch_xyz = batch_xyz[idx, :, :]
    batch_label = batch_label[idx]

    # shuffle the point orders of each sample
    batch_xyz = data_util.shuffle_points(batch_xyz)

    # perform augmentation on the first np.int32(augment_ratio*bsize) samples
    augSize = np.int32(augment_ratio * bsize)
    augment_xyz = batch_xyz[0:augSize, :, :]

    augment_xyz = data_util.rotate_point_cloud(augment_xyz)
    augment_xyz = data_util.rotate_perturbation_point_cloud(augment_xyz)
    augment_xyz = data_util.random_scale_point_cloud(augment_xyz)
    augment_xyz = data_util.shift_point_cloud(augment_xyz)

    batch_xyz[0:augSize, :, :] = augment_xyz

    return batch_xyz, batch_label