MichaelFan01 / STDC-Seg

Source Code of our CVPR2021 paper "Rethinking BiSeNet For Real-time Semantic Segmentation"
MIT License
703 stars 131 forks source link

Cannot run evaluation.py #58

Closed drCJH closed 2 years ago

drCJH commented 2 years ago

Traceback (most recent call last): File "/usr/lib/python3/dist-packages/torch/utils/cpp_extension.py", line 1666, in _run_ninja_build subprocess.run( File "/usr/lib/python3.8/subprocess.py", line 516, in run raise CalledProcessError(retcode, process.args, subprocess.CalledProcessError: Command '['ninja', '-v']' returned non-zero exit status 1.

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "evaluation.py", line 5, in from models.model_stages import BiSeNet File "[path]/models/model_stages.py", line 12, in from modules.bn import InPlaceABNSync as BatchNorm2d File "[path]/modules/init.py", line 1, in from .bn import ABN, InPlaceABN, InPlaceABNSync File "[path]/methods/STDC-Seg/modules/bn.py", line 10, in from .functions import * File "[path]/methods/STDC-Seg/modules/functions.py", line 10, in _backend = load(name="inplace_abn", File "/usr/lib/python3/dist-packages/torch/utils/cpp_extension.py", line 1080, in load return _jit_compile( File "/usr/lib/python3/dist-packages/torch/utils/cpp_extension.py", line 1293, in _jit_compile _write_ninja_file_and_build_library( File "/usr/lib/python3/dist-packages/torch/utils/cpp_extension.py", line 1405, in _write_ninja_file_and_build_library _run_ninja_build( File "/usr/lib/python3/dist-packages/torch/utils/cpp_extension.py", line 1682, in _run_ninja_build raise RuntimeError(message) from e RuntimeError: Error building extension 'inplace_abn': [1/2] c++ -MMD -MF inplace_abn.o.d -DTORCH_EXTENSION_NAME=inplace_abn -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE=\"_gcc\" -DPYBIND11_STDLIB=\"_libstdcpp\" -DPYBIND11_BUILD_ABI=\"_cxxabi1013\" -isystem /usr/lib/python3/dist-packages/torch/include -isystem /usr/lib/python3/dist-packages/torch/include/torch/csrc/api/include -isystem /usr/lib/python3/dist-packages/torch/include/TH -isystem /usr/lib/python3/dist-packages/torch/include/THC -isystem /usr/include/python3.8 -D_GLIBCXX_USE_CXX11_ABI=1 -fPIC -std=c++14 -O3 -c [path]/modules/src/inplace_abn.cpp -o inplace_abn.o FAILED: inplace_abn.o c++ -MMD -MF inplace_abn.o.d -DTORCH_EXTENSION_NAME=inplace_abn -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE=\"_gcc\" -DPYBIND11_STDLIB=\"_libstdcpp\" -DPYBIND11_BUILD_ABI=\"_cxxabi1013\" -isystem /usr/lib/python3/dist-packages/torch/include -isystem /usr/lib/python3/dist-packages/torch/include/torch/csrc/api/include -isystem /usr/lib/python3/dist-packages/torch/include/TH -isystem /usr/lib/python3/dist-packages/torch/include/THC -isystem /usr/include/python3.8 -D_GLIBCXX_USE_CXX11_ABI=1 -fPIC -std=c++14 -O3 -c [path]/modules/src/inplace_abn.cpp -o inplace_abn.o In file included from /usr/lib/python3/dist-packages/torch/include/torch/csrc/api/include/torch/python.h:12, from /usr/lib/python3/dist-packages/torch/include/torch/extension.h:6, from [path]/STDC-Seg/modules/src/inplace_abn.cpp:1: /usr/lib/python3/dist-packages/torch/include/torch/csrc/utils/pybind.h:6:10: fatal error: pybind11/pybind11.h: No such file or directory 6 | #include <pybind11/pybind11.h> | ^~~~~ compilation terminated. ninja: build stopped: subcommand failed.

drCJH commented 2 years ago

Ok, so I found out it was because I hadn't installed the C++ pybind11 library. Pip only installs the python library and on Ubuntu 20.04 it doesn't seem to be available through apt-get so I had to clone the pybind github repo and make it myself. Works fine now.

DuyguSerbes commented 2 years ago

Could you describe how to solve this problem step by step? Which repo did you used?

drCJH commented 2 years ago

The 2nd answer here has the details: https://stackoverflow.com/questions/54704599/how-to-apt-install-python-pybind11