Gorilla-Lab-SCUT / SSTNet

Instance Segmentation in 3D Scenes using Semantic Superpoint Tree Networks
MIT License
98 stars 8 forks source link

The number of observations cannot be determined on an empty distance matrix. #7

Closed yangxin6 closed 2 years ago

yangxin6 commented 2 years ago

Thanks for sharing your source code! I am trying SSTNet to train S3DIS dataset, I have encountered an error and can't find how to get it wrong, I hope the author has time to help me solve it. Here is my error message.

Traceback (most recent call last):
  File "/home/deep/3D-Instance-Segmentation/SSTNet-workspace/SSTNet/train.py", line 311, in <module>
    gorilla.launch(
  File "/home/deep/anaconda3/envs/SSTNet/lib/python3.8/site-packages/gorilla/core/launch.py", line 72, in launch
    main_func(*args)
  File "/home/deep/3D-Instance-Segmentation/SSTNet-workspace/SSTNet/train.py", line 301, in main
    do_train(model, cfg, logger)
  File "/home/deep/3D-Instance-Segmentation/SSTNet-workspace/SSTNet/train.py", line 130, in do_train
    ret = model(input_,
  File "/home/deep/anaconda3/envs/SSTNet/lib/python3.8/site-packages/torch/nn/modules/module.py", line 727, in _call_impl
    result = self.forward(*input, **kwargs)
  File "/home/deep/3D-Instance-Segmentation/SSTNet-workspace/SSTNet/sstnet/model/sstnet.py", line 429, in forward
    self.hierarchical_fusion_step(superpoint,
  File "/home/deep/3D-Instance-Segmentation/SSTNet-workspace/SSTNet/sstnet/model/sstnet.py", line 276, in hierarchical_fusion_step
    hierarchical_tree_list, tree_list, fusion_features_list, fusion_labels_list, nodes_list = build_hierarchical_tree(
  File "/home/deep/3D-Instance-Segmentation/SSTNet-workspace/SSTNet/sstnet/model/func_helper.py", line 66, in build_hierarchical_tree
    tree_connection = linkage(affinity_np, method="average", with_observation=True)
  File "/home/deep/anaconda3/envs/SSTNet/lib/python3.8/site-packages/cluster/hierarchy.py", line 1065, in linkage
    n = int(distance.num_obs_y(y))
  File "/home/deep/anaconda3/envs/SSTNet/lib/python3.8/site-packages/scipy/spatial/distance.py", line 2572, in num_obs_y
    raise ValueError("The number of observations cannot be determined on "
ValueError: The number of observations cannot be determined on an empty distance matrix.

This is the configuration file corresponding to my S3DIS.

task: train  # train, test
seed: 123

data:
  ignore_label: -100
  mode: 4 # 4=mean

  # train mode
  epochs: 512
  save_freq: 8  # also eval_freq

  # test mode
  test_seed: 567
  test_workers: 8 # data loader workers

  TEST_NMS_THRESH: 0.3
  TEST_SCORE_THRESH: 0.00
  TEST_NPOINT_THRESH: 100

  split: val
  test_epoch: 512

dataloader:
  batch_size: 4
  num_workers: 8 # data loader workers

dataset:
  ignore_label: -100
  type: S3DISInst
  data_root: data/s3dis
  data_dir: inputs_sample
  full_scale: [128, 512]
  scale: 50   # voxel_size = 1 / scale, scale 50(2cm)
  max_npoint: 40000
  task: train
  train_area: [ 1,2,3,4,6 ]
  test_area: [ 5 ]
  with_elastic: False
  prefetch_superpoints: False

model:
  type: SSTNet
  input_channel: 3
  use_coords: True
  blocks: 5
  block_reps: 2
  media: 32 # 16 or 32
  classes: 20
  score_scale: 50 # the minimal voxel size is 2cm
  score_fullscale: 14
  score_mode: 4 # mean
  detach: True
  affinity_weight: [1.0, 1.0]
  with_refine: False
  fusion_epochs: 128
  score_epochs: 160
  fix_module: []

loss:
  type: SSTLoss
  ignore_label: -100
  fusion_epochs: 128
  score_epochs: 160
  bg_thresh: 0.25
  fg_thresh: 0.75
  semantic_dice: True
  loss_weight: [1.0, 1.0, 1.0, 1.0, 1.0] # semantic_loss, offset_norm_loss, offset_dir_loss, score_loss

# optimizer
optimizer:
  lr: 0.001
  # type: Adam
  type: AdamW
  weight_decay: 0.0001
  # amsgrad: False

# lr_scheduler
lr_scheduler:
  type: PolyLR
  # max_iters: 153600
  # max_iters: 614912
  max_iters: 512
  power: 0.9
  constant_ending: 0.0