charlesq34 / pointnet

PointNet: Deep Learning on Point Sets for 3D Classification and Segmentation
Other
4.71k stars 1.44k forks source link

batch_inference.py Bug #153

Open ldepn opened 5 years ago

ldepn commented 5 years ago

run batch_inference.py will have this error "unsupported operand type(s) for +: 'range' and 'list'"

I fix it follow this

def sample_data(data, num_sample):
    """ data is in N x ...
        we want to keep num_samplexC of them.
        if N > num_sample, we will randomly keep num_sample of them.
        if N < num_sample, we will randomly duplicate samples.
    """
    N = data.shape[0]
    if (N == num_sample):
        return data, range(N)
    elif (N > num_sample):
        sample = np.random.choice(N, num_sample)
        return data[sample, ...], sample
    else:
        sample = np.random.choice(N, num_sample-N)
        dup_data = data[sample, ...]
        return  np.concatenate([data, dup_data], 0), range(N)+list(sample)

return np.concatenate([data, dup_data], 0), range(N)+list(sample) -->return np.concatenate([data, dup_data], 0), list(range(N))+list(sample)