muupan / dqn-in-the-caffe

An implementation of Deep Q-Network using Caffe
MIT License
213 stars 118 forks source link

fatal error: caffe/proto/caffe.pb.h: No such file or directory #include "caffe/proto/caffe.pb.h" #3

Closed ghost closed 9 years ago

ghost commented 9 years ago

Sorry I closed the previous issue by mistake?

Here's the exact output I get, when I try to make dqn-in-the-caffe

ajay@ajay-h8-1170uk:~$ cd /home/ajay/CppProjects/dqn_caffe/build ajay@ajay-h8-1170uk:~/CppProjects/dqn_caffe/build$ cmake .. -- Configuring done -- Generating done -- Build files have been written to: /home/ajay/CppProjects/dqn_caffe/build ajay@ajay-h8-1170uk:~/CppProjects/dqn_caffe/build$ make [ 50%] Building CXX object CMakeFiles/dqn.dir/dqn_main.cpp.o In file included from /home/ajay/bin/caffe/include/caffe/caffe.hpp:7:0, from /home/ajay/CppProjects/dqn_caffe/dqn.hpp:10, from /home/ajay/CppProjects/dqn_caffe/dqn_main.cpp:7: /home/ajay/bin/caffe/include/caffe/blob.hpp:5:34: fatal error: caffe/proto/caffe.pb.h: No such file or directory

include "caffe/proto/caffe.pb.h"

^ compilation terminated. make[2]: * [CMakeFiles/dqn.dir/dqn_main.cpp.o] Error 1 make[1]: * [CMakeFiles/dqn.dir/all] Error 2 make: *\ [all] Error 2

and the CMakeLists.txt I using for cmake

cmake_minimum_required (VERSION 2.6) project(dqn)

option(CPU_ONLY "Use CPU only for Caffe" ON) option(USE_CUDNN "Use cuDNN for Caffe" OFF) option(USE_SDL "Use SDL for ALE" ON)

include_directories(/usr/local/caffe/include)

include_directories(/usr/local/ale_cpp/ale_0.4.4/ale_0_4/src)

link_directories(/usr/local/caffe/build/lib)

link_directories(/usr/local/ale_cpp/ale_0.4.4/ale_0_4)

include_directories(/home/ajay/bin/caffe/include) include_directories(/usr/local/ale_cpp/ale_0.4.4/ale_0_4/src) link_directories(/home/ajay/bin/caffe/build/lib) link_directories(/usr/local/ale_cpp/ale_0.4.4/ale_0_4)

if(USE_CUDNN) link_directories(~/cudnn-6.5-linux-R1) endif()

add_executable(dqn dqn_main.cpp dqn.cpp)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -O3 -march=native")

target_link_libraries(dqn caffe) target_link_libraries(dqn glog) target_link_libraries(dqn gflags) target_link_libraries(dqn ale)

It definitely seems like its a problem with how I'm installing caffe, but it passes all the tests, and works for MNIST? I've tried to reinstall it 3 times but no luck?

muupan commented 9 years ago

You need to generate caffe.pb.h manually using protoc as follows.

# In the directory you installed Caffe to
protoc src/caffe/proto/caffe.proto --cpp_out=.
mkdir include/caffe/proto
mv src/caffe/proto/caffe.pb.h include/caffe/proto
ghost commented 9 years ago

Hi, thanks a lot for the help! I really appreciate it :)

We're making progress, but now there seems to be a problem with a solver?

ajay@ajay-h8-1170uk:~/CppProjects/dqn-in-the-caffe-master/build$ make Scanning dependencies of target dqn [ 50%] Building CXX object CMakeFiles/dqn.dir/dqn_main.cpp.o In file included from /home/ajay/CppProjects/dqn-in-the-caffe-master/dqn_main.cpp:3:0: /usr/local/ale_cpp/ale_0.4.4/ale_0_4/src/ale_interface.hpp:124:28: warning: ‘auto_ptr’ is deprecated (declared at /usr/include/c++/4.8/backward/auto_ptr.h:87) [-Wdeprecated-declarations] std::auto_ptr theOSystem; ^ /usr/local/ale_cpp/ale_0.4.4/ale_0_4/src/ale_interface.hpp:125:29: warning: ‘auto_ptr’ is deprecated (declared at /usr/include/c++/4.8/backward/auto_ptr.h:87) [-Wdeprecated-declarations] std::auto_ptr theSettings; ^ /usr/local/ale_cpp/ale_0.4.4/ale_0_4/src/aleinterface.hpp: In function ‘void createOSystem(int, char*, std::auto_ptr&, std::auto_ptr&)’: /usr/local/ale_cpp/ale_0.4.4/ale_0_4/src/aleinterface.hpp:84:49: warning: ignoring return value of ‘FILE freopen(const char, const char, FILE_)’, declared with attribute warn_unused_result [-Wunused-result] freopen(outputFile.c_str(), "w", stdout); ^ [100%] Building CXX object CMakeFiles/dqn.dir/dqn.cpp.o In file included from /home/ajay/CppProjects/dqn-in-the-caffe-master/dqn.hpp:9:0, from /home/ajay/CppProjects/dqn-in-the-caffe-master/dqn.cpp:1: /usr/local/ale_cpp/ale_0.4.4/ale_0_4/src/ale_interface.hpp:124:28: warning: ‘auto_ptr’ is deprecated (declared at /usr/include/c++/4.8/backward/auto_ptr.h:87) [-Wdeprecated-declarations] std::auto_ptr theOSystem; ^ /usr/local/ale_cpp/ale_0.4.4/ale_0_4/src/ale_interface.hpp:125:29: warning: ‘auto_ptr’ is deprecated (declared at /usr/include/c++/4.8/backward/auto_ptr.h:87) [-Wdeprecated-declarations] std::autoptr theSettings; ^ /home/ajay/CppProjects/dqn-in-the-caffe-master/dqn.cpp: In member function ‘void dqn::DQN::Update()’: /home/ajay/CppProjects/dqn-in-the-caffe-master/dqn.cpp:350:12: error: ‘class caffe::Solver’ has no member named ‘Step’ solver->Step(1); ^ make[2]: _\ [CMakeFiles/dqn.dir/dqn.cpp.o] Error 1 make[1]: * [CMakeFiles/dqn.dir/all] Error 2 make: * [all] Error 2

I can't find anything on the internet about this one

muupan commented 9 years ago

The message shows https://github.com/BVLC/caffe/pull/1228 is not merged into your caffe. DQN-in-the-caffe depends on that PR.

I've tested DQN-in-the-caffe only with my forked caffe branch https://github.com/muupan/caffe/tree/dqn, so I recommend you use it.

ghost commented 9 years ago

Great! Thanks, I've built it all sucessfully, and have some note/docs, if any one else needs help?

screenshot from 2015-01-21 21 10 25

I'll be testing it tonight and over the weekend on pong. Will get back to you :+1:

May I ask if you've ever tested your code on freeway.bin or othello.bin

muupan commented 9 years ago

Congratulations! I hope to hear the results. I've never tried freeway nor othello yet.

IdiosyncraticDragon commented 9 years ago

@muupan thank you! It's really helpful.

godisboy commented 8 years ago

Thank you! It works!

edWin-m commented 7 years ago

@muupan Thanks

ecilay commented 7 years ago

hi @muupan , after implement your suggestions, still the same error...any other advices? tks! `# In the directory you installed Caffe to

protoc src/caffe/proto/caffe.proto --cpp_out=.

mkdir include/caffe/proto

mv src/caffe/proto/caffe.pb.h include/caffe/proto`