nmwsharp / diffusion-net

Pytorch implementation of DiffusionNet for fast and robust learning on 3D surfaces like meshes or point clouds.
https://arxiv.org/abs/2012.00888
MIT License
398 stars 50 forks source link

Running under windows? #16

Open fstwn opened 2 years ago

fstwn commented 2 years ago

Hey, just discovered this work and it looks extremely great! I'd be very excited if it was possible to explore possible integrations into our current research. I tried installing under windows but a few requirements are linux only if I am correct. So when running

conda env create --name diffusion_net -f environment.yml

I get

Solving environment: failed

ResolvePackageNotFound:
  - ncurses=6.2
  - libgcc-ng=9.1.0
  - ld_impl_linux-64=2.33.1
  - libstdcxx-ng=9.1.0
  - readline=8.1

If you could give me your opinion on if it would be possible to run under windows at all, I would be very thankful! If you could drop any hints on how, it would be even more appreciated.

In any case: Thank you for your great work and best wishes!

nmwsharp commented 2 years ago

Hi! Thanks for the heads up on this.

To my knowledge there should be no issues with running on Windows, I suspect this is just an issue of bad versions in the conda environment file.

If you don't mind, I would try running DiffusionNet in a clean environment, and just adding the default versions of packages as the are needed. Everything is just standard Pytorch and other popular packages, so I don't think it should be much of an issue.

I will also give this a shot myself next time I am on a Windows machine, but I'm not sure when that will be! Please do let me know here if you hit any other big obstacles with packages.

fstwn commented 2 years ago

Hi again and thank you for your reply! You are right, I just tested it by initializing a new conda env and running the human_segmentation_original experiment by calling python human_segmentation_original.py --input_features=xyz

I then looked at the missing package errors and installed their default versions using pip. This worked, so I think it is really just the environment.yml file that needs a little correction :)

fstwn commented 2 years ago

Hey @nmwsharp @pvnieo I just did some tries again. Here is an environment.yml that mostly did the trick for me: https://github.com/fstwn/diffusion-net/blob/3cdeb8a7a0b98c12c6bb8c48c2a650a49090792e/environment.yml

I ran all your experiments with the following results:

The functional_correspondence experiment always throws the following error for me:

Traceback (most recent call last):
  File "functional_correspondence.py", line 216, in <module>
    train_loss = train_epoch(epoch)
  File "functional_correspondence.py", line 116, in train_epoch
    for data in tqdm(train_loader):
  File "...\lib\site-packages\tqdm\std.py", line 1167, in __iter__
    for obj in iterable:
  File "...\lib\site-packages\torch\utils\data\dataloader.py", line 521, in __next__
    data = self._next_data()
  File "...\lib\site-packages\torch\utils\data\dataloader.py", line 561, in _next_data
    data = self._dataset_fetcher.fetch(index)  # may raise StopIteration
  File "...\lib\site-packages\torch\utils\data\_utils\fetch.py", line 51, in fetch
    data = self.dataset[possibly_batched_index]
  File "...\diffusion-net\experiments\functional_correspondence\faust_scape_dataset.py", line 188, in __getitem__
    evec_1_a, evec_2_a = evec_1[vts1,:], evec_2[vts2,:]
IndexError: tensors used as indices must be long, byte or bool tensors

The human_segmentation_original throws this error on training:

Traceback (most recent call last):
  File "human_segmentation_original.py", line 204, in <module>
    train_acc = train_epoch(epoch)
  File "human_segmentation_original.py", line 136, in train_epoch
    loss = torch.nn.functional.nll_loss(preds, labels)
  File "...\lib\site-packages\torch\nn\functional.py", line 2532, in nll_loss
    return torch._C._nn.nll_loss_nd(input, target, weight, _Reduction.get_enum(reduction), ignore_index)
RuntimeError: "nll_loss_forward_reduce_cuda_kernel_2d_index" not implemented for 'Int'

The sampling_invariance experiment produces a load of these errors on evaluation:

Computing all-pairs geodesic distance (warning: SLOW!)
  0%|                                                                                                                                                          | 0/120 [00:02<?, ?it/s]
Traceback (most recent call last):
  File "../../src\diffusion_net\geometry.py", line 862, in get_all_pairs_geodesic_distance
    pool = Pool(None) # on 8 processors
  File "...\lib\multiprocessing\context.py", line 119, in Pool
    return Pool(processes, initializer, initargs, maxtasksperchild,
  File "...\lib\multiprocessing\pool.py", line 212, in __init__
    self._repopulate_pool()
  File "...\lib\multiprocessing\pool.py", line 303, in _repopulate_pool
    return self._repopulate_pool_static(self._ctx, self.Process,
  File "...\lib\multiprocessing\pool.py", line 326, in _repopulate_pool_static
    w.start()
  File "...\lib\multiprocessing\process.py", line 121, in start
    self._popen = self._Popen(self)
  File "...\lib\multiprocessing\context.py", line 327, in _Popen
    return Popen(process_obj)
  File "...\lib\multiprocessing\popen_spawn_win32.py", line 45, in __init__
    prep_data = spawn.get_preparation_data(process_obj._name)
  File "...\lib\multiprocessing\spawn.py", line 154, in get_preparation_data
    _check_not_importing_main()
  File "...\lib\multiprocessing\spawn.py", line 134, in _check_not_importing_main
    raise RuntimeError('''
RuntimeError:
        An attempt has been made to start a new process before the
        current process has finished its bootstrapping phase.

        This probably means that you are not using fork to start your
        child processes and you have forgotten to use the proper idiom
        in the main module:

            if __name__ == '__main__':
                freeze_support()
                ...

        The "freeze_support()" line can be omitted if the program
        is not going to be frozen to produce an executable.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "...\lib\multiprocessing\spawn.py", line 116, in spawn_main
    exitcode = _main(fd, parent_sentinel)
  File "...\lib\multiprocessing\spawn.py", line 125, in _main
    prepare(preparation_data)
  File "...\lib\multiprocessing\spawn.py", line 236, in prepare
    _fixup_main_from_path(data['init_main_from_path'])
  File "...\lib\multiprocessing\spawn.py", line 287, in _fixup_main_from_path
    main_content = runpy.run_path(main_path,
  File "...\lib\runpy.py", line 265, in run_path
    return _run_module_code(code, init_globals, run_name,
  File "...\lib\runpy.py", line 97, in _run_module_code
    _run_code(code, mod_globals, init_globals,
  File "...\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "...\diffusion-net\experiments\sampling_invariance\sampling_invariance.py", line 244, in <module>
    test_acc = test(with_geodesic_error=True)
  File "...\diffusion-net\experiments\sampling_invariance\sampling_invariance.py", line 215, in test
    errors = diffusion_net.geometry.geodesic_label_errors(verts_ref, faces_ref, pred_labels, labels, normalization='diameter', geodesic_cache_dir=geodesic_cache_dir)
  File "../../src\diffusion_net\geometry.py", line 768, in geodesic_label_errors
    dists = get_all_pairs_geodesic_distance(target_verts, target_faces, geodesic_cache_dir)
  File "../../src\diffusion_net\geometry.py", line 866, in get_all_pairs_geodesic_distance
    pool.close()
UnboundLocalError: local variable 'pool' referenced before assignment

I hope this information is useful for your further development! Thank you for your great work, I really admire and appreciate it 🙏

nmwsharp commented 2 years ago

Wow, thank you so much for this information, it is super helpful! I may refer other Windows users to this post, and we can also try to track down and fix some of these issues on Windows. I really appreciate it!

fstwn commented 2 years ago

Always glad to help and contribute 🙏