Vegeta2020 / SE-SSD

SE-SSD: Self-Ensembling Single-Stage Object Detector From Point Cloud, CVPR 2021.
Apache License 2.0
811 stars 128 forks source link

RuntimeError: Expected object of device type cuda but got device type cpu for argument #2 'mat2' in call to _th_mm_out #63

Closed bingo830422 closed 2 years ago

bingo830422 commented 2 years ago
Traceback (most recent call last):
  File "train.py", line 118, in <module>
    main()
  File "train.py", line 115, in main
    train_detector(model, datasets, cfg, distributed=distributed, validate=args.validate, logger=logger,)
  File "~/SE-SSD/det3d/torchie/apis/train_sessd.py", line 325, in train_detector
    trainer.run(data_loaders, cfg.workflow, cfg.total_epochs, local_rank=cfg.local_rank)
  File "~/SE-SSD/det3d/torchie/trainer/trainer_sessd.py", line 472, in run
    epoch_runner(data_loaders[0], data_loaders[1], self.epoch, **kwargs)
  File "~/SE-SSD/det3d/torchie/trainer/trainer_sessd.py", line 346, in train
    outputs = self.batch_processor_inline(self.model, self.model_ema, data_batch, consistency_weight, train_mode=True, **kwargs)
  File "~/SE-SSD/det3d/torchie/trainer/trainer_sessd.py", line 265, in batch_processor_inline
    output_ema = model_ema(example, is_ema=[True, None])
  File "~/.local/lib/python3.6/site-packages/torch/nn/modules/module.py", line 550, in __call__
    result = self.forward(*input, **kwargs)
  File "~/SE-SSD/det3d/models/detectors/voxelnet_sessd.py", line 34, in forward
    x = self.extract_feat(data)
  File "~/SE-SSD/det3d/models/detectors/voxelnet_sessd.py", line 13, in extract_feat
    x = self.backbone(input_features, data["coors"], data["batch_size"], data["input_shape"])
  File "~/.local/lib/python3.6/site-packages/torch/nn/modules/module.py", line 550, in __call__
    result = self.forward(*input, **kwargs)
  File "~/SE-SSD/det3d/models/backbones/scn.py", line 183, in forward
    ret = self.middle_conv(ret)
  File "~/.local/lib/python3.6/site-packages/torch/nn/modules/module.py", line 550, in __call__
    result = self.forward(*input, **kwargs)
  File "~/.local/lib/python3.6/site-packages/spconv/modules.py", line 123, in forward
    input = module(input)
  File "~/.local/lib/python3.6/site-packages/torch/nn/modules/module.py", line 550, in __call__
    result = self.forward(*input, **kwargs)
  File "~/.local/lib/python3.6/site-packages/spconv/conv.py", line 161, in forward
    outids.shape[0])
  File "~/.local/lib/python3.6/site-packages/spconv/functional.py", line 83, in forward
    return ops.indice_conv(features, filters, indice_pairs, indice_pair_num, num_activate_out, False, True)
  File "~/.local/lib/python3.6/site-packages/spconv/ops.py", line 112, in indice_conv
    int(inverse), int(subm))
RuntimeError: Expected object of device type cuda but got device type cpu for argument #2 'mat2' in call to _th_mm_out
Vegeta2020 commented 2 years ago

As the traceback mentioned "Expected object of device type cuda but got device type cpu", you should put the input data on gpu instead of cpu, so try to use ".cuda()" for the input tensors.