ranahanocka / MeshCNN

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

Zero problem on my private dataset #122

Open Xelawk opened 3 years ago

Xelawk commented 3 years ago

Here is the problem I encounterd when I was trying to training meshcnn with my private dataset.

arch: mconvnet
batch_size: 16
beta1: 0.9
checkpoints_dir: ./checkpoints
continue_train: False
dataroot: datasets/shape59_simplify
dataset_mode: classification
epoch_count: 1
export_folder: 
fc_n: 100
flip_edges: 0.2
gpu_ids: [0]
init_gain: 0.02
init_type: normal
is_train: True
lr: 0.0002
lr_decay_iters: 50
lr_policy: lambda
max_dataset_size: inf
name: shape59
ncf: [64, 128, 256, 256]
ninput_edges: 1500
niter: 100
niter_decay: 100
no_vis: False
norm: group
num_aug: 20
num_groups: 16
num_threads: 3
phase: train
pool_res: [600, 450, 300, 180]
print_freq: 10
resblocks: 1
run_test_freq: 1
save_epoch_freq: 1
save_latest_freq: 250
scale_verts: False
seed: None
serial_batches: False
slide_verts: 0.2
verbose_plot: False
which_epoch: latest
-------------- End ----------------
computing mean std from train data...
0 of 8366
/Dev/xelawk_dev/MeshCNN/models/layers/mesh_prepare.py:171: RuntimeWarning: invalid value encountered in true_divide
  face_normals /= face_areas[:, np.newaxis]
Traceback (most recent call last):
  File "/Dev/xelawk_dev/MeshCNN/train.py", line 10, in <module>
    dataset = DataLoader(opt)
  File "/Dev/xelawk_dev/MeshCNN/data/__init__.py", line 22, in __init__
    self.dataset = CreateDataset(opt)
  File "/Dev/xelawk_dev/MeshCNN/data/__init__.py", line 13, in CreateDataset
    dataset = ClassificationData(opt)
  File "/Dev/xelawk_dev/MeshCNN/data/classification_data.py", line 20, in __init__
    self.get_mean_std()
  File "/Dev/xelawk_dev/MeshCNN/data/base_dataset.py", line 32, in get_mean_std
    for i, data in enumerate(self):
  File "/Dev/xelawk_dev/MeshCNN/data/classification_data.py", line 28, in __getitem__
    mesh = Mesh(file=path, opt=self.opt, hold_history=False, export_folder=self.opt.export_folder)
  File "/Dev/xelawk_dev/MeshCNN/models/layers/mesh.py", line 16, in __init__
    fill_mesh(self, file, opt)
  File "/Dev/xelawk_dev/MeshCNN/models/layers/mesh_prepare.py", line 11, in fill_mesh
    mesh_data = from_scratch(file, opt)
  File "/Dev/xelawk_dev/MeshCNN/models/layers/mesh_prepare.py", line 57, in from_scratch
    faces, face_areas = remove_non_manifolds(mesh_data, faces)
  File "/Dev/xelawk_dev/MeshCNN/models/layers/mesh_prepare.py", line 96, in remove_non_manifolds
    _, face_areas = compute_face_normals_and_areas(mesh, faces)
  File "/Dev/xelawk_dev/MeshCNN/models/layers/mesh_prepare.py", line 172, in compute_face_normals_and_areas
    assert (not np.any(face_areas[:, np.newaxis] == 0)), 'has zero area face: %s' % mesh.filename
AssertionError: has zero area face: 27007379.obj

Process finished with exit code 1
Xelawk commented 3 years ago

And now, I trying to add a small float like 1e-3 to avoid zero problem, then the new problem happens, as below:

arch: mconvnet
batch_size: 16
beta1: 0.9
checkpoints_dir: ./checkpoints
continue_train: False
dataroot: datasets/shape59_simplify
dataset_mode: classification
epoch_count: 1
export_folder: 
fc_n: 100
flip_edges: 0.2
gpu_ids: [0]
init_gain: 0.02
init_type: normal
is_train: True
lr: 0.0002
lr_decay_iters: 50
lr_policy: lambda
max_dataset_size: inf
name: shape59
ncf: [64, 128, 256, 256]
ninput_edges: 1500
niter: 100
niter_decay: 100
no_vis: False
norm: group
num_aug: 20
num_groups: 16
num_threads: 3
phase: train
pool_res: [600, 450, 300, 180]
print_freq: 10
resblocks: 1
run_test_freq: 1
save_epoch_freq: 1
save_latest_freq: 250
scale_verts: False
seed: None
serial_batches: False
slide_verts: 0.2
verbose_plot: False
which_epoch: latest
-------------- End ----------------
computing mean std from train data...
0 of 8366
/Dev/xelawk_dev/MeshCNN/models/layers/mesh_prepare.py:430: RuntimeWarning: invalid value encountered in true_divide
  closest_point = point_a + (projection_length / edges_lengths)[:, np.newaxis] * line_ab
500 of 8366
1000 of 8366
1500 of 8366
2000 of 8366
2500 of 8366
3000 of 8366
3500 of 8366
4000 of 8366
4500 of 8366
5000 of 8366
5500 of 8366
6000 of 8366
6500 of 8366
7000 of 8366
7500 of 8366
8000 of 8366
saved:  datasets/shape59_simplify/mean_std_cache.p
loaded mean / std from cache
#training meshes = 8366
---------- Network initialized -------------
[Network] Total number of parameters : 1.326 M
-----------------------------------------------
Traceback (most recent call last):
  File "/Dev/xelawk_dev/MeshCNN/train.py", line 23, in <module>
    for i, data in enumerate(dataset):
  File "/Dev/xelawk_dev/MeshCNN/data/__init__.py", line 34, in __iter__
    for i, data in enumerate(self.dataloader):
  File "/home/anaconda3/envs/dev/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 345, in __next__
    data = self._next_data()
  File "/home/anaconda3/envs/dev/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 856, in _next_data
    return self._process_data(data)
  File "/home/anaconda3/envs/dev/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 881, in _process_data
    data.reraise()
  File "/home/anaconda3/envs/dev/lib/python3.6/site-packages/torch/_utils.py", line 394, in reraise
    raise self.exc_type(msg)
ValueError: Caught ValueError in DataLoader worker process 0.
Original Traceback (most recent call last):
  File "/home/anaconda3/envs/dev/lib/python3.6/site-packages/torch/utils/data/_utils/worker.py", line 178, in _worker_loop
    data = fetcher.fetch(index)
  File "/home/anaconda3/envs/dev/lib/python3.6/site-packages/torch/utils/data/_utils/fetch.py", line 44, in fetch
    data = [self.dataset[idx] for idx in possibly_batched_index]
  File "/home/anaconda3/envs/dev/lib/python3.6/site-packages/torch/utils/data/_utils/fetch.py", line 44, in <listcomp>
    data = [self.dataset[idx] for idx in possibly_batched_index]
  File "/Dev/xelawk_dev/MeshCNN/data/classification_data.py", line 28, in __getitem__
    mesh = Mesh(file=path, opt=self.opt, hold_history=False, export_folder=self.opt.export_folder)
  File "/Dev/xelawk_dev/MeshCNN/models/layers/mesh.py", line 16, in __init__
    fill_mesh(self, file, opt)
  File "/Dev/xelawk_dev/MeshCNN/models/layers/mesh_prepare.py", line 11, in fill_mesh
    mesh_data = from_scratch(file, opt)
  File "/Dev/xelawk_dev/MeshCNN/models/layers/mesh_prepare.py", line 62, in from_scratch
    post_augmentation(mesh_data, opt)
  File "/Dev/xelawk_dev/MeshCNN/models/layers/mesh_prepare.py", line 188, in post_augmentation
    slide_verts(mesh, opt.slide_verts)
  File "/Dev/xelawk_dev/MeshCNN/models/layers/mesh_prepare.py", line 201, in slide_verts
    if min(dihedral[edges]) > 2.65:
ValueError: min() arg is an empty sequence
Jinhe404 commented 1 year ago

I'd like to ask if you've solved this problem. I'm encountering the same issue now. How did you solve it?