czq142857 / BAE-NET

The code for paper "BAE-NET: Branched Autoencoder for Shape Co-Segmentation".
Other
67 stars 13 forks source link

about visualizing unsupervised training #13

Closed krishia closed 2 years ago

krishia commented 2 years ago

hi, I'm trying to visualize colored point cloud segmentation for car dataset from shapeNet and something went wrong. I used python main.py --train --L1reg --iteration 200000 --dataset 02958343_vox --data_dir ./data/02958343_car/ --checkpoint_dir checkpoint_unsup --sample_dir samples/02958343_car --real_size 32 --points_per_shape 8192 for unsupervised training, and it worked well. than I tried to visualized it with point cloud. I read some closed issues, and I changed name of 'obj_list.txt' in car dataset to '02958343_vox.txt'. Than I used python main.py --pointcloud --L1reg --iteration 200000 --dataset 02958343_vox --data_dir ./data/02958343_car --checkpoint_dir checkpoint_unsup --supervision_list 02958343_vox.txt --sample_dir ./data/02958343_car --real_size 32 --points_per_shape 8192 for visualizing, but error occured

AttributeError: 'IMSEG' object has no attribute 'ref_b_point_num'

by the way, supervised learning and point cloud visualizing with chair dataset was working. This error occurs only occurs when I tried to visualize unsupervised-learned dataset.

It will be very helpful for me to have some guide.

czq142857 commented 2 years ago

The error is because you were training/testing the network in an unsupervised setting. And in that setting, the ground truth point clouds are not required, therefore they are not being loaded. You need to change some code to load them.

Change Line 161-164 in model.py

            ref_txt_name = self.data_dir+'/'+supervision_list
            if os.path.exists(ref_txt_name):
                self.ref_idx, self.ref_obj_name = parse_txt_list_unsupervised(ref_txt_name, allset_txt_name)
                self.ref_voxels = allset_voxels[self.ref_idx]

to

            ref_txt_name = self.data_dir+'/'+supervision_list
            if os.path.exists(ref_txt_name):
                self.ref_b_points, self.ref_b_values, self.ref_b_point_num, _, self.ref_idx, _, self.ref_obj_name = parse_txt_list(ref_txt_name, self.data_dir+"/points", allset_txt_name)
                self.ref_points = allset_points[self.ref_idx]
                self.ref_values = allset_values[self.ref_idx]
                self.ref_voxels = allset_voxels[self.ref_idx]
            else:
                print("error: cannot load "+ref_txt_name)
                exit(0)

which is basically Line 84-106 in model.py.

If you need the ground truth point clouds of the car category, you can download them here. I just realized they are not included in the dataset I provided. https://drive.google.com/file/d/15t3-dzAj25iOZ9mr4aUF6n6FTHraVm9Y/view?usp=sharing

krishia commented 2 years ago

Thank you for helping. I changed code that you announced, but another error occurred while testing same code I wrote above.

FileNotFoundError: [Errno 2] No such file or directory: './data/02958343_car/points/10247b51a42b41603ffe0e5069bf1eb5.txt'

I think this is because there is no 'points' directory in car dataset. there was only hd5f file, and obj_list.txt, statistics.txt.

I found same composition in bench, rifle, couch, vessel dataset. In this case, you provide the ground truth point cloud of car dataset. But I wish I can know how to create 'points' directory and point clouds for my own data set, preprocessed by 'gather_vox_from_binvox.py' which you provide in 'point_sampling' directory. (the output of dataset was same as those I wrote above (bench, rifle, ..)). or visualized the output with out needs of 'point' dataset.

czq142857 commented 2 years ago

I did not create the 'points' directory. These ground truth points and segmentation labels are provided by the ShapeNet part dataset.

If you just need to visualize a point cloud for the shape, then you can change the parser code to load your own point clouds.

krishia commented 2 years ago

Thanks for your advice. What I really need is segmented point cloud based on my binvox file, so I will try to change the parser code and make own point cloud dataset. Finally, will it be okay with not-labeled point clouds in unsupervised-based visualization? I'd like to ask your opinion.

czq142857 commented 2 years ago

Yes. Just change the parser code to load fake labels, e.g., all zeros.

krishia commented 2 years ago

Thank you! your advices were very helpful.