chrischoy / SpatioTemporalSegmentation

4D Spatio-Temporal Semantic Segmentation on a 3D video (a sequence of 3D scans)
MIT License
288 stars 51 forks source link

[MinkowskiEngine 0.5.4][ME.RegionType.HYBRID vs ME.RegionType.CUSTOM] ME.RegionType.CUSTOM giving AttributeError: 'NoneType' object has no attribute 'numel' #51

Closed sandeepnmenon closed 3 years ago

sandeepnmenon commented 3 years ago

Hi @chrischoy
I am trying to run the code in presumably written with the 0.4.3 MinkowskiEngine but my version in 0.5.4 https://github.com/chrischoy/SpatioTemporalSegmentation/blob/4afee296ebe387d9a06fc1b168c4af212a2b4804/models/modules/common.py#L58

Which uses ME.RegionType.HYBRID. I replaced HYPERCUBE and HYPERCROSS to HYPER_CUBE and HYPER_CROSS respectively. Then I replaced ME.RegionType.HYBRID with ME.RegionType.CUSTOM in the above mentioned line.

I am getting the following error

Traceback (most recent call last):
  File "/home/anaconda3/envs/py3-mink/lib/python3.8/runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/home/anaconda3/envs/py3-mink/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/home/SandeepMenon/SpatioTemporalSegmentation/main.py", line 156, in <module>
    main()
  File "/home/SandeepMenon/SpatioTemporalSegmentation/main.py", line 117, in main
    model = NetClass(num_in_channel, num_labels, config)
  File "/home/SandeepMenon/SpatioTemporalSegmentation/models/res16unet.py", line 339, in __init__
    super(STRes16UNetBase, self).__init__(in_channels, out_channels, config, D, **kwargs)
  File "/home/SandeepMenon/SpatioTemporalSegmentation/models/res16unet.py", line 23, in __init__
    super(Res16UNetBase, self).__init__(in_channels, out_channels, config, D)
  File "/home/SandeepMenon/SpatioTemporalSegmentation/models/resnet.py", line 25, in __init__
    self.network_initialization(in_channels, out_channels, config, D)
  File "/home/SandeepMenon/SpatioTemporalSegmentation/models/res16unet.py", line 58, in network_initialization
    self.block1 = self._make_layer(
  File "/home/SandeepMenon/SpatioTemporalSegmentation/models/resnet.py", line 106, in _make_layer
    block(
  File "/home/SandeepMenon/SpatioTemporalSegmentation/models/modules/resnet_block.py", line 23, in __init__
    self.conv1 = conv(
  File "/home/SandeepMenon/SpatioTemporalSegmentation/models/modules/common.py", line 128, in conv
    kernel_generator = ME.KernelGenerator(
  File "/home/anaconda3/envs/py3-mink/lib/python3.8/site-packages/MinkowskiEngine/MinkowskiKernelGenerator.py", line 303, in __init__
    self.kernel_volume = get_kernel_volume(
  File "/home/anaconda3/envs/py3-mink/lib/python3.8/site-packages/MinkowskiEngine/MinkowskiKernelGenerator.py", line 91, in get_kernel_volume
    region_offset.numel() > 0
AttributeError: 'NoneType' object has no attribute 'numel'

While trying to create an ME.KernelGenerator using the following params

ME.KernelGenerator(
      3, 1, 1, region_type=ME.RegionType.CUSTOM, axis_types=[<RegionType.HYPER_CUBE: 0>, <RegionType.HYPER_CUBE: 0>, <RegionType.HYPER_CUBE: 0>, <RegionType.HYPER_CROSS: 1>], dimension=4)

It is because I am not providing region_offsets. Can you help me understand offsets to give in this case? How to use the ME.RegionType.CUSTOM type in replacement to this? Else, how to install MinkowskiEngine 0.4.3. I dont see an archive.

Thank you

suyunzzz commented 3 years ago

@sandeepnmenon hello,MinkowskiEngine 0.4.3 at here : https://github.com/NVIDIA/MinkowskiEngine/releases/tag/v0.4.3

sandeepnmenon commented 3 years ago

@suyunzzz Thank you Closing the issue.

saltoricristiano commented 2 years ago

Hey @sandeepnmenon,

did you solve the issue in the end? I'm using mink v 0.5 but the HYBRID kernel is not available yet.

sandeepnmenon commented 2 years ago

@saltoricristiano No, I could not solve it in v0.5. I solved the issue by using v0.4.3 in my environment.

HaFred commented 1 year ago

Hey @sandeepnmenon,

did you solve the issue in the end? I'm using mink v 0.5 but the HYBRID kernel is not available yet.

I found that Chris did have a branch for v0.5, that can solve the region type update issue. See this commit.