ranahanocka / MeshCNN

Convolutional Neural Network for 3D meshes in PyTorch
MIT License
1.56k stars 314 forks source link

how to run test without ground-truth seg files #16

Open shshwdr opened 4 years ago

shshwdr commented 4 years ago

Hi I think I'm confused about how to test my own test case. run those commands(human segmentation related) works fine for me, but if I want to segment some other obj file, what should I do? I tried to put my obj file in test but that doesn't seem to work, it ask me to have seg files. I don't need to test the result of the segmentation, just want to segment with trained data. Thanks a lot and really appreciate your code.

ranahanocka commented 4 years ago

Hi @shshwdr ,

Yes I didn't include this functionality, I probably should have.

Currently, the ground-truth seg files are used to calculate the test accuracy. So, I think the easiest hack to just get the code to work is to create some dummy seg files which are all zeros or something -- (just ignore the printed accuracy), and everything should run fine. Please check the segmentation wiki for more info on these files.

-Rana

shshwdr commented 4 years ago

I added two all zerod files in seg and sseg, then I got this error when I run test. my model has 30144 edges.: Running Test loaded mean / std from cache loading the model from ./checkpoints\human_seg\latest_net.pth Traceback (most recent call last): File "test.py", line 25, in run_test() File "test.py", line 16, in run_test for i, data in enumerate(dataset): File "C:\Users\si.chen\Desktop\MeshCNN-master\data__init.py", line 33, in iter for i, data in enumerate(self.dataloader): File "C:\Users\si.chen\AppData\Local\Programs\Python\Python37\lib\site-packages\torch\utils\data\dataloader.py", line 582, in next return self._process_next_batch(batch) File "C:\Users\si.chen\AppData\Local\Programs\Python\Python37\lib\site-packages\torch\utils\data\dataloader.py", line 608, in _process_next_batch raise batch.exc_type(batch.exc_msg) ValueError: Traceback (most recent call last): File "C:\Users\si.chen\AppData\Local\Programs\Python\Python37\lib\site-packages\torch\utils\data_utils\worker.py", line 99, in _worker_loop samples = collate_fn([dataset[i] for i in batch_indices]) File "C:\Users\si.chen\AppData\Local\Programs\Python\Python37\lib\site-packages\torch\utils\data_utils\worker.py", line 99, in samples = collate_fn([dataset[i] for i in batch_indices]) File "C:\Users\si.chen\Desktop\MeshCNN-master\data\segmentation_data.py", line 33, in getitem label = pad(label, self.opt.ninput_edges, val=-1, dim=0) File "C:\Users\si.chen\Desktop\MeshCNN-master\util\util.py", line 22, in pad return np.pad(input_arr, pad_width=npad, mode='constant', constant_values=val) File "<__array_function internals>", line 6, in pad File "C:\Users\si.chen\AppData\Local\Programs\Python\Python37\lib\site-packages\numpy\lib\arraypad.py", line 793, in pad pad_width = _as_pairs(pad_width, array.ndim, as_index=True) File "C:\Users\si.chen\AppData\Local\Programs\Python\Python37\lib\site-packages\numpy\lib\arraypad.py", line 560, in _as_pairs raise ValueError("index can't contain negative values") ValueError: index can't contain negative values

shshwdr commented 4 years ago

I tried to find a object with 2259 edges and set the ninput_edges to 2259, pool_res to 1800 1350 600 and get the result. But the result is quite not as I expected since it segment in weird position. Is the settings I put in correct? should I add both seg and sseg file? is there anything I can do to improve it? or it's just I need to train more human models? thanks.

yjh720 commented 4 years ago

I tried to find a object with 2259 edges and set the ninput_edges to 2259, pool_res to 1800 1350 600 and get the result. But the result is quite not as I expected since it segment in weird position. Is the settings I put in correct? should I add both seg and sseg file? is there anything I can do to improve it? or it's just I need to train more human models? thanks.

Hi @shshwdr, I'm doing the similar thing. However, I'm not able to segment my objs. The results is always the human segmentation even if I change the obj file(without touching seg files). Do you mind teaching me how to do your own segmentation?

ranahanocka commented 4 years ago

I tried to find a object with 2259 edges and set the ninput_edges to 2259, pool_res to 1800 1350 600 and get the result. But the result is quite not as I expected since it segment in weird position. Is the settings I put in correct? should I add both seg and sseg file? is there anything I can do to improve it? or it's just I need to train more human models? thanks.

If you are using my pre-trained network, then you should not change ninput_edges parameter, then it will not work. Please use the default for segmentation (for humans it is --ninput_edges 2280) and re-run. The test requires both seg and sseg (unless you want to modify the accuracy computation). I think you can just comment out this line and then maybe you won't need the seg / sseg files anymore

Eisorak commented 3 years ago

Hi @shshwdr

were you able to perform a test without field truth segmentation files?