PointCNN icon indicating copy to clipboard operation
PointCNN copied to clipboard

Looks like a bug in the code

Open truebelief opened this issue 5 years ago • 1 comments

In the file: PointCNN/data_conversions/prepare_semantic3d_data.py Line 35:39

    data = np.zeros((batch_size, max_point_num, 7))
    data_num = np.zeros((batch_size), dtype=np.int32)
    label = np.zeros((batch_size), dtype=np.int32)
    label_seg = np.zeros((batch_size, max_point_num), dtype=np.int32)
    indices_split_to_full = np.zeros((batch_size, max_point_num), dtype=np.int32)

This initialization code should be placed after line 46:

   for folder in folders:
        datasets = [filename[:-4] for filename in os.listdir(folder) if filename.endswith('.txt')]

I.e.

   for folder in folders:
        datasets = [filename[:-4] for filename in os.listdir(folder) if filename.endswith('.txt')]
        data = np.zeros((batch_size, max_point_num, 7))
        data_num = np.zeros((batch_size), dtype=np.int32)
        label = np.zeros((batch_size), dtype=np.int32)
        label_seg = np.zeros((batch_size, max_point_num), dtype=np.int32)
        indices_split_to_full = np.zeros((batch_size, max_point_num), dtype=np.int32)

Those arrays (e.g. indices_split_to_full) would be filled by the previous dataset data. If not initialized with zero again, and the previous values will be passed on to the next iteration of dataset. If next dataset is smaller, the arrays would be mixed with the previous ones. Please double check if this is a bug.

truebelief avatar Sep 26 '19 07:09 truebelief

hi @truebelief Thanks for your report. We will save following information when we generate h5 files .https://github.com/yangyanli/PointCNN/blob/7d0af994718dd49c66faf21c03c964613e8bdc6f/data_conversions/prepare_semantic3d_data.py#L188 when training network, it will load [0:data_num] data. For example, if max_point_num=2048 in line 32 ,however there are only 500 xyz data, the data_num will be equal to 500, the data in slice[501:2047] will not load for training network. Thanks!

burui11087 avatar Oct 11 '19 09:10 burui11087