大家好,
最近我有一个问题,通过 docker 安装检测器。 我现在失败了:
/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 (auto i = 0; i < Y->numel(); i += 2) {
我在这里发现了一个相关的问题:
https://github.com/facebookresearch/Detectron/issues/732
但我不能使用该修复程序,因为检测器是从存储库直接安装的。 你能改变存储库吗?
提前致谢,
埃里克
嗨,我对 Dockerfile 也有同样的问题。 我想知道这是否与 CUDA 版本有关。
编译现在中断。 得到这个:
在 docker hub 上的任何地方都没有受支持的自动构建吗?
我的系统有其他使用 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 而不是最新的 master 来解决这个问题
@TheNeikos ,我也可以使用 d56e267efc92b65b8d899f1b89a7ed2bca3e5f44
我通过结帐d56e267而不是最新的 master 来解决这个问题
你的意思是在 Dockerfile 中? 例如
运行 git clone https://github.com/facebookresearch/detectron /detectron
运行 cd /detectron && git checkout d56e267
@beatthat是的
谢谢@TheNeikos ! 扎克伯格应该给你至少一万欧元,因为如果没有你的评论,我会放弃 Detectron 并且只使用 Matterport 的实现:D
@manyaafonso
你介意分享更多关于你如何解决这个问题的详细信息吗?
我遵循@TheNeikos @beatthat @francois-wellenreiter 的建议
1.运行 git clone 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
--- 一个/docker/Dockerfile
+++ b/docker/Dockerfile
@@ -10,6 +10,9 @@ ENV LD_LIBRARY_PATH /usr/local/caffe2_build/lib:${LD_LIBRARY_PATH}
# 克隆 Detectron 存储库
运行 git clone https://github.com/facebookresearch/detectron /detectron
+WORKDIR /检测器
+运行 git checkout d56e267efc92b65b8d899f1b89a7ed2bca3e5f44
+
# 安装 Python 依赖
运行 pip install -r /detectron/requirements.txt
```
嗨@randf102 ,我只是根据上面的评论修改了dockerfile,更改了以下部分:
运行 git clone https://github.com/facebookresearch/detectron /detectron
运行 cd /detectron && git checkout d56e267
然后在 linux 提示符下:
nvidia-docker build -t my_detectron_image 。
@francois-wellenreiter @manyaafonso
感谢你们对我的帮助。
我应该修改 Dockerfile,而不是直接在终端中运行“git checkout d56e267”。
我已经理解它并最终成功构建它。
谢谢!
@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 中? 例如
运行 git clone https://github.com/facebookresearch/detectron /detectron
运行 cd /detectron && git checkout d56e267