mmsegmentation
mmsegmentation copied to clipboard
A bug in tools/analysis_tools/get_flops.py
Thanks for your error report and we appreciate it a lot.
Checklist
- I have searched related issues but cannot get the expected help.
- The bug has not been fixed in the latest version.
Describe the bug (ValueError: "input_shape" and "inputs" cannot be both set.) occurs while running tools/analysis_tools/get_flops.py
Reproduction
- What command or script did you run?
python tools/analysis_tools/get_flops.py config.py
or
python tools/analysis_tools/get_flops.py config.py --shape (512, 512)
- Did you make any modifications on the code or config? Did you understand what you have modified? no
- What dataset did you use? customdataset
Environment
- Please run
python mmseg/utils/collect_env.py
to collect necessary environment information and paste it here.
sys.platform: win32 Python: 3.9.0 (default, Nov 15 2020, 08:30:55) [MSC v.1916 64 bit (AMD64)] CUDA available: True numpy_random_seed: 2147483648 GPU 0: NVIDIA GeForce RTX 4080 CUDA_HOME: D:\Program Files\NVIDAI GPU Computing Toolkit\CUDA\v11.8 NVCC: Cuda compilation tools, release 11.8, V11.8.89 MSVC: 用于 x64 的 Microsoft (R) C/C++ 优化编译器 19.35.32216.1 版 GCC: n/a PyTorch: 2.0.0+cu118 PyTorch compiling details: PyTorch built with:
- C++ Version: 199711
- MSVC 193431937
- Intel(R) Math Kernel Library Version 2020.0.2 Product Build 20200624 for Intel(R) 64 architecture applications
- Intel(R) MKL-DNN v2.7.3 (Git Hash 6dbeffbae1f23cbbeae17adb7b5b13f1f37c080e)
- OpenMP 2019
- LAPACK is enabled (usually provided by MKL)
- CPU capability usage: AVX2
- CUDA Runtime 11.8
- 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_90,code=sm_90;-gencode;arch=compute_37,code=compute_37
- CuDNN 8.7
- Magma 2.5.4
- Build settings: BLAS_INFO=mkl, BUILD_TYPE=Release, CUDA_VERSION=11.8, CUDNN_VERSION=8.7.0, CXX_COMPILER=C:/actions-runner/_work/pytorch/pytorch/builder/windows/tmp_bin/sccache-cl.exe, CXX_FLAGS=/DWIN32 /D_WINDOWS /GR /EHsc /w /bigobj /FS -DUSE_PTHREADPOOL -DNDEBUG -DUSE_KINETO -DLIBKINETO_NOCUPTI -DLIBKINETO _NOROCTRACER -DUSE_FBGEMM -DUSE_XNNPACK -DSYMBOLICATE_MOBILE_DEBUG_HANDLE, LAPACK_INFO=mkl, PERF_WITH_AVX=1, PERF_WITH_AVX2=1, PERF_WITH_AVX512=1, TORCH_DISABLE_GPU_ASSERTS=OFF, TORCH_VERSION=2.0.0, USE_CUDA=ON, USE_CUDNN=ON, USE_EXCEPTION_PTR=1, USE_GFLAGS=OFF, USE_GLOG=OFF, USE_MKL=ON, USE_MKLDNN=ON, USE_MPI=O FF, USE_NCCL=OFF, USE_NNPACK=OFF, USE_OPENMP=ON, USE_ROCM=OFF,
TorchVision: 0.15.1+cu118 OpenCV: 4.7.0 MMEngine: 0.7.2 MMSegmentation: 1.0.0+462fad8
Error traceback
If applicable, paste the error trackback here.
d:\pythonproject\mmsegmentation\mmseg\models\builder.py:36: UserWarning: ``build_loss`` would be deprecated soon, please use ``mmseg.registry.MODELS.build()``
warnings.warn('``build_loss`` would be deprecated soon, please use '
Traceback (most recent call last):
File "D:\Pythonproject\mmsegmentation\tools\analysis_tools\get_flops.py", line 124, in <module>
main()
File "D:\Pythonproject\mmsegmentation\tools\analysis_tools\get_flops.py", line 104, in main
result = inference(args, logger)
File "D:\Pythonproject\mmsegmentation\tools\analysis_tools\get_flops.py", line 87, in inference
outputs = get_model_complexity_info(
File "d:\pythonproject\mmengine\mmengine\analysis\print_helper.py", line 725, in get_model_complexity_info
raise ValueError('"input_shape" and "inputs" cannot be both set.')
ValueError: "input_shape" and "inputs" cannot be both set.
Bug fix
If you have already identified the reason, you can provide the information here. If you are willing to create a PR to fix it, please also leave a comment here and that would be much appreciated!
It seems that the issue has been fixed in the latest version. Please update your mmseg to the latest version.
@xiexinch @AI-Tianlong @ZJLauu I have the same bug and I use the latest version. How to fix
the bug is :
---->
Icommented this part of the code:
or
the result is
I meet the same error
@xiexinch @AI-Tianlong @ZJLauu I have the same bug and I use the latest version. How to fix
the bug is :
---->
Icommented this part of the code:
or
the result is
hi,I also tried my model through the code you modified. The 4-channel input of my model still reported an error after changing the inputs to none. Could it be that the 4-channel cannot be calculated?