XuyangBai / TransFusion

[PyTorch] Official implementation of CVPR2022 paper "TransFusion: Robust LiDAR-Camera Fusion for 3D Object Detection with Transformers". https://arxiv.org/abs/2203.11496
Apache License 2.0
619 stars 76 forks source link

How to train? #27

Closed lijunnankman closed 2 years ago

lijunnankman commented 2 years ago

Hi, in your README.md, I do not notice how to train your model. Could you show me how to begin the training? Thanks a lot!

mljack commented 2 years ago

train-with-a-single-gpu

Try something like this:

python -u tools/train.py configs/transfusion_nusc_voxel_L.py --auto-resume 2>&1 | tee -a train.log
python -u tools/train.py configs/transfusion_nusc_voxel_LC.py --auto-resume 2>&1 | tee -a train.log
lijunnankman commented 2 years ago

@mljack Thanks for replying. However, When I run

python -u tools/train.py configs/transfusion_nusc_voxel_LC.py --auto-resume 2>&1 | tee -a train.log

The following error occurred:

Traceback (most recent call last): File "tools/train.py", line 16, in from mmdet3d.datasets import build_dataset File "/DATA_4/ljn/TransFusion/mmdet3d/datasets/init.py", line 3, in from .custom_3d import Custom3DDataset File "/DATA_4/ljn/TransFusion/mmdet3d/datasets/custom_3d.py", line 8, in from ..core.bbox import get_box_type File "/DATA_4/ljn/TransFusion/mmdet3d/core/init.py", line 2, in from .bbox import * # noqa: F401, F403 File "/DATA_4/ljn/TransFusion/mmdet3d/core/bbox/init.py", line 4, in from .iou_calculators import (AxisAlignedBboxOverlaps3D, BboxOverlaps3D, File "/DATA_4/ljn/TransFusion/mmdet3d/core/bbox/iou_calculators/init.py", line 1, in from .iou3d_calculator import (AxisAlignedBboxOverlaps3D, BboxOverlaps3D, File "/DATA_4/ljn/TransFusion/mmdet3d/core/bbox/iou_calculators/iou3d_calculator.py", line 5, in from ..structures import get_box_type File "/DATA_4/ljn/TransFusion/mmdet3d/core/bbox/structures/init.py", line 1, in from .base_box3d import BaseInstance3DBoxes File "/DATA_4/ljn/TransFusion/mmdet3d/core/bbox/structures/base_box3d.py", line 5, in from mmdet3d.ops.iou3d import iou3d_cuda File "/DATA_4/ljn/TransFusion/mmdet3d/ops/init.py", line 5, in from .ball_query import ball_query File "/DATA_4/ljn/TransFusion/mmdet3d/ops/ball_query/init.py", line 1, in from .ball_query import ball_query File "/DATA_4/ljn/TransFusion/mmdet3d/ops/ball_query/ball_query.py", line 4, in from . import ball_query_ext ImportError: cannot import name 'ball_query_ext' from partially initialized module 'mmdet3d.ops.ball_query' (most likely due to a circular import) (/DATA_4/ljn/TransFusion/mmdet3d/ops/ball_query/init.py)

My environment information is as follows:

CUDA_HOME: /usr/local/cuda NVCC: Build cuda_11.3.r11.3/compiler.29920130_0 GCC: gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0 PyTorch: 1.10.1 PyTorch compiling details: PyTorch built with:

  • GCC 7.3
  • C++ Version: 201402
  • Intel(R) oneAPI Math Kernel Library Version 2021.4-Product Build 20210904 for Intel(R) 64 architecture applications
  • Intel(R) MKL-DNN v2.2.3 (Git Hash 7336ca9f055cf1bfa13efb658fe15dc9b41f0740)
  • OpenMP 201511 (a.k.a. OpenMP 4.5)
  • LAPACK is enabled (usually provided by MKL)
  • NNPACK is enabled
  • CPU capability usage: AVX2
  • CUDA Runtime 11.3
  • NVCC architecture flags: -gencode;arch=compute_37,code=sm_37;-gencode;arch=compute_50,code=sm_50;-gencode;arch=compute_60,code=sm_60;-gencode;arch=compute_61,code=sm_61;-gencode;arch=compute_70,code=sm_70;-gencode;arch=compute_75,code=sm_75;-gencode;arch=compute_80,code=sm_80;-gencode;arch=compute_86,code=sm_86;-gencode;arch=compute_37,code=compute_37
  • CuDNN 8.2
  • Magma 2.5.2
  • Build settings: BLAS_INFO=mkl, BUILD_TYPE=Release, CUDA_VERSION=11.3, CUDNN_VERSION=8.2.0, CXX_COMPILER=/opt/rh/devtoolset-7/root/usr/bin/c++, CXX_FLAGS= -Wno-deprecated -fvisibility-inlines-hidden -DUSE_PTHREADPOOL -fopenmp -DNDEBUG -DUSE_KINETO -DUSE_FBGEMM -DUSE_QNNPACK -DUSE_PYTORCH_QNNPACK -DUSE_XNNPACK -DSYMBOLICATE_MOBILE_DEBUG_HANDLE -DEDGE_PROFILER_USE_KINETO -O2 -fPIC -Wno-narrowing -Wall -Wextra -Werror=return-type -Wno-missing-field-initializers -Wno-type-limits -Wno-array-bounds -Wno-unknown-pragmas -Wno-sign-compare -Wno-unused-parameter -Wno-unused-variable -Wno-unused-function -Wno-unused-result -Wno-unused-local-typedefs -Wno-strict-overflow -Wno-strict-aliasing -Wno-error=deprecated-declarations -Wno-stringop-overflow -Wno-psabi -Wno-error=pedantic -Wno-error=redundant-decls -Wno-error=old-style-cast -fdiagnostics-color=always -faligned-new -Wno-unused-but-set-variable -Wno-maybe-uninitialized -fno-math-errno -fno-trapping-math -Werror=format -Wno-stringop-overflow, LAPACK_INFO=mkl, PERF_WITH_AVX=1, PERF_WITH_AVX2=1, PERF_WITH_AVX512=1, TORCH_VERSION=1.10.1, USE_CUDA=ON, USE_CUDNN=ON, USE_EXCEPTION_PTR=1, USE_GFLAGS=OFF, USE_GLOG=OFF, USE_MKL=ON, USE_MKLDNN=ON, USE_MPI=OFF, USE_NCCL=ON, USE_NNPACK=ON, USE_OPENMP=ON,

TorchVision: 0.11.2 OpenCV: 4.5.5 MMCV: 1.4.0 MMCV Compiler: GCC 7.3 MMCV CUDA Compiler: 11.3 MMDetection: 2.20.0 MMDetection3D: 0.11.0+399bda0

Have you meet this problem?

mljack commented 2 years ago

did you run pip install -e . in tranfusion folder?

lijunnankman commented 2 years ago

@mljack @XuyangBai Thanks for replying. when i run pip install -e . in transfusion folder,

The following error occurred:

image

XuyangBai commented 2 years ago

Hi, can you check this issue for the solution? https://github.com/open-mmlab/mmdetection3d/issues/362

lijunnankman commented 2 years ago

@XuyangBai Thank you! I have fixed it.

2460707925 commented 1 year ago

@XuyangBai Thank you! I have fixed it. how do you solve it ,i meet the same problem

lijunnankman commented 1 year ago

@2460707925 Maybe you can see here:https://github.com/open-mmlab/mmdetection3d/issues/362#issuecomment-1104959006

2460707925 commented 1 year ago

@XuyangBai Thank you! I have fixed it. how do you solve it ,i meet the same problem

I have sovled it ,just change the code from

coors_map.indexput(coors_id_argsort, coors_map_sorted);

to

coors_map.indexput({coors_id_argsort}, coors_map_sorted);

because pytorch indexput the type of the first argument should be tuple ,and in c++ the tuple is { ... }