์ฌ๋ฌ๋ถ, ์๋
ํ์ธ์,
์ต๊ทผ์ ๋์ปค๋ฅผ ํตํด ๊ฐ์ง๊ธฐ๋ฅผ ์ค์นํ๋ ๋ฐ ๋ฌธ์ ๊ฐ ์์ต๋๋ค. ๋๋ ์ง๊ธ ๋ค์๊ณผ ๊ฐ์ด ์คํจํฉ๋๋ค.
/usr/local/caffe2_build/include/caffe2/core/tensor.h:687:17: ์ฐธ๊ณ : ํ๋ณด๋ 1๊ฐ์ ์ธ์๋ฅผ ์์ํ๊ณ 0์ ์ ๊ณต๋จ
/detectron/detectron/ops/zero_even_op.cc:33:27: ์ค๋ฅ: 'class caffe2::Tensor<:cpucontext i="7">'์ 'numel'์ด๋ผ๋ ๋ฉค๋ฒ๊ฐ ์์ต๋๋ค.
for (์๋ i = 0; i < Y->numel(); i += 2) {
์ฌ๊ธฐ์์ ๊ด๋ จ ๋ฌธ์ ๋ฅผ ์ฐพ์์ต๋๋ค.
https://github.com/facebookresearch/Detectron/issues/732
ํ์ง๋ง ๋ํ
ํธ๋ก ์ด ๋ฆฌํฌ์งํ ๋ฆฌ์์ ์ง์ ์ค์นํ๊ธฐ ๋๋ฌธ์ ์์ ์ฌํญ์ ์ฌ์ฉํ ์ ์์ต๋๋ค. ์ ์ฅ์๋ฅผ ๋ณ๊ฒฝํด ์ฃผ์๊ฒ ์ต๋๊น?
๋ฏธ๋ฆฌ ๊ฐ์ฌ๋๋ฆฝ๋๋ค.
์๋ฆญ
์๋ ํ์ธ์, ์ ๋ Dockerfile๊ณผ ๋์ผํ ๋ฌธ์ ๊ฐ ์์ต๋๋ค. CUDA ๋ฒ์ ๊ณผ ๊ด๋ จ์ด ์๋์ง ๊ถ๊ธํฉ๋๋ค.
์ง๊ธ ์ปดํ์ผ์ด ์ค๋จ๋ฉ๋๋ค. ์ด๊ฒ์ ์ป๊ธฐ:
๋์ปค ํ๋ธ์ ์ด๋ ๊ณณ์์๋ ์ง์๋๋ ์๋ํ ๋น๋๊ฐ ์์ต๋๊น?
๋ด ์์คํ ์๋ ์ ์๋ํ๋ CUDA๋ฅผ ์ฌ์ฉํ๋ ๋ค๋ฅธ ์ปจํ ์ด๋๊ฐ ์์ต๋๋ค.
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- CUDA detected: 9.0
-- Added CUDA NVCC flags for: sm_30 sm_35 sm_50 sm_52 sm_60 sm_61 sm_70
-- Found libcuda: /usr/local/cuda/lib64/stubs/libcuda.so
-- Found libnvrtc: /usr/local/cuda/lib64/libnvrtc.so
-- Found CUDNN: /usr/include
-- Found cuDNN: v7.0.5 (include: /usr/include, library: /usr/lib/x86_64-linux-gnu/libcudnn.so)
-- Summary:
-- CMake version : 3.5.1
-- CMake command : /usr/bin/cmake
-- System name : Linux
-- C++ compiler : /usr/bin/c++
-- C++ compiler version : 5.4.0
-- CXX flags : -std=c++11 -O2 -fPIC -Wno-narrowing
-- Caffe2 version : 0.8.1
-- Caffe2 include path : /usr/local/caffe2_build/include
-- Have CUDA : TRUE
-- CUDA version : 9.0
-- CuDNN version : 7.0.5
-- Configuring done
-- Generating done
-- Build files have been written to: /detectron/build
make[1]: Entering directory '/detectron/build'
make[2]: Entering directory '/detectron/build'
make[3]: Entering directory '/detectron/build'
make[3]: Entering directory '/detectron/build'
[ 20%] Building NVCC (Device) object CMakeFiles/caffe2_detectron_custom_ops_gpu.dir/detectron/ops/caffe2_detectron_custom_ops_gpu_generated_zero_even_op.cu.o
Scanning dependencies of target caffe2_detectron_custom_ops
make[3]: Leaving directory '/detectron/build'
make[3]: Entering directory '/detectron/build'
[ 40%] Building CXX object CMakeFiles/caffe2_detectron_custom_ops.dir/detectron/ops/zero_even_op.cc.o
In file included from /usr/local/caffe2_build/include/caffe2/core/allocator.h:22:0,
from /usr/local/caffe2_build/include/caffe2/core/context.h:25,
from /detectron/detectron/ops/zero_even_op.h:20,
from /detectron/detectron/ops/zero_even_op.cc:17:
/detectron/detectron/ops/zero_even_op.cc: In member function 'bool caffe2::ZeroEvenOp<T, Context>::RunOnDevice() [with T = float; Context = caffe2::CPUContext]':
/detectron/detectron/ops/zero_even_op.cc:25:23: error: no matching function for call to 'caffe2::Tensor<caffe2::CPUContext>::dim() const'
CAFFE_ENFORCE(X.dim() == 1);
^
In file included from /usr/local/caffe2_build/include/caffe2/core/net.h:34:0,
from /usr/local/caffe2_build/include/caffe2/core/operator.h:29,
from /detectron/detectron/ops/zero_even_op.h:21,
from /detectron/detectron/ops/zero_even_op.cc:17:
/usr/local/caffe2_build/include/caffe2/core/tensor.h:687:17: note: candidate: caffe2::TIndex caffe2::Tensor<Context>::dim(int) const [with Context = caffe2::CPUContext; caffe2::TIndex = long int]
inline TIndex dim(const int i) const {
^
/usr/local/caffe2_build/include/caffe2/core/tensor.h:687:17: note: candidate expects 1 argument, 0 provided
/detectron/detectron/ops/zero_even_op.cc:33:27: error: 'class caffe2::Tensor<caffe2::CPUContext>' has no member named 'numel'
for (auto i = 0; i < Y->numel(); i += 2) {
^
CMakeFiles/caffe2_detectron_custom_ops.dir/build.make:62: recipe for target 'CMakeFiles/caffe2_detectron_custom_ops.dir/detectron/ops/zero_even_op.cc.o' failed
make[3]: *** [CMakeFiles/caffe2_detectron_custom_ops.dir/detectron/ops/zero_even_op.cc.o] Error 1
make[3]: Leaving directory '/detectron/build'
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/caffe2_detectron_custom_ops.dir/all' failed
make[2]: *** [CMakeFiles/caffe2_detectron_custom_ops.dir/all] Error 2
make[2]: *** Waiting for unfinished jobs....
Scanning dependencies of target caffe2_detectron_custom_ops_gpu
make[3]: Leaving directory '/detectron/build'
make[3]: Entering directory '/detectron/build'
[ 60%] Building CXX object CMakeFiles/caffe2_detectron_custom_ops_gpu.dir/detectron/ops/zero_even_op.cc.o
In file included from /usr/local/caffe2_build/include/caffe2/core/allocator.h:22:0,
from /usr/local/caffe2_build/include/caffe2/core/context.h:25,
from /detectron/detectron/ops/zero_even_op.h:20,
from /detectron/detectron/ops/zero_even_op.cc:17:
/detectron/detectron/ops/zero_even_op.cc: In member function 'bool caffe2::ZeroEvenOp<T, Context>::RunOnDevice() [with T = float; Context = caffe2::CPUContext]':
/detectron/detectron/ops/zero_even_op.cc:25:23: error: no matching function for call to 'caffe2::Tensor<caffe2::CPUContext>::dim() const'
CAFFE_ENFORCE(X.dim() == 1);
^
In file included from /usr/local/caffe2_build/include/caffe2/core/net.h:34:0,
from /usr/local/caffe2_build/include/caffe2/core/operator.h:29,
from /detectron/detectron/ops/zero_even_op.h:21,
from /detectron/detectron/ops/zero_even_op.cc:17:
/usr/local/caffe2_build/include/caffe2/core/tensor.h:687:17: note: candidate: caffe2::TIndex caffe2::Tensor<Context>::dim(int) const [with Context = caffe2::CPUContext; caffe2::TIndex = long int]
inline TIndex dim(const int i) const {
^
/usr/local/caffe2_build/include/caffe2/core/tensor.h:687:17: note: candidate expects 1 argument, 0 provided
/detectron/detectron/ops/zero_even_op.cc:33:27: error: 'class caffe2::Tensor<caffe2::CPUContext>' has no member named 'numel'
for (auto i = 0; i < Y->numel(); i += 2) {
^
CMakeFiles/caffe2_detectron_custom_ops_gpu.dir/build.make:69: recipe for target 'CMakeFiles/caffe2_detectron_custom_ops_gpu.dir/detectron/ops/zero_even_op.cc.o' failed
make[3]: *** [CMakeFiles/caffe2_detectron_custom_ops_gpu.dir/detectron/ops/zero_even_op.cc.o] Error 1
make[3]: Leaving directory '/detectron/build'
CMakeFiles/Makefile2:104: recipe for target 'CMakeFiles/caffe2_detectron_custom_ops_gpu.dir/all' failed
make[2]: Leaving directory '/detectron/build'
make[2]: *** [CMakeFiles/caffe2_detectron_custom_ops_gpu.dir/all] Error 2
Makefile:127: recipe for target 'all' failed
make[1]: Leaving directory '/detectron/build'
make[1]: *** [all] Error 2
Makefile:13: recipe for target 'ops' failed
make: *** [ops] Error 2
The command '/bin/sh -c make ops' returned a non-zero code: 2
์ต์ ๋ง์คํฐ ๋์ d56e267efc92b65b8d899f1b89a7ed2bca3e5f44๋ฅผ ์ฒดํฌ์์ํ์ฌ ์๋ํ๋๋ก ํ์ต๋๋ค.
@TheNeikos , ๋๋ ๋ํ d56e267efc92b65b8d899f1b89a7ed2bca3e5f44์ ํจ๊ป ์๋ํฉ๋๋ค.
์ต์ ๋ง์คํฐ ๋์ d56e267 ์ ์ฒดํฌ์์ํ์ฌ ์๋ํ๋๋ก ํ์ต๋๋ค.
Dockerfile์์ ์๋ฏธํฉ๋๊น? ์
์์ ํด๋ก ์คํ https://github.com/facebookresearch/detectron /detectron
RUN cd /detectron && git checkout d56e267
@beatthat ๋ค ๋ง์์
@TheNeikos ๊ฐ์ฌํฉ๋๋ค! Zuckerberg๋ ๊ทํ์ ์๊ฒฌ์ด ์์์ผ๋ฉด Detectron์ ํฌ๊ธฐํ๊ณ Matterport์ ๊ตฌํ๋ง ์ฌ์ฉํ์ ๊ฒ์ด๊ธฐ ๋๋ฌธ์ ์ต์ 10,000์ ๋ก๋ฅผ ์ฃผ์ด์ผ ํฉ๋๋ค.
@manyaafonso
์ด ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ๋ ๋ฐฉ๋ฒ์ ๋ํด ๋ ์์ธํ ๊ณต์ ํด ์ฃผ์๊ฒ ์ต๋๊น?
๋๋ @TheNeikos @beatthat @francois-wellenreiter์ ์ ์์ ๋ฐ๋ฆ
๋๋ค
1. ์์ ํด๋ก ์คํ https://github.com/facebookresearch/detectron /detectron
๊ทธ๋ฆฌ๊ณ ์ฌ์ ํ ๋์ผํ ์ค๋ฅ ์ถ๋ ฅ์ด ๋ํ๋ฉ๋๋ค.
git checkout d56e267์ด ์ด์ ๋ฒ์ ์ผ๋ก ๋ณ๊ฒฝํ๋ ๋ฐ ๋์์ด ๋๋ค๊ณ ์๊ฐํฉ๋๋ค. ๊ทธ๋ฆฌ๊ณ d56e267 ์์
"/detectron/ops/zero_even_op.cc" ์ด ํ์ผ์๋
for (auto i = 0; i < Y->size(); i += 2) {
๊ทธ๋ฌ๋ ๋น๋ํ๋ ค๊ณ ํ ๋ ์ค๋ฅ ๋ฉ์์ง๊ฐ ๊ณ์ ํ์๋ฉ๋๋ค.
for (auto i = 0; i < Y->numel(); i += 2) {
^
์ ๊ฐ ์์ด๋ฒ๋ฆฐ ๊ฒ์ด ์๋์ง ์ ๋ชจ๋ฅด๊ฒ ์ต๋๋ค.
์๋ ํ์ธ์ @randf102 ,
์ค์ ๋ก Dockerfile์ ์ด ์์ ์ฌํญ์ ์ ์ฉํ๊ณ ๋น๋๊ฐ ์ฑ๊ณตํ์ต๋๋ค.
```์ฐจ์ด
diff --git a/docker/Dockerfile b/docker/Dockerfile
์ธ๋ฑ์ค 38cc0ea..c02a110 100644
--- a/docker/Dockerfile
+++ b/๋์ปค/๋์ปค ํ์ผ
@@ -10,6 +10,9 @@ ENV LD_LIBRARY_PATH /usr/local/caffe2_build/lib:${LD_LIBRARY_PATH}
# Detectron ์ ์ฅ์ ๋ณต์
์์ ํด๋ก ์คํ https://github.com/facebookresearch/detectron /detectron
+WORKDIR /๊ฒ์ถ๊ธฐ
+ ์คํ ์์ ์ฒดํฌ ์์ d56e267efc92b65b8d899f1b89a7ed2bca3e5f44
+
# Python ์ข
์์ฑ ์ค์น
์คํ pip install -r /detectron/requirements.txt
```
์๋ ํ์ธ์ @randf102 , ์์ ์ค๋ช ์ ๋ฐ๋ผ ๋ค์ ๋ถ๋ถ์ ๋ณ๊ฒฝํ์ฌ dockerfile์ ์์ ํ์ต๋๋ค.
์์ ํด๋ก ์คํ https://github.com/facebookresearch/detectron /detectron
RUN cd /detectron && git checkout d56e267
๊ทธ๋ฐ ๋ค์ Linux ํ๋กฌํํธ์์ ๋ค์์ ์ํํฉ๋๋ค.
nvidia-docker ๋น๋ -t my_detectron_image .
@francois-wellenreiter @manyaafonso
๋์ ์ฃผ์
์ ๊ฐ์ฌํฉ๋๋ค.
ํฐ๋ฏธ๋์์ ์ง์ "git checkout d56e267"์ ์คํํ์ง ๋ง๊ณ Dockerfile์ ์์ ํด์ผ ํฉ๋๋ค.
๋๋ ๊ทธ๊ฒ์ ์ดํดํ๊ณ ๋ง์นจ๋ด ์ฑ๊ณต์ ์ผ๋ก ๊ตฌ์ถํ์ต๋๋ค.
๊ฐ์ฌ ํด์!
@TheNeikos , ๋ต๋ณ ๊ฐ์ฌํฉ๋๋ค
์ต์ ์ปค๋ฐ(7aa91aa)์ผ๋ก Dockerfile์ ์ปดํ์ผํ ์ ์์์ต๋๋ค. ๊ธฐ๋ณธ์ ์ผ๋ก ์ปค๋ฐ c00e35a ๋ฐ 8181a32์์ ๋ ๊ฐ์ง ๊ธฐ๋ฅ ์ด๋ฆ ๋ณ๊ฒฝ ๋ณ๊ฒฝ ์ฌํญ์ ๋๋๋ ธ์ต๋๋ค. "COCO API ๋ผ์ธ ์ค์น" ๋ค์ ๋ ๊ฐ์ sed ์ง์นจ์ ์ถ๊ฐํ์ฌ ์ด ์์ ์ ์๋ฃํ์ต๋๋ค.
# Install the COCO API
RUN git clone https://github.com/cocodataset/cocoapi.git /cocoapi
WORKDIR /cocoapi/PythonAPI
RUN make install
# Patch
RUN sed -i 's/numel/size/g' /detectron/detectron/ops/zero_even_op.cc && \
sed -i 's/X.dim/X.ndim/g' /detectron/detectron/ops/zero_even_op.cc
๊ฐ์ฅ ์ ์ฉํ ๋๊ธ
Dockerfile์์ ์๋ฏธํฉ๋๊น? ์
์์ ํด๋ก ์คํ https://github.com/facebookresearch/detectron /detectron
RUN cd /detectron && git checkout d56e267