walktree / libtorch-yolov3

A Libtorch implementation of the YOLO v3 object detection algorithm
452 stars 131 forks source link

Error during make #25

Open n01pham opened 5 years ago

n01pham commented 5 years ago

Hi, I use pytorch 1.2 I could successfully cmake it but when building with make I get these errors I don't know why, do you have the same mistakes ?

best regards

(base) n01pham@n01pham-MS-7B48:~/Desktop/libtorch-yolov3$ cmake -DCMAKE_PREFIX_PATH=/home/n01pham/libtorch
-- 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  
-- Found torch: /home/n01pham/libtorch/lib/libtorch.so  
-- Configuring done
-- Generating done
-- Build files have been written to: /home/n01pham/Desktop/libtorch-yolov3
(base) n01pham@n01pham-MS-7B48:~/Desktop/libtorch-yolov3$ make
Scanning dependencies of target yolo-app
[ 33%] Building CXX object CMakeFiles/yolo-app.dir/Darknet.cpp.o
In file included from /home/n01pham/libtorch/include/torch/csrc/api/include/torch/nn/modules/conv.h:5:0,
                 from /home/n01pham/libtorch/include/torch/csrc/api/include/torch/nn/modules.h:12,
                 from /home/n01pham/libtorch/include/torch/csrc/api/include/torch/nn.h:7,
                 from /home/n01pham/libtorch/include/torch/csrc/api/include/torch/all.h:6,
                 from /home/n01pham/libtorch/include/torch/csrc/api/include/torch/torch.h:3,
                 from /home/n01pham/Desktop/libtorch-yolov3/Darknet.h:11,
                 from /home/n01pham/Desktop/libtorch-yolov3/Darknet.cpp:10:
/home/n01pham/libtorch/include/torch/csrc/api/include/torch/nn/options/conv.h: In function ‘torch::nn::Conv2dOptions conv_options(int64_t, int64_t, int64_t, int64_t, int64_t, int64_t, bool)’:
/home/n01pham/libtorch/include/torch/csrc/api/include/torch/nn/options/conv.h:40:42: error: ‘torch::ExpandingArray<2ul, long int> torch::nn::ConvOptions<2ul>::stride_’ is private
   TORCH_ARG(ExpandingArray<D>, stride) = 1;
                                          ^
/home/n01pham/Desktop/libtorch-yolov3/Darknet.cpp:136:18: error: within this context
     conv_options.stride_ = stride;
                  ^
In file included from /home/n01pham/libtorch/include/torch/csrc/api/include/torch/nn/modules/conv.h:5:0,
                 from /home/n01pham/libtorch/include/torch/csrc/api/include/torch/nn/modules.h:12,
                 from /home/n01pham/libtorch/include/torch/csrc/api/include/torch/nn.h:7,
                 from /home/n01pham/libtorch/include/torch/csrc/api/include/torch/all.h:6,
                 from /home/n01pham/libtorch/include/torch/csrc/api/include/torch/torch.h:3,
                 from /home/n01pham/Desktop/libtorch-yolov3/Darknet.h:11,
                 from /home/n01pham/Desktop/libtorch-yolov3/Darknet.cpp:10:
/home/n01pham/libtorch/include/torch/csrc/api/include/torch/nn/options/conv.h:46:43: error: ‘torch::ExpandingArray<2ul, long int> torch::nn::ConvOptions<2ul>::padding_’ is private
   TORCH_ARG(ExpandingArray<D>, padding) = 0;
                                           ^
/home/n01pham/Desktop/libtorch-yolov3/Darknet.cpp:137:18: error: within this context
     conv_options.padding_ = padding;
                  ^
In file included from /home/n01pham/libtorch/include/torch/csrc/api/include/torch/nn/modules/conv.h:5:0,
                 from /home/n01pham/libtorch/include/torch/csrc/api/include/torch/nn/modules.h:12,
                 from /home/n01pham/libtorch/include/torch/csrc/api/include/torch/nn.h:7,
                 from /home/n01pham/libtorch/include/torch/csrc/api/include/torch/all.h:6,
                 from /home/n01pham/libtorch/include/torch/csrc/api/include/torch/torch.h:3,
                 from /home/n01pham/Desktop/libtorch-yolov3/Darknet.h:11,
                 from /home/n01pham/Desktop/libtorch-yolov3/Darknet.cpp:10:
/home/n01pham/libtorch/include/torch/csrc/api/include/torch/nn/options/conv.h:71:32: error: ‘int64_t torch::nn::ConvOptions<2ul>::groups_’ is private
   TORCH_ARG(int64_t, groups) = 1;
                                ^
/home/n01pham/Desktop/libtorch-yolov3/Darknet.cpp:138:18: error: within this context
     conv_options.groups_ = groups;
                  ^
In file included from /home/n01pham/libtorch/include/torch/csrc/api/include/torch/nn/modules/conv.h:5:0,
                 from /home/n01pham/libtorch/include/torch/csrc/api/include/torch/nn/modules.h:12,
                 from /home/n01pham/libtorch/include/torch/csrc/api/include/torch/nn.h:7,
                 from /home/n01pham/libtorch/include/torch/csrc/api/include/torch/all.h:6,
                 from /home/n01pham/libtorch/include/torch/csrc/api/include/torch/torch.h:3,
                 from /home/n01pham/Desktop/libtorch-yolov3/Darknet.h:11,
                 from /home/n01pham/Desktop/libtorch-yolov3/Darknet.cpp:10:
/home/n01pham/libtorch/include/torch/csrc/api/include/torch/nn/options/conv.h:67:32: error: ‘bool torch::nn::ConvOptions<2ul>::with_bias_’ is private
   TORCH_ARG(bool, with_bias) = true;
                                ^
/home/n01pham/Desktop/libtorch-yolov3/Darknet.cpp:139:18: error: within this context
     conv_options.with_bias_ = with_bias;
                  ^
In file included from /home/n01pham/libtorch/include/torch/csrc/api/include/torch/nn/modules/batchnorm.h:4:0,
                 from /home/n01pham/libtorch/include/torch/csrc/api/include/torch/nn/modules.h:11,
                 from /home/n01pham/libtorch/include/torch/csrc/api/include/torch/nn.h:7,
                 from /home/n01pham/libtorch/include/torch/csrc/api/include/torch/all.h:6,
                 from /home/n01pham/libtorch/include/torch/csrc/api/include/torch/torch.h:3,
                 from /home/n01pham/Desktop/libtorch-yolov3/Darknet.h:11,
                 from /home/n01pham/Desktop/libtorch-yolov3/Darknet.cpp:10:
/home/n01pham/libtorch/include/torch/csrc/api/include/torch/nn/options/batchnorm.h: In function ‘torch::nn::BatchNormOptions bn_options(int64_t)’:
/home/n01pham/libtorch/include/torch/csrc/api/include/torch/nn/options/batchnorm.h:19:29: error: ‘bool torch::nn::BatchNormOptions::affine_’ is private
   TORCH_ARG(bool, affine) = true;
                             ^
/home/n01pham/Desktop/libtorch-yolov3/Darknet.cpp:145:16: error: within this context
     bn_options.affine_ = true;
                ^
In file included from /home/n01pham/libtorch/include/torch/csrc/api/include/torch/nn/modules/batchnorm.h:4:0,
                 from /home/n01pham/libtorch/include/torch/csrc/api/include/torch/nn/modules.h:11,
                 from /home/n01pham/libtorch/include/torch/csrc/api/include/torch/nn.h:7,
                 from /home/n01pham/libtorch/include/torch/csrc/api/include/torch/all.h:6,
                 from /home/n01pham/libtorch/include/torch/csrc/api/include/torch/torch.h:3,
                 from /home/n01pham/Desktop/libtorch-yolov3/Darknet.h:11,
                 from /home/n01pham/Desktop/libtorch-yolov3/Darknet.cpp:10:
/home/n01pham/libtorch/include/torch/csrc/api/include/torch/nn/options/batchnorm.h:24:31: error: ‘bool torch::nn::BatchNormOptions::stateful_’ is private
   TORCH_ARG(bool, stateful) = true;
                               ^
/home/n01pham/Desktop/libtorch-yolov3/Darknet.cpp:146:16: error: within this context
     bn_options.stateful_ = true;
                ^
/home/n01pham/Desktop/libtorch-yolov3/Darknet.cpp: In member function ‘at::Tensor UpsampleLayer::forward(at::Tensor)’:
/home/n01pham/Desktop/libtorch-yolov3/Darknet.cpp:170:21: warning: ‘using IntList = class c10::ArrayRef<long int>’ is deprecated [-Wdeprecated-declarations]
      torch::IntList sizes = x.sizes();
                     ^
In file included from /home/n01pham/libtorch/include/c10/util/Exception.h:6:0,
                 from /home/n01pham/libtorch/include/c10/core/Device.h:5,
                 from /home/n01pham/libtorch/include/c10/core/Allocator.h:6,
                 from /home/n01pham/libtorch/include/ATen/ATen.h:3,
                 from /home/n01pham/libtorch/include/torch/csrc/api/include/torch/types.h:3,
                 from /home/n01pham/libtorch/include/torch/csrc/api/include/torch/data/dataloader_options.h:4,
                 from /home/n01pham/libtorch/include/torch/csrc/api/include/torch/data/dataloader/base.h:3,
                 from /home/n01pham/libtorch/include/torch/csrc/api/include/torch/data/dataloader/stateful.h:3,
                 from /home/n01pham/libtorch/include/torch/csrc/api/include/torch/data/dataloader.h:3,
                 from /home/n01pham/libtorch/include/torch/csrc/api/include/torch/data.h:3,
                 from /home/n01pham/libtorch/include/torch/csrc/api/include/torch/all.h:4,
                 from /home/n01pham/libtorch/include/torch/csrc/api/include/torch/torch.h:3,
                 from /home/n01pham/Desktop/libtorch-yolov3/Darknet.h:11,
                 from /home/n01pham/Desktop/libtorch-yolov3/Darknet.cpp:10:
/home/n01pham/libtorch/include/c10/util/ArrayRef.h:278:1: note: declared here
 C10_DEFINE_DEPRECATED_USING(IntList, ArrayRef<int64_t>)
 ^
/home/n01pham/Desktop/libtorch-yolov3/Darknet.cpp: In member function ‘void Darknet::load_weights(const char*)’:
/home/n01pham/Desktop/libtorch-yolov3/Darknet.cpp:527:54: error: ‘class at::DeprecatedTypeProperties’ has no member named ‘tensorFromBlob’
     at::Tensor weights = torch::CPU(torch::kFloat32).tensorFromBlob(weights_src
                                                      ^
/home/n01pham/Desktop/libtorch-yolov3/Darknet.cpp:569:52: error: ‘class torch::nn::BatchNormImpl’ has no member named ‘running_variance’
    bn_running_var = bn_running_var.view_as(bn_imp->running_variance);
                                                    ^
/home/n01pham/Desktop/libtorch-yolov3/Darknet.cpp:574:12: error: ‘class torch::nn::BatchNormImpl’ has no member named ‘running_variance’
    bn_imp->running_variance.set_data(bn_running_var);
            ^
CMakeFiles/yolo-app.dir/build.make:62: recipe for target 'CMakeFiles/yolo-app.dir/Darknet.cpp.o' failed
make[2]: *** [CMakeFiles/yolo-app.dir/Darknet.cpp.o] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/yolo-app.dir/all' failed
make[1]: *** [CMakeFiles/yolo-app.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
xm0629 commented 5 years ago

I have a question , run this code and libtorch1.0 ### Screenshot from 2019-09-23 19-49-29

mheriyanto commented 4 years ago

@n01pham you can try these https://github.com/walktree/libtorch-yolov3/issues/43#issuecomment-616449799