GithubHelp home page GithubHelp logo

Caffe on Windows about caffe HOT 234 CLOSED

bvlc avatar bvlc commented on May 2, 2024
Caffe on Windows

from caffe.

Comments (234)

shelhamer avatar shelhamer commented on May 2, 2024

In principle compiling and running on Windows is possible, but we do not have a Makefile for it, nor do we currently plan on supporting it. However, contributions to this end are welcome!

from caffe.

niuzhiheng avatar niuzhiheng commented on May 2, 2024

I have ported Caffe to Windows. It is built by Visual Studio 2012.

from caffe.

shelhamer avatar shelhamer commented on May 2, 2024

Thank you for porting Caffe! Could you publish your code on your fork? We do not officially support windows yet, but we could direct others interested in running Caffe on windows to your work.

from caffe.

niuzhiheng avatar niuzhiheng commented on May 2, 2024

Yes, I created a new branch named as "windows" on my own repository.

You may refer to the installation guide for more details.

Look forward to any feedback from all of you.

from caffe.

nian-liu avatar nian-liu commented on May 2, 2024

@niuzhiheng Can your windows version codes run in a VS2010 environment?

from caffe.

niuzhiheng avatar niuzhiheng commented on May 2, 2024

I am not sure for VS2010, but it has been confirmed that both VS2012 professional and VS2012 express are OK. There are two main concerns for other Visual Studio versions:

  1. whether std::thread is working fine with other versions earlier than VS2012.
  2. 3rd-party libraries may need to be rebuilt correspondingly, e.g. OpenCV.

from caffe.

nian-liu avatar nian-liu commented on May 2, 2024

@niuzhiheng I am wondering could I have your mail ID - I have some questions in building caffe by vs 2010 and would like to get some directions from you. My gmail is [email protected], thanks in advance!

from caffe.

zgxiangyang avatar zgxiangyang commented on May 2, 2024

@niuzhiheng I have downloaded your fork, but i can only find the ".dll" files, no ".h" files and "*.lib" files of "3rdparty."
it is not easy to build these "x64" libraries in windows, can you share it in the project too? thanks!

from caffe.

niuzhiheng avatar niuzhiheng commented on May 2, 2024

@zgxiangyang The dependencies can be download from here

You may refer to the installation guide for more details.

from caffe.

zgxiangyang avatar zgxiangyang commented on May 2, 2024

@niuzhiheng I have downloaded it before, there are only several".dll" files. But without the corresponding '.lib" files, I have no way to use it in my projects. I can only run the demo.
It's too hard for me to build my own libs.

from caffe.

aybassiouny avatar aybassiouny commented on May 2, 2024

Thanks a lot @niuzhiheng, your windows port works handsomely on windows server 2012 with VS2012.

One note for others using the windows branch that took me sometime to figure, they should use the old architecture (the one with explicit padding layers) not the new one. i.e. in order to use the cifar sample, they should use this net architecture, not the one in master. Mnist example in master works smoothly as it does not have any padding layers.

from caffe.

niuzhiheng avatar niuzhiheng commented on May 2, 2024

@aybassiouny you are correct. I am considering to update the windows port to new net architecture and up to date when caffe officially release 1.0 version.

from caffe.

aybassiouny avatar aybassiouny commented on May 2, 2024

@niuzhiheng new PR is out!

from caffe.

thuanvh avatar thuanvh commented on May 2, 2024

Hi, I am planning to compile caffe in win32. It seems the dependencies building is difficult. @niuzhiheng Could you help to build win32 dependencies files and share it.

from caffe.

bhack avatar bhack commented on May 2, 2024

Cmake can generate Visual Studio files.
Take a look at #442
Instead Mxe[¹] and Cmake could be a good base for compile with mingw for windows target on linux
[1]http://mxe.cc/

from caffe.

kloudkl avatar kloudkl commented on May 2, 2024

Not all the dependencies are compatible with Windows. For example, the pthread used by the various data layer to prefetch the data is only available on Linux/Unix. If they are not replaced by boost::thread, you can only simulate Linux with MinGW or Cygwin. In my experiences, they brought up too many unnecessary complications and are not suitable for running complex projects such as Caffe and it's dependencies.

If you do want to use Caffe, install the latest version of Ubuntu which is the most popular and the easiest Linux OS.

from caffe.

niuzhiheng avatar niuzhiheng commented on May 2, 2024

@kloudkl is right. The official Linux version is well supported by the Caffe community with frequent updates and discussions. The windows porting currently has many limitations and most importantly it is lacking community support.

One may start with this windows porting, if you quite rely on visual studio as your favorite IDE. Once you become familiar with Caffe, you'd better deploy from the official branches.

from caffe.

aybassiouny avatar aybassiouny commented on May 2, 2024

I have managed to compile latest caffe using #442, it is kind of a hellish process, but overall I fixed major errors following footsteps of @niuzhiheng's port.

I am a total newbie to github, should I submit it as a pull request to to the windows port?

from caffe.

thuanvh avatar thuanvh commented on May 2, 2024

I am interested in caffe for windows. Could you push your changes to github? Could you create a branch and push it up? @aybassiouny

-----Thư Gốc-----
Từ: "aybassiouny" [email protected]
Gửi: ‎29/‎06/‎2014 6:13 SA
Đến: "BVLC/caffe" [email protected]
Cc: "thuanvh" [email protected]
Chủ đề: Re: [caffe] Caffe on Windows (#15)

I have managed to compile latest caffe using #442, it is kind of a hellish process, but overall I fixed major errors following footsteps of @niuzhiheng's port.
I am a total newbie to github, should I submit it as a pull request to to the windows port?

Reply to this email directly or view it on GitHub.

from caffe.

shelhamer avatar shelhamer commented on May 2, 2024

@aybassiouny my advice is to coordinate with @niuzhiheng, who has kindly
kept the Windows port at his fork, to make you a collaborator on his repo
or otherwise submit a PR there.

A good first step is to push your Windows branch to your own fork and link
it in this thread for others to find.

On Sun, Jun 29, 2014 at 3:47 AM, thuanvh [email protected] wrote:

I am interested in caffe for windows. Could you push your changes to
github? Could you create a branch and push it up? @aybassiouny

-----Thư Gốc-----
Từ: "aybassiouny" [email protected]
Gửi: ‎29/‎06/‎2014 6:13 SA
Đến: "BVLC/caffe" [email protected]
Cc: "thuanvh" [email protected]
Chủ đề: Re: [caffe] Caffe on Windows (#15)

I have managed to compile latest caffe using #442, it is kind of a hellish
process, but overall I fixed major errors following footsteps of
@niuzhiheng's port.
I am a total newbie to github, should I submit it as a pull request to to
the windows port?

Reply to this email directly or view it on GitHub.


Reply to this email directly or view it on GitHub
#15 (comment).

from caffe.

rbgirshick avatar rbgirshick commented on May 2, 2024

You might also want to check with @s-gupta who has experience compiling and using caffe on Windows as part of an internship.

from caffe.

wusx11 avatar wusx11 commented on May 2, 2024

@niuzhiheng Excuse me, I'm trying to run your code on windows platform. But it seems the download link of the dependencies you gave are not available now...I'm not sure whether it's the problem of my network. Could you please check the download link? Thanks a lot!!!

from caffe.

thuanvh avatar thuanvh commented on May 2, 2024

I have no problem in downloading dependencies of windows. https://dl.dropboxusercontent.com/u/3466743/caffe-vs2012/dependency.7z

from caffe.

wusx11 avatar wusx11 commented on May 2, 2024

@thuanvh Well, maybe there's something wrong with my network... I've already got the dependencies through other ways. Thanks!!

from caffe.

niuzhiheng avatar niuzhiheng commented on May 2, 2024

Please use the updated download link if you use my updated code. Up to now, I have three versions, dependency.7z, dependency-20140514.7z, dependency-20140624.7z.
You may be able to see the correct one to use from the readme.md file in the code you are using.

from caffe.

niuzhiheng avatar niuzhiheng commented on May 2, 2024

@aybassiouny and @shelhamer I am also interested in using CMake for windows porting. And I am very glad to have @aybassiouny as a collaborator to my repo if you want.

from caffe.

shelhamer avatar shelhamer commented on May 2, 2024

@niuzhiheng @aybassiouny that sounds like a productive collaboration. Go for it!

from caffe.

kloudkl avatar kloudkl commented on May 2, 2024

@shelhamer, #573 works on Ubuntu, Debian and Mint. It is mature enough to be merged.

from caffe.

shelhamer avatar shelhamer commented on May 2, 2024

@kloudkl Please discuss at #573. This thread is not about Cmake.

from caffe.

aybassiouny avatar aybassiouny commented on May 2, 2024

Here's the repo for cmake-produced caffe: https://github.com/aybassiouny/wincaffe-cmake. @niuzhiheng could you give it a try?

from caffe.

niuzhiheng avatar niuzhiheng commented on May 2, 2024

@aybassiouny Great! I'd love to try.

from caffe.

niuzhiheng avatar niuzhiheng commented on May 2, 2024

@aybassiouny Sorry I am still having some problems to successfully build your wincaffe-cmake.
One thing I am glad to share and notify you is that @OpenHero submitted a new PR #643. Please take a look if you are interested in making cmake version for that code. I think we need to work together for a better windows porting.
@shelhamer your comments and suggestions are very welcome.

from caffe.

OpenHero avatar OpenHero commented on May 2, 2024

Hi All, I had update the PR #643.
@niuzhiheng hi, I add you into my caffe fork.
https://github.com/OpenHero/caffe

On Wed, Jul 9, 2014 at 1:04 PM, NIU ZHIHENG [email protected]
wrote:

@aybassiouny https://github.com/aybassiouny Sorry I am still having
some problems to successfully build your wincaffe-cmake.
One thing I am glad to share and notify you is that @OpenHero
https://github.com/OpenHero submitted a new PR #643
#643. Please take a look if you are
interested in making cmake version for that code. I think we need to work
together for a better windows porting.
@shelhamer https://github.com/shelhamer your comments and suggestions
are very welcome.


Reply to this email directly or view it on GitHub
#15 (comment).

Best wishes,
Kaiyong Zhao

from caffe.

jashaikh avatar jashaikh commented on May 2, 2024

Hi All,

I am new to Caffe and I have worked always in Windows. I followed the installation steps of the Caffe for Windows:
https://github.com/niuzhiheng/caffe/blob/windows/README.md

But when I tried to build MainBuilder.sln using default train_net.cpp, I get the following errors:


1>------ Build started: Project: MainCaller, Configuration: Debug x64 ------
1> caffe.pb.h is being generated
1> '"./tools/protoc"' is not recognized as an internal or external command,
1> operable program or batch file.
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.CppCommon.targets(124,5): error MSB3073: The command "set origin_dir=Í%
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.CppCommon.targets(124,5): error MSB3073: cd ../../
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.CppCommon.targets(124,5): error MSB3073: "./scripts/GeneratePB.bat"
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.CppCommon.targets(124,5): error MSB3073: cd %origin_dir%
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.CppCommon.targets(124,5): error MSB3073: :VCEnd" exited with code 1.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========


Would you please help me sort out the problem?

from caffe.

OpenHero avatar OpenHero commented on May 2, 2024

Need "protoc.exe" Google protocbuffer tool.

Sent from my iPhone

On 21 Jul, 2014, at 0:11, jashaikh [email protected] wrote:

Hi All,

I am new to Caffe and I have worked always in Windows. I followed the installation steps of the Caffe for Windows:
https://github.com/niuzhiheng/caffe/blob/windows/README.md

But when I tried to build MainBuilder.sln using default train_net.cpp, I get the following errors:

1>------ Build started: Project: MainCaller, Configuration: Debug x64 ------
1> caffe.pb.h is being generated
1> '"./tools/protoc"' is not recognized as an internal or external command,
1> operable program or batch file.
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.CppCommon.targets(124,5): error MSB3073: The command "set origin_dir=Í%
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.CppCommon.targets(124,5): error MSB3073: cd ../../
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.CppCommon.targets(124,5): error MSB3073: "./scripts/GeneratePB.bat"
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.CppCommon.targets(124,5): error MSB3073: cd %origin_dir%
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.CppCommon.targets(124,5): error MSB3073: :VCEnd" exited with code 1.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Would you please help me sort out the problem?


Reply to this email directly or view it on GitHub.

from caffe.

jashaikh avatar jashaikh commented on May 2, 2024

Thanks a lot for the help.

But "proto.exe" is present at this path:
F:\Javed\VC\VC2012\cnn_train\caffe-windows\build\MSVC\tools

And the "MainBuilder.sln" is present at the path:
F:\Javed\VC\VC2012\cnn_train\caffe-windows\build\MSVC

Furthermore, the compiler has underlined the words "google", "LOG", "ERROR", "INFO", "SolverParameter" with red color in "train_net.cpp" file.

Moreover, can you please explain what is the meaning of "../../" in the following line in MainCaller.cpp:
#include "../../tools/train_net.cpp"

from caffe.

OpenHero avatar OpenHero commented on May 2, 2024

@jashaikh https://github.com/OpenHero/caffe/wiki/Caffe-setup-in-Windows-system FYI.

from caffe.

jashaikh avatar jashaikh commented on May 2, 2024

@OpenHero The installation steps of your Caffe version needs to access D: partition of HDD. (Furthermore, we will have to download all the dependencies ourselves.) What if someone has (or wants to use) C: partition? That's why I am still trying to compile niuzhiheng's version, which now requires caffe/proto/caffe.pb.h, but this file is not located anywhere in his or your package.
Thanks

from caffe.

niuzhiheng avatar niuzhiheng commented on May 2, 2024

caffe.pb.h can be generated by protoc.exe when you compile the project for the first time.

from caffe.

jashaikh avatar jashaikh commented on May 2, 2024

@niuzhiheng Do I have to supply some arguments or I will have to just run protoc.exe as it is in the DOS command window before I compile the MainBuilder.sln?
Thanks

from caffe.

jashaikh avatar jashaikh commented on May 2, 2024

@niuzhiheng I have created the caffe.pb.h file following OpenHero's installation instructions. Finally, I built the project, though with many warnings (but not errors). It created the MainCaller.exe in the bin folder. Then, I double clicked the train_lenet.bat to start training on the MNIST dataset, but it displayed the following error message in the Command Prompt window:
"The program can't start because libgfortran-3.dll is missing from your computer. Try reinstalling the program to fix this problem."
Would you please help me sort out the problem?

from caffe.

niuzhiheng avatar niuzhiheng commented on May 2, 2024

You may find it here.

from caffe.

jashaikh avatar jashaikh commented on May 2, 2024

@niuzhiheng Thanks for the updated dependency files. It resolved the previous issue, but now the following run-time error has occured, even when I had double clicked the "get_mnist_leveldb.bat" file in the Windows Explorer before running the "train_lenet.bat" file.

I0803 12:07:31.110451  6872 data_layer.cpp:145] Opening leveldb mnist-train-leve
ldb
F0803 12:07:31.131301  6872 data_layer.cpp:148] Check failed: status.ok() Failed
 to open leveldb mnist-train-leveldb
Invalid argument: mnist-train-leveldb: does not exist (create_if_missing is fals
e)
*** Check failure stack trace: ***

Would you please help in this regard?

from caffe.

niuzhiheng avatar niuzhiheng commented on May 2, 2024

@jashaikh you may refer to this thread.

By the way, you may change the

=======  to   ` ` ` (no space)

so that your code printed can be normal.

from caffe.

jashaikh avatar jashaikh commented on May 2, 2024

@niuzhiheng I saw that thread, but he was using his own dataset, and it seems you were suggesting him to use the same dataset as trainset and testset by just renaming the database! On the contrary, I intend to use MNIST dataset just to get acquainted with Caffe, but I am not sure what exactly the get_mnist_leveldb.bat does. If it downloads the MNIST dataset from some webpage according to the instructions inside the .bat file, where does it put the dataset (since I can't locate the downloaded file anywhere) and whether I have to do anything manually with that downloaded file or not. For example, do I need to copy and rename the trainset as testset as you suggested him?
Thanks for your support.

from caffe.

niuzhiheng avatar niuzhiheng commented on May 2, 2024

@jashaikh The downloading script has been updated. It seems dropbox has deprecated the http way. It can only be downloaded by wget with https support.
You may download the new dependency which support https and update the get_mnist_leveldb.
Once again, can you please update your last second post by wrapping around the ==== your output ==== by "```" ? Thank you.

from caffe.

shelhamer avatar shelhamer commented on May 2, 2024

Note that we migrated from Dropbox to our own download site for bandwidth
concerns. See any of the latest download scripts. Thanks for maintaining
your Windows port!

On Sunday, August 3, 2014, NIU ZHIHENG [email protected] wrote:

@jashaikh https://github.com/jashaikh The downloading script has been
updated
niuzhiheng@efbfdae.
It seems dropbox has deprecated the http way. It can only be downloaded by
wget with https support.
You may download the new dependency which support https and update the
get_mnist_leveldb
https://github.com/niuzhiheng/caffe/blob/efbfdae0ceabf4e01b07d69e8194db74e3302d04/examples/mnist/get_mnist_leveldb.bat
.


Reply to this email directly or view it on GitHub
#15 (comment).

from caffe.

jashaikh avatar jashaikh commented on May 2, 2024

@niuzhiheng I downloaded the new dependency files and replaced the old ones with them. Then I ran get_mnist_leveldb.bat. It did something, but I still don't know where it put the MNIST database if it downloaded it. Then, I ran the train_lenet.bat, it again produced the following output:

I0805 22:52:02.520145  9128 train_net.cpp:26] Starting Optimization
I0805 22:52:02.523147  9128 solver.cpp:41] Creating training net.
I0805 22:52:02.529149  9128 net.cpp:64] Memory required for Data0
I0805 22:52:02.529149  9128 net.cpp:75] Creating Layer mnist
I0805 22:52:02.530151  9128 net.cpp:111] mnist -> data
I0805 22:52:02.531152  9128 net.cpp:111] mnist -> label
I0805 22:52:02.531152  9128 data_layer.cpp:145] Opening leveldb mnist-train-leve
ldb
F0805 22:52:02.536154  9128 data_layer.cpp:148] Check failed: status.ok() Failed
 to open leveldb mnist-train-leveldb
Invalid argument: mnist-train-leveldb: does not exist (create_if_missing is fals
e)
*** Check failure stack trace: ***

BTW, the web link in get_mnist_leveldb.bat file is still http. Shouldn't it be https as you mentioned?

Thanks

from caffe.

bhack avatar bhack commented on May 2, 2024

Cmake branch was merged in dev now.

from caffe.

niuzhiheng avatar niuzhiheng commented on May 2, 2024

The slow speed issue has been solved since the upgrade of GPU driver to 340.62 and CUDA toolkit to 6.5. Now the windows version can run as fast as linux version.

from caffe.

shelhamer avatar shelhamer commented on May 2, 2024

Good news! Thanks for the update.

On Friday, August 22, 2014, NIU ZHIHENG [email protected] wrote:

The slow speed issue has been solved since the upgrade of GPU driver to
340.62 and CUDA toolkit to 6.5. Now the windows version can run as fast as
linux version.


Reply to this email directly or view it on GitHub
#15 (comment).

from caffe.

Errie avatar Errie commented on May 2, 2024

Hello to you all!
Following niuzhiheng's instructions
I now built the project and I downloaded the imagenet model
through Cygwin.
However, I have a problem with the testing.
I want to do the testing, using this model, on an image ,
using the Matlab code from caffe/examples.
Apart from having some problems with my compilers (mex files not produced normally)
a caffe.m function
is mentioned in the
matcaffe.m
function
which I can't find anywhere.
Can you please explain to me if someone has done the testing on windows.

As far as I know, using the python wrapper is not easy as leveldb cannot be compiled on Windows.
Thank you very much!

from caffe.

hogepu avatar hogepu commented on May 2, 2024

Hello.
@niuzhiheng I'm trying to build in Visual Studio 2013. but I have some trouble.
I have to rebuild 3rd party libraries, especially leveldb and protobuf. please let me know where they are ( you used in VS2012 version )?
I already found leveldb at "https://github.com/Reactive-Extensions/LevelDB", and protobuf at " https://code.google.com/p/protobuf/downloads/list".
but using them, I can't complete rebuild. If they aren't applicable, let me know the wrong point.

And I've not found libglog and libopenblas for windows... ( but I found no error message because of them when building MainCaller.)
anyone knows? please let me know!

thank you.

from caffe.

niuzhiheng avatar niuzhiheng commented on May 2, 2024

@hogepu I was using mingw to rebuild a cross compiler version of leveldb. It utilizes a wrapper method called cppcomponents. You may try it for your VS2013 build. Good luck!

from caffe.

bhack avatar bhack commented on May 2, 2024

@niuzhiheng This issue is one of the oldest still active. Can you do a PR on docs or other part of the build system to let people use caffe on windows and close this thicket?

from caffe.

shelhamer avatar shelhamer commented on May 2, 2024

@niuzhiheng it could be helpful to the Caffe Windows community if you make
a wiki page to track the installation and usage details of your port. It
could be linked from the official documentation for better visibility than
this issue.

This is just a suggestion -- please keep running your port however works
best for you. Thanks!

On Thursday, September 18, 2014, bhack [email protected] wrote:

@niuzhiheng https://github.com/niuzhiheng This issue is one of the
oldest still active. Can you do a PR on docs or other part of the build
system to let people use caffe on windows and close this thicket?


Reply to this email directly or view it on GitHub
#15 (comment).

from caffe.

hogepu avatar hogepu commented on May 2, 2024

@niuzhiheng Many thanks for your advise. I'm going to try it just now!

from caffe.

niuzhiheng avatar niuzhiheng commented on May 2, 2024

@shelhamer Thank you for your advice. Actually I've already made my windows porting wiki page available. However, no much substantial contents were provided there. I am going to put more useful information there in the future.

And also the issue reporting channel for my repository is also open. If you have any questions or bug reports which related to my windows porting, it will be very welcome to discuss there.

Thanks a lot for your interest.

from caffe.

bhack avatar bhack commented on May 2, 2024

@niuzhiheng Is there anything that could you propose thought a PR to dev branch or you need to maintain your fork?

from caffe.

niuzhiheng avatar niuzhiheng commented on May 2, 2024

@shelhamer and @bhack I am very happy to PR my windows porting to dev branch if you are willing to let me do so. I did not do it, because at the beginning top community members mentioned that the windows version would not be officially supported.

If possible, I would like to upgrade my porting to the latest version after Caffe releases its 1.0 version. I believe making Cmake compatible with Windows porting is a very much preferable solution.

And also I would like to invite @OpenHero to do this together if we could get his time and his willingness for this. @OpenHero, I am looking forward to your reply. Thank you in advance.

from caffe.

shelhamer avatar shelhamer commented on May 2, 2024

@niuzhiheng the BVLC members still cannot officially support the windows version since none of us are windows developers nor do we have windows machines (at least for the time being). However, if there are changes to canonical Caffe that make your port easier to maintain downstream they could be PR'd.

At any rate, in the 1.0 release we can make sure the documentation properly points to your fork for windows and its wiki and issues too. Thanks again!

from caffe.

OpenHero avatar OpenHero commented on May 2, 2024

Thanks for your invited.
I'm glad to do it.
Let's make it!

Sent from my iPhone

On 20 Sep, 2014, at 13:23, NIU ZHIHENG [email protected] wrote:

@shelhamer and @bhack I am very happy to PR my windows porting to dev branch if you are willing to let me do so. I did not do it, because at the beginning top community members mentioned that the windows version would not be officially supported.

If possible, I would like to upgrade my porting to the latest version after Caffe releases its 1.0 version. I believe making Cmake compatible with Windows porting is a very much preferable solution.

And also I would like to invite @OpenHero to do this together if we could get his time and his willingness for this. @OpenHero, I am looking forward to your reply. Thank you in advance.


Reply to this email directly or view it on GitHub.

from caffe.

bhack avatar bhack commented on May 2, 2024

@niuzhiheng @OpenHero I'm not working on window but in some other internal projects we have succesfull added windows support extending MXE for solving dependencies and using Cmake. So I suggest to you to really take a look to MXE to simplify windows dependency handling a little bit (some caffe dependency like boost are already available). IMHO for the community I think that it is enough if windows is supported only in the caffe cmake build if this not break other things.

from caffe.

niuzhiheng avatar niuzhiheng commented on May 2, 2024

@OpenHero Thank you for your support and look forward to a good collaboration with you.
@bhack Thank you for your suggestion. We will try MXE afterwards.

from caffe.

hogepu avatar hogepu commented on May 2, 2024

I hope cmake version incluging 3rd party( if possible )!
I haven't rebuild 3rd party libs, and struggle learning how to rebuild with MinGW and some tools....
I hope to try caffe and cuDNN as soon as possible..

from caffe.

JosephCatrambone avatar JosephCatrambone commented on May 2, 2024

@hogepu, Did you ever get the dependencies built for VS2013? I'd be very grateful if you could provide or link a copy of them.

from caffe.

hogepu avatar hogepu commented on May 2, 2024

@JosephCatrambone No, I'm trying but I've not done yet.
please teach me how to build cross-compile dll on mingw.

from caffe.

OpenHero avatar OpenHero commented on May 2, 2024

hi @niuzhiheng I have updated my master(windows version https://github.com/OpenHero/caffe ) based on current official version. Please check it.

from caffe.

guopei avatar guopei commented on May 2, 2024

@niuzhiheng @OpenHero It is very helpful to update to the latest version!!! Btw, can you make a tutorial about the installation requirement? Thank you!

from caffe.

yanweifu avatar yanweifu commented on May 2, 2024

Hi,
@niuzhiheng , I follow the instruction and compile the files in windows. However, when I ran it by using GPU, it gave me such error
F1011 21:08:28.884862 2940 im2col.cu:54] Check failed: error == cudaSuccess (8
vs. 0) invalid device function
*** Check failure stack trace: ***

My GPU card is relative obsolete, GT240M. Nevertheless, I checked the CUDA 6.5 samples, it really works well and can detect my device. So it is only caffe that can not use my GPU. Is there any hope to use GPU caffe in my case? Thanks for your help!

from caffe.

JosephCatrambone avatar JosephCatrambone commented on May 2, 2024

@yanweifu I suspect that perhaps Caffe is using a function call which is not utilized in the examples. Do all the examples work on your GPU, or do only a few work?

from caffe.

yanweifu avatar yanweifu commented on May 2, 2024

@JosephCatrambone Yeah! exactly! I fixed the GPU architecture configure? compute_12, sm_12.
when running the examples, it gave me the errors:
Assertation failed: px!=0, in file shared_ptr.hpp, Line 653.
I googled, it seems some function call is not initialized. All CUDA6.5 examples work well in my laptop, while caffe doesnot work. still trying to figure out why.

from caffe.

fullfanta avatar fullfanta commented on May 2, 2024

@OpenHero

I downloaded and installed your windows program.
First, I trained mnist example.
Then I obtained lenet caffemodel file(The number of layers is 9) and the accuracy of test set was almost 1.

(train_net.exe train --solver=examples\mnist\lenet_solver.prototxt)

I1021 10:32:43.345023 27276 solver.cpp:302]     Test net output #0: accuracy = 0.98
I1021 10:32:43.346024 27276 solver.cpp:302]     Test net output #1: loss = 0.0661116 (* 1 = 0.0661116 loss)
I1021 10:32:43.346024 27276 solver.cpp:237] Optimization Done.
I1021 10:32:43.347023 27276 caffe.cpp:125] Optimization Done.

After that, in the test stage, I didn't obtain similar accuracy as training stage. The accuracy was only 0.12.

(train_net test --model=examples\mnist\lenet_train_test.prototxt --weights=examples\mnist\lenet_iter_10000.caffemodel -gpu 0)

I1020 22:21:08.843708  6180 caffe.cpp:302] Loss: 2.3023
I1020 22:21:08.843708  6180 caffe.cpp:314] accuracy = 0.12
I1020 22:21:08.844707  6180 caffe.cpp:314] loss = 2.3023 (* 1 = 2.3023 loss)

In the code, I checked how to load weight file.

It used the function 'CopyTrainedLayersFrom' to load weight file like this

Net<float> test_net;
test_net->CopyTrainedLayersFrom("examples\\mnist\\lenet_iter_10000.caffemodel");

Inside that function, it used 'ReadNetParamsFromBinaryFileOrDie' function as

NetParameter param;
ReadNetParamsFromBinaryFileOrDie(trained_filename, &param);
CopyTrainedLayersFrom(param);

The problem happened in 'ReadNetParamsFromBinaryFileOrDie' function.

After calling 'ReadNetParamsFromBinaryFileOrDie' function, NetParameter didn't loaded correctly.
For example, param's number of layers was only 1. Therefore, the weight on the other layers after 2 didn't loaded.

Can you check what's the problem?

from caffe.

fullfanta avatar fullfanta commented on May 2, 2024

I found the solution of my previous problem.

It is about the flag of file open function.

In io.cpp, the function ReadProtoFromBinaryFile() opens binary file with the O_RDONLY flag.

int fd = open(filename, O_RDONLY);

This flag works well in linux but not in windows.

In windows system, we should specify the type of file in the flag such as

int fd = open(filename, O_RDONLY|O_BINARY);

After changing, the test program works well.

Anyway, this was about the difference about file system in linux and windows.

from caffe.

ysoo1133 avatar ysoo1133 commented on May 2, 2024

Hi :)

I'm using cuda 6.5 and caffe.

how to install cudnn on windows?
and how to enable?

i unzip downloaded cudnn file. there are some h, lib and dll files.
should i move *.h, *.lib, *.dll to C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v6.5\ include, lib, bin ???

Is there any flag to on for cudnn?

from caffe.

fullfanta avatar fullfanta commented on May 2, 2024

@hellf
You are right. Just copy them to the directories.

In the preprocessor definitions, 'USE_CUDNN' should be defined.

from caffe.

ysoo1133 avatar ysoo1133 commented on May 2, 2024

@fullfanta

Thank you :)

from caffe.

hogepu avatar hogepu commented on May 2, 2024

I can't find "USE_CUDNN" in the source code for windows ( "https://github.com/niuzhiheng/caffe" ).
I can find in the original(?) source code "https://github.com/BVLC/caffe". ( "src/caffe/layer_factory.cpp" )
We should replace the source code when we want to use cuDNN on Windows ?

from caffe.

fullfanta avatar fullfanta commented on May 2, 2024

@hogepu
In my case, I used @OpenHero 's program. It used recently released source code which contains 'CUDNN'.

from caffe.

yesafdsaf avatar yesafdsaf commented on May 2, 2024

@niuzhiheng
I downloaded and installed your windos program and it work fine for all the examples.But when I modify the caffe.proto to add an optional field to LayerParameter and rebuilt,the prgram crash down.Could you tell me why this happend?
@fullfanta I also tried the program developed by OpenHero,but couldn't compile it correctly.Could you please tell me where can I find the installation guild? I got some errors like this:
--Looking for include file pthread.h
--Looking for include file pthread.h - not found
--Found Threads: TRUE
--Could NOT find GLOG (missing: GLOG_INCLUDE_DIR GLOG_LIBRARY)..
--Could NOT find GFLAGS (missing: GFLAGS_INCLUDE_DIR GFLAGS_LIBRARY)

from caffe.

carrierlxk avatar carrierlxk commented on May 2, 2024

@niuzhiheng
I have downloaded and installed your windos program .
I found a question in 'readme'. In this ducument, a MS Visual Studio 2012 is requsted and I
found that the correponding installation file in C disk is 'Microsoft Visual Studio 11.0' when I finished installing.
This is conflict with the commond in solution file './build/MSVC/MainBuilder.sln', in which the the Microsoft Visual Studio Solution File, Format Version is 12.00.
So should I install MS Visual Studio 2013 or VS 2012 will be compatible with caffe-windows.

from caffe.

fullfanta avatar fullfanta commented on May 2, 2024

@yesafdsaf
Please see https://github.com/OpenHero/caffe/wiki/Caffe-setup-in-Windows-system.
You need to download many libraries and check the libraries' path in visual studio.
Please compile with x64.

from caffe.

yesafdsaf avatar yesafdsaf commented on May 2, 2024

Thanks you very much @fullfanta ! I am not very familiary with CMAKE and although I have read the installation guild, I did not understand what "F:\project\dl\caffe_gpu\src\caffe\include;" stands for. What should I do when I install all the libraries? Just type cmake in the cammand window?

from caffe.

cwjacklin avatar cwjacklin commented on May 2, 2024

has anyone run cifar10_full_solver? accuracy and test loss at 0.1 and 2.30 haven't changed after 10k iterations. I am guessing this is due to outdated code of the port.

I was able to run cifar10_quick_solver and got about 75% accuracy as described in caffe tutorial.

from caffe.

chenxiangzhen avatar chenxiangzhen commented on May 2, 2024

@niuzhiheng I want to know how to convert a imageset to a format of leveldb。

from caffe.

chenxiangzhen avatar chenxiangzhen commented on May 2, 2024

@niuzhiheng I convert some images to leveldb,but i encountered some errors。
I1208 19:31:29.233788 6424 convert_imageset.cpp:51] Shuffling data
I1208 19:31:29.235788 6424 convert_imageset.cpp:54] A total of 3 images.
I1208 19:31:29.236788 6424 convert_imageset.cpp:61] Opening leveldb jaffe_level
db
F1208 19:31:29.241789 6424 convert_imageset.cpp:64] Check failed: status.ok() F
ailed to open leveldb jaffe_leveldb
*** Check failure stack trace: ***
how to solve them。Thank you!

from caffe.

satishlokkoju avatar satishlokkoju commented on May 2, 2024

Hi all,

I have ran an old version of Caffe ported by @niuzhiheng to windows for imagenet. I am unable to find caffemodel file. Is there any way to save the trained model once the optimization is done.?

from caffe.

gedditoffme avatar gedditoffme commented on May 2, 2024

I'm having trouble compiling. Using Visual Studio 2013, but getting 999 errors of this form: Error 961 error LNK2001: unresolved external symbol _cudaGetErrorString@4 ...\caffe-windows\build\MSVC\benchmark.obj MainCaller

Not that familiar with Visual Studio - is it saying it can't link the Cuda libraries?

from caffe.

erogol avatar erogol commented on May 2, 2024

Hi people. Is there any way to compile all caffe-windows as an external library to use in a new project by including externally.

from caffe.

satishlokkoju avatar satishlokkoju commented on May 2, 2024

@erogol I succesfully compiled and ran caffe-dev on windows 7 64 bit machine with Visual Studio 2012.
I was able to use python and matlab wrappers. I used dependencies put together by @niuzhiheng. Let me know if you have any specific issues.

from caffe.

erogol avatar erogol commented on May 2, 2024

I guess the problem is my newbiness at windows development.Is this the thing that I should do ? Get all the caffe files and dependencies. Open VS write my code calling caffe. Set the library paths and compile.

from caffe.

satishlokkoju avatar satishlokkoju commented on May 2, 2024

The Caffe code as is is good enough to get you started. @niuzhiheng has put a good read me document. Other than that you need minor changes to caffe code to make it work. I dont remember all the changes I have made. The image below shows you a way to organize the project. Caffe project builds the dynamic library. This is referenced by caffe_exe which is the main wrapper.
The python project builds the python wrapper. The imagenewClassifer launches a local webserver. I build the matlab wrapper using command prompt ( dont have a windows project for that).

The compute_mean_image,conver_dataset are projects which build the tools need for preprocessing the dataset. Unfortunately I cant share the setup. I can help you out if you stumble upon something.

caffe_windows

from caffe.

initialneil avatar initialneil commented on May 2, 2024

Hi, all. I just managed to compile Caffe in Windows with Visual Studio 2013. Hopefully the repository and the step by step record can be helpful.

from caffe.

erogol avatar erogol commented on May 2, 2024

@initialneil this is great thx. I'll poke you if any error in the process

from caffe.

bhack avatar bhack commented on May 2, 2024

If some windows developer is interested to support Cmake widows generators can try to follow this Cmake refactoring effort #1667

from caffe.

erogol avatar erogol commented on May 2, 2024

@initialneil as I follow your tutorial I face with that error
Error 2 error C1083: Cannot open include file: 'caffe/proto/caffe.pb.h': No such file or directory ...

It is also missing in the project directory but I guess it is created in the compile time. Do I missing something ?

from caffe.

initialneil avatar initialneil commented on May 2, 2024

@erogol the pb related files are generated by running caffe/scripts/GeneratePB.bat. You need to run it manually or add a pre-built event in the project's property, so that the GeneratePB.bat runs when you build the project.

from caffe.

erogol avatar erogol commented on May 2, 2024

@initialneil just before I looked your new comment, I realized my mistake. Thanks anyway, also thanks for the effort .

from caffe.

erogol avatar erogol commented on May 2, 2024

@initialneil another issue is to read binaryprototxt of my mean file. As It follow these lines

   // Set GPU
Caffe::set_mode(Caffe::GPU);
int device_id = 0;
Caffe::SetDevice(device_id);
LOG(INFO) << "Using GPU";

// Set to TEST Phase
Caffe::set_phase(Caffe::TEST);

// Load net
Net<float> net(MODEL_PROTO);

// Load pre-trained net (binary proto)
net.CopyTrainedLayersFrom(MODEL_BIN);

...

It raises this error;

I0112 13:13:16.069519 11440 base_data_layer.cpp:36] Loading mean file from C:path/to/mean.binaryprototxt
F0112 13:13:16.069519 11440 io.hpp:90] Check failed: ReadProtoFromBinaryFile(fil
ename, proto)

I debugged the code and I realized that in io.cpp ReadProtoFromBinaryFile() causes the error and it cannot read the file at the line " bool success = proto->ParseFromCodedStream(coded_input); " . (bool success is 0)

Is it something related to your new compilation of Google Protobuf? Maybe it is version missmatch between the one I saved the mean file and try to read.

Would you suggest something to resolve this problem ?

By the way I am pretty sure the sanity of mean file since I can read it in Ubuntu compiled version of the caffe.

from caffe.

initialneil avatar initialneil commented on May 2, 2024

@erogol I found that the problem lies in the function ReadProtoFromBinaryFile of src/caffe/util/io.cpp. When you load a binary format file in Windows, you have to specify that it's binary. Therefore O_RDONLY need to be changed to O_RDONLY | O_BINARY in this function.

from caffe.

Related Issues (20)

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.