ifzhang / FairMOT

[IJCV-2021] FairMOT: On the Fairness of Detection and Re-Identification in Multi-Object Tracking
MIT License
4.01k stars 933 forks source link

Build DCNv2 on docker image: 10.2-cudnn7-devel-ubuntu18.04 #267

Open mainguyenanhvu opened 4 years ago

mainguyenanhvu commented 4 years ago

I run ./make.sh. inside a docker file. It announced:

Step 28/38 : RUN sh make.sh ---> Running in 3b5541e51fe3 No CUDA runtime is found, using CUDA_HOME='/usr/local/cuda' running build running build_ext building '_ext' extension creating build/temp.linux-x86_64-2.7 creating build/temp.linux-x86_64-2.7/docker creating build/temp.linux-x86_64-2.7/docker/src creating build/temp.linux-x86_64-2.7/docker/src/DCNv2 creating build/temp.linux-x86_64-2.7/docker/src/DCNv2/src creating build/temp.linux-x86_64-2.7/docker/src/DCNv2/src/cpu g++ -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-rrBAp6/python2.7-2.7.17=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/docker/src/DCNv2/src -I/usr/local/lib/python2.7/dist-packages/torch/include -I/usr/local/lib/python2.7/dist-packages/torch/include/torch/csrc/api/include -I/usr/local/lib/python2.7/dist-packages/torch/include/TH -I/usr/local/lib/python2.7/dist-packages/torch/include/THC -I/usr/include/python2.7 -c /docker/src/DCNv2/src/vision.cpp -o build/temp.linux-x86_64-2.7/docker/src/DCNv2/src/vision.o -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=_ext -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++11 g++ -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-rrBAp6/python2.7-2.7.17=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/docker/src/DCNv2/src -I/usr/local/lib/python2.7/dist-packages/torch/include -I/usr/local/lib/python2.7/dist-packages/torch/include/torch/csrc/api/include -I/usr/local/lib/python2.7/dist-packages/torch/include/TH -I/usr/local/lib/python2.7/dist-packages/torch/include/THC -I/usr/include/python2.7 -c /docker/src/DCNv2/src/cpu/dcn_v2_cpu.cpp -o build/temp.linux-x86_64-2.7/docker/src/DCNv2/src/cpu/dcn_v2_cpu.o -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=_ext -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++11 g++ -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-rrBAp6/python2.7-2.7.17=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/docker/src/DCNv2/src -I/usr/local/lib/python2.7/dist-packages/torch/include -I/usr/local/lib/python2.7/dist-packages/torch/include/torch/csrc/api/include -I/usr/local/lib/python2.7/dist-packages/torch/include/TH -I/usr/local/lib/python2.7/dist-packages/torch/include/THC -I/usr/include/python2.7 -c /docker/src/DCNv2/src/cpu/dcn_v2_im2col_cpu.cpp -o build/temp.linux-x86_64-2.7/docker/src/DCNv2/src/cpu/dcn_v2_im2col_cpu.o -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=_ext -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++11 g++ -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-rrBAp6/python2.7-2.7.17=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/docker/src/DCNv2/src -I/usr/local/lib/python2.7/dist-packages/torch/include -I/usr/local/lib/python2.7/dist-packages/torch/include/torch/csrc/api/include -I/usr/local/lib/python2.7/dist-packages/torch/include/TH -I/usr/local/lib/python2.7/dist-packages/torch/include/THC -I/usr/include/python2.7 -c /docker/src/DCNv2/src/cpu/dcn_v2_psroi_pooling_cpu.cpp -o build/temp.linux-x86_64-2.7/docker/src/DCNv2/src/cpu/dcn_v2_psroi_pooling_cpu.o -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=_ext -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++11 In file included from /usr/local/lib/python2.7/dist-packages/torch/include/ATen/ATen.h:9:0, from /docker/src/DCNv2/src/cpu/dcn_v2_psroi_pooling_cpu.cpp:15: /docker/src/DCNv2/src/cpu/dcn_v2_psroi_pooling_cpu.cpp: In lambda function: /usr/local/lib/python2.7/dist-packages/torch/include/ATen/Dispatch.h:150:56: warning: 'c10::ScalarType detail::scalar_type(const at::DeprecatedTypeProperties&)' is deprecated [-Wdeprecated-declarations] at::ScalarType _st = ::detail::scalar_type(the_type); \ ^ /docker/src/DCNv2/src/cpu/dcn_v2_psroi_pooling_cpu.cpp:324:3: note: in expansion of macro 'AT_DISPATCH_FLOATING_TYPES' AT_DISPATCH_FLOATING_TYPES(input.type(), "dcn_v2_psroi_pooling_cpu_forward", [&] { ^~~~~~ /usr/local/lib/python2.7/dist-packages/torch/include/ATen/Dispatch.h:78:23: note: declared here inline at::ScalarType scalar_type(const at::DeprecatedTypeProperties &t) { ^~~ /docker/src/DCNv2/src/cpu/dcn_v2_psroi_pooling_cpu.cpp: In lambda function: /usr/local/lib/python2.7/dist-packages/torch/include/ATen/Dispatch.h:150:56: warning: 'c10::ScalarType detail::scalar_type(const at::DeprecatedTypeProperties&)' is deprecated [-Wdeprecated-declarations] at::ScalarType _st = ::detail::scalar_type(the_type); \ ^ /docker/src/DCNv2/src/cpu/dcn_v2_psroi_pooling_cpu.cpp:398:3: note: in expansion of macro 'AT_DISPATCH_FLOATING_TYPES' AT_DISPATCH_FLOATING_TYPES(out_grad.type(), "dcn_v2_psroi_pooling_cpu_backward", [&] { ^~~~~~ /usr/local/lib/python2.7/dist-packages/torch/include/ATen/Dispatch.h:78:23: note: declared here inline at::ScalarType scalar_type(const at::DeprecatedTypeProperties &t) { ^~~ creating build/lib.linux-x86_64-2.7 x86_64-linux-gnu-g++ -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-rrBAp6/python2.7-2.7.17=. -fstack-protector-strong -Wformat -Werror=format-security -Wl,-Bsymbolic-functions -Wl,-z,relro -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-rrBAp6/python2.7-2.7.17=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC build/temp.linux-x86_64-2.7/docker/src/DCNv2/src/vision.o build/temp.linux-x86_64-2.7/docker/src/DCNv2/src/cpu/dcn_v2_cpu.o build/temp.linux-x86_64-2.7/docker/src/DCNv2/src/cpu/dcn_v2_im2col_cpu.o build/temp.linux-x86_64-2.7/docker/src/DCNv2/src/cpu/dcn_v2_psroi_pooling_cpu.o -o build/lib.linux-x86_64-2.7/_ext.so running develop running egg_info writing DCNv2.egg-info/PKG-INFO writing top-level names to DCNv2.egg-info/top_level.txt writing dependency_links to DCNv2.egg-info/dependency_links.txt reading manifest file 'DCNv2.egg-info/SOURCES.txt' writing manifest file 'DCNv2.egg-info/SOURCES.txt' running build_ext copying build/lib.linux-x86_64-2.7/_ext.so -> Creating /usr/local/lib/python2.7/dist-packages/DCNv2.egg-link (link to .) Adding DCNv2 0.1 to easy-install.pth file Installed /docker/src/DCNv2 Processing dependencies for DCNv2==0.1 Finished processing dependencies for DCNv2==0.1 Removing intermediate container 3b5541e51fe3 ---> a7f4ac308d62`

However, when run DCNv2, there is an error:

File "/docker/src/lib/tracker/multitracker.py", line 8, in from models.model import create_model, load_model File "/docker/src/lib/models/model.py", line 8, in from .networks.pose_dla_dcn import get_pose_net as get_dla_dcn File "/docker/src/lib/models/networks/pose_dla_dcn.py", line 15, in from .DCNv2_new.dcn_v2 import DCN File "/docker/src/lib/models/networks/DCNv2_new/dcn_v2.py", line 13, in import _ext as _backend ModuleNotFoundError: No module named '_ext'`

Can anyone meet it? Please help me.

Thank you so much.

austinmw commented 4 years ago

What version of PyTorch are you running? You may have to use an updated DCNv2 fork such as https://github.com/jinfagang/DCNv2_latest

austinmw commented 3 years ago

Also to docker build with cuda you need to have nvidia-container-runtime installed and modify your default runtime:

{
    "runtimes": {
        "nvidia": {
            "path": "nvidia-container-runtime",
            "runtimeArgs": []
        }
    },
    "default-runtime": "nvidia"
}
fly2008begin commented 3 years ago

您好 我想个初级的问题 这个dockerfile怎么用呀 开头的IMAGE_NAME 要传什么呢 什么也不写的的说非法过去不去呀

hulkwork commented 3 years ago

For DCN_v2, I also have an error when i try to build with docker that why I build DCN_v2 when I run.

https://github.com/hulkwork/FairMOT

I modify _init_paths.py

fly2008begin commented 3 years ago

For DCN_v2, I also have an error when i try to build with docker that why I build DCN_v2 when I run.

https://github.com/hulkwork/FairMOT

I modify _init_paths.py

I see thx

hulkwork commented 3 years ago

I run ./make.sh. inside a docker file. It announced:

Step 28/38 : RUN sh make.sh

---> Running in 3b5541e51fe3

No CUDA runtime is found, using CUDA_HOME='/usr/local/cuda'

running build

running build_ext

building '_ext' extension

creating build/temp.linux-x86_64-2.7

creating build/temp.linux-x86_64-2.7/docker

creating build/temp.linux-x86_64-2.7/docker/src

creating build/temp.linux-x86_64-2.7/docker/src/DCNv2

creating build/temp.linux-x86_64-2.7/docker/src/DCNv2/src

creating build/temp.linux-x86_64-2.7/docker/src/DCNv2/src/cpu

g++ -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-rrBAp6/python2.7-2.7.17=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/docker/src/DCNv2/src -I/usr/local/lib/python2.7/dist-packages/torch/include -I/usr/local/lib/python2.7/dist-packages/torch/include/torch/csrc/api/include -I/usr/local/lib/python2.7/dist-packages/torch/include/TH -I/usr/local/lib/python2.7/dist-packages/torch/include/THC -I/usr/include/python2.7 -c /docker/src/DCNv2/src/vision.cpp -o build/temp.linux-x86_64-2.7/docker/src/DCNv2/src/vision.o -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=_ext -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++11

g++ -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-rrBAp6/python2.7-2.7.17=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/docker/src/DCNv2/src -I/usr/local/lib/python2.7/dist-packages/torch/include -I/usr/local/lib/python2.7/dist-packages/torch/include/torch/csrc/api/include -I/usr/local/lib/python2.7/dist-packages/torch/include/TH -I/usr/local/lib/python2.7/dist-packages/torch/include/THC -I/usr/include/python2.7 -c /docker/src/DCNv2/src/cpu/dcn_v2_cpu.cpp -o build/temp.linux-x86_64-2.7/docker/src/DCNv2/src/cpu/dcn_v2_cpu.o -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=_ext -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++11

g++ -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-rrBAp6/python2.7-2.7.17=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/docker/src/DCNv2/src -I/usr/local/lib/python2.7/dist-packages/torch/include -I/usr/local/lib/python2.7/dist-packages/torch/include/torch/csrc/api/include -I/usr/local/lib/python2.7/dist-packages/torch/include/TH -I/usr/local/lib/python2.7/dist-packages/torch/include/THC -I/usr/include/python2.7 -c /docker/src/DCNv2/src/cpu/dcn_v2_im2col_cpu.cpp -o build/temp.linux-x86_64-2.7/docker/src/DCNv2/src/cpu/dcn_v2_im2col_cpu.o -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=_ext -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++11

g++ -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-rrBAp6/python2.7-2.7.17=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/docker/src/DCNv2/src -I/usr/local/lib/python2.7/dist-packages/torch/include -I/usr/local/lib/python2.7/dist-packages/torch/include/torch/csrc/api/include -I/usr/local/lib/python2.7/dist-packages/torch/include/TH -I/usr/local/lib/python2.7/dist-packages/torch/include/THC -I/usr/include/python2.7 -c /docker/src/DCNv2/src/cpu/dcn_v2_psroi_pooling_cpu.cpp -o build/temp.linux-x86_64-2.7/docker/src/DCNv2/src/cpu/dcn_v2_psroi_pooling_cpu.o -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=_ext -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++11

In file included from /usr/local/lib/python2.7/dist-packages/torch/include/ATen/ATen.h:9:0,

             from /docker/src/DCNv2/src/cpu/dcn_v2_psroi_pooling_cpu.cpp:15:

/docker/src/DCNv2/src/cpu/dcn_v2_psroi_pooling_cpu.cpp: In lambda function:

/usr/local/lib/python2.7/dist-packages/torch/include/ATen/Dispatch.h:150:56: warning: 'c10::ScalarType detail::scalar_type(const at::DeprecatedTypeProperties&)' is deprecated [-Wdeprecated-declarations]

 at::ScalarType _st = ::detail::scalar_type(the_type);                    \

                                                    ^

/docker/src/DCNv2/src/cpu/dcn_v2_psroi_pooling_cpu.cpp:324:3: note: in expansion of macro 'AT_DISPATCH_FLOATING_TYPES'

AT_DISPATCH_FLOATING_TYPES(input.type(), "dcn_v2_psroi_pooling_cpu_forward", [&] {

^~~~~~

/usr/local/lib/python2.7/dist-packages/torch/include/ATen/Dispatch.h:78:23: note: declared here

inline at::ScalarType scalar_type(const at::DeprecatedTypeProperties &t) {

                   ^~~~~~~~~~~

/docker/src/DCNv2/src/cpu/dcn_v2_psroi_pooling_cpu.cpp: In lambda function:

/usr/local/lib/python2.7/dist-packages/torch/include/ATen/Dispatch.h:150:56: warning: 'c10::ScalarType detail::scalar_type(const at::DeprecatedTypeProperties&)' is deprecated [-Wdeprecated-declarations]

 at::ScalarType _st = ::detail::scalar_type(the_type);                    \

                                                    ^

/docker/src/DCNv2/src/cpu/dcn_v2_psroi_pooling_cpu.cpp:398:3: note: in expansion of macro 'AT_DISPATCH_FLOATING_TYPES'

AT_DISPATCH_FLOATING_TYPES(out_grad.type(), "dcn_v2_psroi_pooling_cpu_backward", [&] {

^~~~~~

/usr/local/lib/python2.7/dist-packages/torch/include/ATen/Dispatch.h:78:23: note: declared here

inline at::ScalarType scalar_type(const at::DeprecatedTypeProperties &t) {

                   ^~~~~~~~~~~

creating build/lib.linux-x86_64-2.7

x86_64-linux-gnu-g++ -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-rrBAp6/python2.7-2.7.17=. -fstack-protector-strong -Wformat -Werror=format-security -Wl,-Bsymbolic-functions -Wl,-z,relro -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-rrBAp6/python2.7-2.7.17=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC build/temp.linux-x86_64-2.7/docker/src/DCNv2/src/vision.o build/temp.linux-x86_64-2.7/docker/src/DCNv2/src/cpu/dcn_v2_cpu.o build/temp.linux-x86_64-2.7/docker/src/DCNv2/src/cpu/dcn_v2_im2col_cpu.o build/temp.linux-x86_64-2.7/docker/src/DCNv2/src/cpu/dcn_v2_psroi_pooling_cpu.o -o build/lib.linux-x86_64-2.7/_ext.so

running develop

running egg_info

writing DCNv2.egg-info/PKG-INFO

writing top-level names to DCNv2.egg-info/top_level.txt

writing dependency_links to DCNv2.egg-info/dependency_links.txt

reading manifest file 'DCNv2.egg-info/SOURCES.txt'

writing manifest file 'DCNv2.egg-info/SOURCES.txt'

running build_ext

copying build/lib.linux-x86_64-2.7/_ext.so ->

Creating /usr/local/lib/python2.7/dist-packages/DCNv2.egg-link (link to .)

Adding DCNv2 0.1 to easy-install.pth file

Installed /docker/src/DCNv2

Processing dependencies for DCNv2==0.1

Finished processing dependencies for DCNv2==0.1

Removing intermediate container 3b5541e51fe3

---> a7f4ac308d62`

However, when run DCNv2, there is an error:

File "/docker/src/lib/tracker/multitracker.py", line 8, in

from models.model import create_model, load_model

File "/docker/src/lib/models/model.py", line 8, in

from .networks.pose_dla_dcn import get_pose_net as get_dla_dcn

File "/docker/src/lib/models/networks/pose_dla_dcn.py", line 15, in

from .DCNv2_new.dcn_v2 import DCN

File "/docker/src/lib/models/networks/DCNv2_new/dcn_v2.py", line 13, in

import _ext as _backend

ModuleNotFoundError: No module named '_ext'`

Can anyone meet it? Please help me.

Thank you so much.

Hello I make a Dockerfile that will work with current version of DCN_v2 I put to build with nvidia runtime

CDM nvidia-smi
UsersNGT commented 3 years ago

您好 我想个初级的问题 这个dockerfile怎么用呀 开头的IMAGE_NAME 要传什么呢 什么也不写的的说非法过去不去呀

你好,我也刚接触docker ,你弄明白了么?所以要传什么啊。。