Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ValueError: index can't contain negative values #18

Closed
sutongkui opened this issue Aug 8, 2019 · 6 comments
Closed

ValueError: index can't contain negative values #18

sutongkui opened this issue Aug 8, 2019 · 6 comments

Comments

@sutongkui
Copy link

sutongkui commented Aug 8, 2019

I used classification pretrained parameters, the test works well for edges 750, but then I subdivide the mesh to 3000 edges(apply 1 loop, still manifold), and set --pool_res 2500 2000 1500 1000, error occurs below, do I have to use the fixed edges(like 750) as input? How to deal with dense meshes, do we need to retrain it?

Running Test 
loaded mean / std from cache  
loading the model from ./checkpoints\mytest\latest_net.pth  
Traceback (most recent call last):  
  File "test.py", line 25, in <module>  
    run_test()  
  File "test.py", line 16, in run_test  
    for i, data in enumerate(dataset):  
  File "E:\Github\MeshCNN\data\__init__.py", line 33, in __iter__
    for i, data in enumerate(self.dataloader):
  File "D:\DevTool\anaconda3\lib\site-packages\torch\utils\data\dataloader.py", line 582, in __next__
    return self._process_next_batch(batch)
  File "D:\DevTool\anaconda3\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 "D:\DevTool\anaconda3\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 "D:\DevTool\anaconda3\lib\site-packages\torch\utils\data\_utils\worker.py", line 99, in <listcomp>
    samples = collate_fn([dataset[i] for i in batch_indices])
  File "E:\Github\MeshCNN\data\classification_data.py", line 31, in __getitem__
    edge_features = pad(edge_features, self.opt.ninput_edges)
  File "E:\Github\MeshCNN\util\util.py", line 22, in pad
    return np.pad(input_arr, pad_width=npad, mode='constant', constant_values=val)
  File "D:\DevTool\anaconda3\lib\site-packages\numpy\lib\arraypad.py", line 1172, in pad
    pad_width = _as_pairs(pad_width, narray.ndim, as_index=True)
  File "D:\DevTool\anaconda3\lib\site-packages\numpy\lib\arraypad.py", line 949, in _as_pairs
    raise ValueError("index can't contain negative values")
ValueError: index can't contain negative values
@ranahanocka
Copy link
Owner

ranahanocka commented Aug 8, 2019

Did you change the ninput_edges flag to 3000 (the default is 750)? Do that by passing: --ninput_edges 3000. Also, I assume that your training architecture also used --pool_res 2500 2000 1500 1000, otherwise it won't work

@sutongkui
Copy link
Author

sutongkui commented Aug 8, 2019

oh. I forgot to change the default ninput_edges to 3000. you mean that I need to retrain it with the new pooling size?as we know, the real meshes vary from hundreds to hundreds of thousabds, is there a way to handle this with one net,instead of training once for each size. I am trying to use meshcnn as a new method to handle mesh simplification.just like what simplygon does.

@ranahanocka
Copy link
Owner

The --pool_res defines hyper-parameters of the network (aka the network architecture). You cannot use a different network architectures for train / test.

You can re-train the network on your data, define new hyper-parameters for your set, and use the same one for train / test.

@ranahanocka
Copy link
Owner

@sutongkui - closing this issue as I haven't heard from you in a while. If you still need further clarification , let me know.

@claell
Copy link

claell commented Dec 18, 2019

As described in #46, I run into this error with files normalized to 300 or 600 faces resulting in about 500 or 1000 edges. I have to set the number of input edges to 2000 to overcome the error.

@claell
Copy link

claell commented Feb 28, 2020

Works for me now, I have used problematic input data before.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants