Code Monkey home page Code Monkey logo

caffe2_cpp_example's Introduction

caffe2_Cpp_example

c++ caffe2 example

Usage:

** notice **

before you compile this code, please double check your pytorch version, I use pytorch master tag v0.4.1, do not use the latest commit
cd 'project root dir'
mkdir build
cd build
cmake ..
make
'run and have fun'


Project description

use caffe2 c++ api to load pretrained model.
I use a mp4 file to test squeeznet with CUDA.
Next step, I will try to modify this code running with opencl.

Notice:

Build caffe2 with opencv which already installed on your system(mine is ubuntu 16.04)
If you use CLion to build the project, maybe you will meet DSO missing from command line ERROR, double check clion's link.txt file, maybe the command line is missing some libraries.

caffe2_cpp_example's People

Contributors

zacario-li avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

jnulzl

caffe2_cpp_example's Issues

Cmake Error

I just clone your repository and compile it, and got the following error :
The Caffe2 is build with the last pytorch github commit.

> make -j8
Scanning dependencies of target caffe2_cpp_test
[ 50%] Building CXX object CMakeFiles/caffe2_cpp_test.dir/src/main.cpp.o
/home/cgilab/Desktop/Caffe2_Demo/03_cpp_forward/build/caffe2_Cpp_example/src/main.cpp: In function ‘void caffe2::caffe2_pretrained_run()’:
/home/cgilab/Desktop/Caffe2_Demo/03_cpp_forward/build/caffe2_Cpp_example/src/main.cpp:121:50: error: use of deleted function ‘caffe2::Tensor::Tensor(const caffe2::Tensor&)’
             auto output = TensorCPU(output_device);
                                                  ^
In file included from /usr/local/include/caffe2/core/blob.h:13:0,
                 from /usr/local/include/caffe2/core/operator.h:12,
                 from /home/cgilab/Desktop/Caffe2_Demo/03_cpp_forward/build/caffe2_Cpp_example/inc/utils.h:10,
                 from /home/cgilab/Desktop/Caffe2_Demo/03_cpp_forward/build/caffe2_Cpp_example/src/main.cpp:1:
/usr/local/include/caffe2/core/tensor.h:763:3: note: declared here
   Tensor(const Tensor& src) = delete;
   ^
In file included from /usr/local/include/caffe2/core/operator.h:12:0,
                 from /home/cgilab/Desktop/Caffe2_Demo/03_cpp_forward/build/caffe2_Cpp_example/inc/utils.h:10,
                 from /home/cgilab/Desktop/Caffe2_Demo/03_cpp_forward/build/caffe2_Cpp_example/src/main.cpp:1:
/usr/local/include/caffe2/core/blob.h: In instantiation of ‘T* caffe2::Blob::GetMutable() [with T = caffe2::Tensor]’:
/home/cgilab/Desktop/Caffe2_Demo/03_cpp_forward/build/caffe2_Cpp_example/src/main.cpp:77:75:   required from here
/usr/local/include/caffe2/core/blob.h:127:5: error: static assertion failed: GetMutable can't be called with non-default-constructible types. Try using specialized methods
     static_assert(
     ^
/usr/local/include/caffe2/core/blob.h:135:22: error: use of deleted function ‘caffe2::Tensor::Tensor()’
       return Reset<T>(new T());
                      ^
In file included from /usr/local/include/caffe2/core/blob.h:13:0,
                 from /usr/local/include/caffe2/core/operator.h:12,
                 from /home/cgilab/Desktop/Caffe2_Demo/03_cpp_forward/build/caffe2_Cpp_example/inc/utils.h:10,
                 from /home/cgilab/Desktop/Caffe2_Demo/03_cpp_forward/build/caffe2_Cpp_example/src/main.cpp:1:
/usr/local/include/caffe2/core/tensor.h:94:3: note: declared here
   Tensor() = delete;
   ^
CMakeFiles/caffe2_cpp_test.dir/build.make:62: recipe for target 'CMakeFiles/caffe2_cpp_test.dir/src/main.cpp.o' failed
make[2]: *** [CMakeFiles/caffe2_cpp_test.dir/src/main.cpp.o] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/caffe2_cpp_test.dir/all' failed
make[1]: *** [CMakeFiles/caffe2_cpp_test.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.