itberrios / 3D

3D projects
MIT License
19 stars 12 forks source link

Error when reducing data format with no paritions (unsliced) #5

Open SantiDiazC opened 6 months ago

SantiDiazC commented 6 months ago

Hi, Thanks for your work. I am following your tutorial on https://towardsdatascience.com/point-net-for-semantic-segmentation-3eea48715a62. According to that before training the model I need to reduce the data using the notebook s3dis_raw_explorer.ipynb https://github.com/itberrios/3D/blob/main/s3dis_raw_explorer.ipynb. However, I have a problem running the following cell:

tic = time.time()

for area in area_dict:
    # create new directory
    save_dir = os.path.join(SAVE_PATH, area)
    if not os.path.exists(save_dir):
        os.mkdir(save_dir)

    for space in area_dict[area]:
        # obtain xyz points with truth labels
        space_data = pd.DataFrame(get_space_data(area_dict[area][space]))

        # save as .hdf5 file in new directory
        save_path = os.path.join(save_dir, space + '.hdf5')
        space_data.to_hdf(save_path, key='space_data')

toc = time.time()
print(toc - tic)

The error is the following:

FileNotFoundError: [Errno 2] No such file or directory: './datasets/S3DIS/Stanford3dDataset_v1.2_Reduced_Aligned_Version/./datasets/S3DIS/Stanford3dDataset_v1.2_Aligned_Version/Area_5'

I set the paths like this (Relative path working on Ubuntu 22.04):

ROOT = r'./datasets/S3DIS/Stanford3dDataset_v1.2_Aligned_Version'
SAVE_PATH = r'./datasets/S3DIS/Stanford3dDataset_v1.2_Reduced_Aligned_Version'
PARTITION_SAVE_PATH = r'./datasets/S3DIS/Stanford3dDataset_v1.2_Reduced_Partitioned_Aligned_Version'

But when I used the full path for all the three folders:

ROOT = r'/home/hri-david/PycharmProjects/Pointnet/3D/datasets/S3DIS/Stanford3dDataset_v1.2_Aligned_Version'
SAVE_PATH = r'/home/hri-david/PycharmProjects/Pointnet/3D/datasets/S3DIS/Stanford3dDataset_v1.2_Reduced_Aligned_Version'
PARTITION_SAVE_PATH = r'/home/hri-david/PycharmProjects/Pointnet/3D/datasets/S3DIS/Stanford3dDataset_v1.2_Reduced_Partitioned_Aligned_Version'

I get this error:

KeyError: '/home/hri-david/PycharmProjects/Pointnet/3D/datasets/S3DIS/Stanford3dDataset'

How Can I set the paths such I don't get any error like these? Thank you in advance!

rekk5 commented 1 week ago

Hi, i do not know do you have this problem anymore, but when using this tutorial it is coded in windows and if you are using a Ubuntu distribution you have to change some lines of code. Because the file system uses \ in windows, but / in Ubuntu and macOS. And cannot find your folders because of that. In this file for example change these

space_dict.update({space.split('\\')[-1] : segments})

area_dict.update({area.split('\\')[-1] : space_dict})

cat = CATEGORIES[seg_path.split('\\')[-1].split('_')[0]]

to these

space_dict.update({space.split('/')[-1] : segments})

area_dict.update({area.split('/')[-1] : space_dict})

cat = CATEGORIES[seg_path.split('/')[-1].split('_')[0]]

There are other files in the tutorial you will encounter similar problem. And also you should use numpy-1.26.0. I ran to some issues while using numpy-2.0.0