当前位置:首页 » 编程软件 » glog编译so

glog编译so

发布时间: 2023-03-26 21:03:53

linux下无cuda怎么pip安装pytorch

linux下安装caffe(无cuda)以及python接口
caffe(8)
主要过程稍微记录一下:
1.安装BLAS
sudo apt-get install libatlas-base-dev

2.安装依赖项
sudo apt-get install libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libboost-all-dev libhdf5-serial-dev protobuf-compiler liblmdb-dev
3.安装glog
这个要FQ,我放在我的网络云上了。
tar zxvf glog-0.3.3.tar.gz
cd glog-0.3.3
./configure
make
sudo make install

4.安装gflags

wget https://github.com/schuhschuh/gflags/archive/master.zip
unzip master.zip
cd gflags-master
mkdir build && cd build
export CXXFLAGS="-fPIC" && cmake .. && make VERBOSE=1
make
sudo make install

这一步需要cmake,如果没有安装可以用 sudo apt-get install cmake 安装。
5.安装lmdb
git clone https://gitorious.org/mdb/mdb.git
cd mdb/libraries/liblmdb
make
sudo make install

如果没有安装Git,也要用 sudo apt-get install git 来安装。
注:如果可以FQ,只用下面一句就可以安装gflags,glog和lmdb了,省了3,4,5这三步。
sudo apt-get install libgflags-dev libgoogle-glog-dev liblmdb-dev protobuf-compiler

6.下载Caffe
git clone git://github.com/BVLC/caffe.git

7.安装Caffe
cd caffe
cp Makefile.config.example Makefile.config

因为这里没有gpu,所以需要设置Makefile.config文件中的CPU_ONLY:= 1,把这句的注释去掉就可以了。
然后编译
make all
make test
make runtest

安装好以后我们就可以试着在mnist上跑一下lenet了。
1.首先获取mnist数据
cd caffe
./data/mnist/get_mnist.sh

2.然后创建lenet
./examples/mnist/create_mnist.sh

注意一定要在caffe的根目录下运行以下命令,否则会报“ build/examples/mnist/convert_mnist_data.bin: not found”的错误,参见这里。
3.训练cnn
没有gpu的话要记得把caffe/examples/mnist/lenet_solver.prototxt中的solver_mode设置成solver_mode: CPU。然后在根目录下执行:
./examples/mnist/train_lenet.sh

准确率可以达到0.9912

因为caffe的tutorial上有很大一部分是Python的,所以后来又安装了一下python的接口。
1.首先安装python
2.安装pip
sudo apt-get install python-pip python-dev build-essential

3.运行以下代码安装必要的依赖项:
sudo pip install -r ./python/requirements.txt

4.这里我运行了make clean以及其他编译的caffe的命令,重新编译了一次caffe,但我不确定是不是必须的。
5.在caffe的根目录下运行:
make pycaffe

这里遇到了一个问题:
virtual memory exhausted: Cannot allocate memory
make: *** [python/caffe/_caffe.so] Error 1

按照这里的方法增加Linux虚拟机的内存就可以解决了。
6.把caffe/python的路径加到python路径中:
运行python进入python shell,然后运行下列命令:
import sys
sys.path.append("path/to/caffe/python/")
exit()

7. 这时候再次进入python shell,运行import caffe就没有报错了。

② 如何使用Google日志库

如何使用Google日志库 (glog)

介绍
Google glog是一个应用层的库. 它提供基于C++风格的流和多种宏接口.例如:
#include <glog/logging.h>

int main(int argc, char* argv[]) {
// Initialize Google's logging library.
google::InitGoogleLogging(argv[0]);

// ...
LOG(INFO) << "Found " << num_cookies << " cookies";
}
Google glog定义了一系列的宏处理普通的日志工作. 你可以分级记录, control loggingbehavior from the command line, 按条件记录, abort theprogram when expected conditions are not met, introce your ownverbose logging levels, 及其它. 文本只是简单的介绍了常用的glog功能而不是所有的细节.没介绍到的,自己读代码去吧.

严重等级
严重等级包括(按严重程度排序): INFO, WARNING,ERROR,和FATAL.记录一个FATAL级的错误后会自动终止程序执行(其实就是_asm int 3).一个严重等级高的记录不但记录在它自己的文件,也记录在比它低等的文件里.例滑态态如, 一个FATAL级的记录将会记在FATAL, ERROR,WARNING, 和INFO等级的日志里.
在debug状态下FATAL级记录也可以用DFATAL(当没定义NDEBUG宏的时候),发给客户的程序最好不要用FATAL小心客户对你使用_asm int 3,这时ERROR是个不错的选择.
glog默认把日志文件命名为"/tmp/...log...."(例如, "/tmp/hello_world.example.com.hamaji.log.INFO.20080709-222411.10474").glog默认把ERROR 和 FATAL 级的记录发送一份到stderr.

设置标志
标志可以改变glog的输出行为.如果你安装了Googlegflags library, configure 脚本 (具体请参考它的INSTALL文件)会自动检测并使用标信源志,这时你可以通过命令行使用标志.例如, 若你想发送 --logtostderr 标志,像下面这样:
./your_application --logtostderr=1
如果你没装Google gflags library,你就只能用带GLOG_的环境变量实现,例如.
GLOG_logtostderr=1 ./your_application (貌似在Windows里不能这样用吧?)
常用的标志有:
logtostderr (bool, default=false)
写日志到stderr而不是日志文件.
Note: you can set binary flags to true by specifying1, true, or yes (caseinsensitive).Also, you can set binary flags to false by specifying0, false, or no (again, caseinsensitive).

stderrthreshold (int, default=2, whichis ERROR)
将某级及以上级别的记录同时发送到stderr和日志文件. 严重等级INFO, WARNING, ERROR, FATAL 分别对应 0, 1, 2, 3.

minloglevel (int, default=0, whichis INFO)
只闭物记录某级及以上级别的记录.

log_dir (string, default="")
指定日志保存的目录.

v (int, default=0)
Show all VLOG(m) messages for m less orequal the value of this flag. Overridable by --vmole.See the section about verbose logging for moredetail.

vmole (string, default="")
Per-mole verbose level. The argument has to contain acomma-separated list of =.is a glob pattern (e.g., gfs* for all moles whose namestarts with "gfs"), matched against the filename base(that is, name ignoring .cc/.h./-inl.h). overrides any value given by --v.See also the section about verbose logging.
还有一些其它的标志,自己去logging.cc里面搜索"DEFINE_",爷就不多说了.

你也可以在程序里修改FLAGS_* 开头的全局变量. 通常设置FLAGS_*开头的变量会立即生效,和日志文件名或路径相关的变量例外.例如FLAGS_log_dir就不能放在google::InitGoogleLogging后面.例子代码:
LOG(INFO) << "file";
// Most flags work immediately after updating values.
FLAGS_logtostderr = 1;
LOG(INFO) << "stderr";
FLAGS_logtostderr = 0;
// This won't change the log destination. If you want to set this
// value, you should do this before google::InitGoogleLogging .
FLAGS_log_dir = "/some/log/directory";
LOG(INFO) << "the same file";
条件/ Occasional Logging
下面的宏用于根据条件写日志:
LOG_IF(INFO, num_cookies > 10) << "Got lots of cookies";
只有当num_cookies > 10的时候才会记录"Got lots of cookies"
如果有的代码执行非常频繁,你肯定不会希望每次都写入日志.这时,你可以使用下面的方法:
LOG_EVERY_N(INFO, 10) < Got the googleCOUNTER th cookiepre>
上面的代码只有当第1次,第11次,第21次....执行时才写入日志.Note that the specialgoogle::COUNTER value is used to identify which repetition ishappening.
条件和计次可以混合使用,例如:
LOG_IF_EVERY_N(INFO, (size > 1024), 10) << "Got the " << google::COUNTER
<< "th big cookie";
除了间隔N次输出,还可以只输出前M次,例如:
LOG_FIRST_N(INFO, 20) < Got the googleCOUNTER th cookiepre>
只输出前20次.

Debug mode支持
"debug mode"的宏只在调试模式有效,其他模式不生效.上栗子:
DLOG(INFO) << "Found cookies";

DLOG_IF(INFO, num_cookies > 10) << "Got lots of cookies";

DLOG_EVERY_N(INFO, 10) << "Got the " << google::COUNTER << "th cookie";
CHECK宏
经常检查是否会出错而不是等着程序执行出错是个不错的习惯.CHECK宏就是干这个滴,它的功能和assert一样,条件不符合时终止程序.
与assert不同的是它*不*受NDEBUG的限制,无论是不是debug编译它都执行.所以下面的fp-<Write(x)会被执行:
CHECK(fp->Write(x) == 4) << "Write failed!";
有各种各样的宏用于CHECK相等/不相等,包括: CHECK_EQ,CHECK_NE, CHECK_LE, CHECK_LT,CHECK_GE,和CHECK_GT.它们会记录一个FATAL级的记录到日志,牛X的是他们还会把对比的两个值也一起记录.(那两个值必须定义了 operator< ostreamcode> ).例如:
CHECK_NE(1, 2) << ": The world must be ending!";
We are very careful to ensure that each argument is evaluated exactlyonce, and that anything which is legal to pass as a function argument islegal here. In particular, the arguments may be temporary expressionswhich will end up being destroyed at the end of the apparent statement,for example:
CHECK_EQ(string("abc")[1], 'b');
The compiler reports an error if one of the arguments is apointer and the other is NULL. To work around this, simply static_castNULL to the type of the desired pointer.
CHECK_EQ(some_ptr, static_cast(NULL));
还有个好办法:用CHECK_NOTNULL宏:
CHECK_NOTNULL(some_ptr); some_ptr-<DoSomething();
这宏也常用于构造函数中.
struct S {
S(Something* ptr) : ptr_(CHECK_NOTNULL(ptr)) {}
Something* ptr_;
};
这宏的缺点是不能跟C++流一起用.这时就得用CHECK_EQ了.
如果你要对比一个C字符串(char *)可以用:CHECK_STREQ, CHECK_STRNE,CHECK_STRCASEEQ,和CHECK_STRCASENE.带CASE的区分大小写. 这个宏参数可以用NULL指针.NULL与non-NULL比不等.两个NULL是相等的.
Note that both arguments may be temporary strings which aredestructed at the end of the current "full expression"(e.g., CHECK_STREQ(Foo().c_str(), Bar().c_str()) whereFoo and Bar return C++'sstd::string).
CHECK_DOUBLE_EQ 用于对比浮点数,会有小小的误差.CHECK_NEAR 可以接受一个浮点数作为误差.
详细日志
用VLOG宏,你还可以定义自己的严重等级. The --v command line option controlswhich verbose messages are logged:
VLOG(1) << "I'm printed when you run the program with --v=1 or higher";
VLOG(2) << "I'm printed when you run the program with --v=2 or higher";
With VLOG, the lower the verbose level, the morelikely messages are to be logged. For example, if--v==1, VLOG(1) will log, butVLOG(2) will not log. This is opposite of the severitylevel, where INFO is 0, and ERROR is 2.--minloglevel of 1 will log WARNING andabove. Though you can specify any integers for both VLOGmacro and --v flag, the common values for them are smallpositive integers. For example, if you write VLOG(0),you should specify --v=-1 or lower to silence it. Thisis less useful since we may not want verbose logs by default in mostcases. The VLOG macros always log at theINFO log level (when they log at all).
Verbose logging can be controlled from the command line on aper-mole basis:
--vmole=maprece=2,file=1,gfs*=3 --v=0
will:
a. Print VLOG(2) and lower messages from maprece.{h,cc}
b. Print VLOG(1) and lower messages from file.{h,cc}
c. Print VLOG(3) and lower messages from files prefixed with "gfs"
d. Print VLOG(0) and lower messages from elsewhere
The wildcarding functionality shown by (c) supports both '*'(matches 0 or more characters) and '?' (matches any single character)wildcards. Please also check the section about command line flags.
There's also VLOG_IS_ON(n) "verbose level" conditionmacro. This macro returns true when the --v is equal orgreater than n. To be used as
if (VLOG_IS_ON(2)) {
// do some logging preparation and logging
// that can't be accomplished with just VLOG(2) << ...;
}
Verbose level condition macros VLOG_IF,VLOG_EVERY_N and VLOG_IF_EVERY_N behaveanalogous to LOG_IF, LOG_EVERY_N,LOF_IF_EVERY, but accept a numeric verbosity level asopposed to a severity level.
VLOG_IF(1, (size > 1024))
<< "I'm printed when size is more than 1024 and when you run the "
"program with --v=1 or more";
VLOG_EVERY_N(1, 10)
<< "I'm printed every 10th occurrence, and when you run the program "
"with --v=1 or more. Present occurence is " << google::COUNTER;
VLOG_IF_EVERY_N(1, (size > 1024), 10)
<< "I'm printed on every 10th occurence of case when size is more "
" than 1024, when you run the program with --v=1 or more. ";
"Present occurence is " << google::COUNTER;
Failure Signal Handler
The library provides a convenient signal handler that will mp usefulinformation when the program crashes on certain signals such as SIGSEGV.The signal handler can be installed bygoogle::InstallFailureSignalHandler(). The following is an example of outputfrom the signal handler.
*** Aborted at 1225095260 (unix time) try "date -d @1225095260" if you are using GNU date ***
*** SIGSEGV (@0x0) received by PID 17711 (TID 0x7f893090a6f0) from PID 0; stack trace: ***
PC: @ 0x412eb1 TestWaitingLogSink::send()
@ 0x7f892fb417d0 (unknown)
@ 0x412eb1 TestWaitingLogSink::send()
@ 0x7f89304f7f06 google::LogMessage::SendToLog()
@ 0x7f89304f35af google::LogMessage::Flush()
@ 0x7f89304f3739 google::LogMessage::~LogMessage()
@ 0x408cf4 TestLogSinkWaitTillSent()
@ 0x4115de main
@ 0x7f892f7ef1c4 (unknown)
@ 0x4046f9 (unknown)
By default, the signal handler writes the failure mp to the standarderror. You can customize the destination by InstallFailureWriter().
Miscellaneous Notes
Performance of Messages
The conditional logging macros provided by glog (e.g.,CHECK, LOG_IF, VLOG, ...) arecarefully implemented and don't execute the right hand sideexpressions when the conditions are false. So, the following checkmay not sacrifice the performance of your application.
CHECK(obj.ok) << obj.();
User-defined Failure Function
FATAL severity level messages or unsatisfiedCHECK condition terminate your program. You can changethe behavior of the termination byInstallFailureFunction.
void YourFailureFunction() {
// Reports something...
exit(1);
}

int main(int argc, char* argv[]) {
google::InstallFailureFunction(&YourFailureFunction);
}
By default, glog tries to mp stacktrace and makes the programexit with status 1. The stacktrace is proced only when you run theprogram on an architecture for which glog supports stack tracing (asof September 2008, glog supports stack tracing for x86 and x86_64).
Raw Logging
The header file can beused for thread-safe logging, which does not allocate any memory oracquire any locks. Therefore, the macros defined in thisheader file can be used by low-level memory allocation andsynchronization code.Please check src/glog/raw_logging.h.in for detail.
Google Style perror()
PLOG() and PLOG_IF() andPCHECK() behave exactly like their LOG* andCHECK equivalents with the addition that they append adescription of the current state of errno to their output lines.E.g.
PCHECK(write(1, NULL, 2) <= 0) < Write NULL failedpre>
This check fails with the following error message.
F0825 185142 test.cc:22] Check failed: write(1, NULL, 2) <= 0 Write NULL failed: Bad address [14]
Syslog
SYSLOG, SYSLOG_IF, andSYSLOG_EVERY_N macros are available.These log to syslog in addition to the normal logs. Be aware thatlogging to syslog can drastically impact performance, especially ifsyslog is configured for remote logging! Make sure you understand theimplications of outputting to syslog before you use these macros. Ingeneral, it's wise to use these macros sparingly.
Strip Logging Messages
Strings used in log messages can increase the size of your binaryand present a privacy concern. You can therefore instruct glog toremove all strings which fall below a certain severity level by usingthe GOOGLE_STRIP_LOG macro:
If your application has code like this:
#define GOOGLE_STRIP_LOG 1 // this must go before the #include!
#include <glog/logging.h>
The compiler will remove the log messages whose severities are lessthan the specified integer value. SinceVLOG logs at the severity level INFO(numeric value 0),setting GOOGLE_STRIP_LOG to 1 or greater removesall log messages associated with VLOGs as well asINFO log statements.
对于Windows用户
glog的ERROR级错误与windows.h冲突. You can make glog not defineINFO, WARNING, ERROR,and FATAL by definingGLOG_NO_ABBREVIATED_SEVERITIES beforeincluding glog/logging.h . Even with this macro, you canstill use the iostream like logging facilities:
#define GLOG_NO_ABBREVIATED_SEVERITIES
#include <windows.h>
#include <glog/logging.h>

// ...

LOG(ERROR) << "This should work";
LOG_IF(ERROR, x > y) << "This should be also OK";
However, you cannotuse INFO, WARNING, ERROR,and FATAL anymore for functions definedin glog/logging.h .
#define GLOG_NO_ABBREVIATED_SEVERITIES
#include <windows.h>
#include <glog/logging.h>

// ...

// This won't work.
// google::FlushLogFiles(google::ERROR);

// Use this instead.
google::FlushLogFiles(google::GLOG_ERROR);
If you don't need ERROR definedby windows.h, there are a couple of more workaroundswhich sometimes don't work:
#define WIN32_LEAN_AND_MEAN or NOGDIbefore you #include windows.h .
#undef ERRORafter you #include windows.h .
See this issue for more detail.

③ caffe windows10 vs2013怎么配置

1.配置环境
我在自己的笔记本配置的caffe,配置的环境为:Windows 7 64位 + cuda6.5 + Opencv2.49 +VS2013。假设在配置caffe之前,你已经准备好这些。
本文中将给出一些编译好的依赖库,如果你也是用的Windows 7 64位+VS2013,可以直接使用。
2.准备依赖库
在Windows下配置caffe,一个很主要的问题就是依赖库的编译。不像在Ubuntu下那么方便,在Windows下,依赖库都需要使用vs2013进行编译才能使用。下面我将介绍caffe需要的依赖库(如果你也是win7 64位+VS2013,可以直接使用我提供的依赖库)。
2.1 boost
boost可以下载源码进行编译,也可以直接下载安装文件。我使用的是后者,方便、快捷。
我使用的是:boost_1.56_0-msvc-12.0-64.exe
注意下载适合你的配置环境的boost版本即可。
下载完毕,双击运行安装文件即可。
2.2 Glog+Gflag+Protobuf+LevelDB+HDF5+LMDB+Openblas
这一部分的很多都是谷歌的开源库,不容易下载(你懂的)。所以我使用的是Neil Z. SHAO‘s Blog
提供的编译好的。
下载完,解压得到3rdparty文件夹。在下一段将会用到。
3.建立caffe工程
准备好了caffe需要的依赖库和环境之后,下面就可以建立caffe的vs项目,进行编译了。
3.1 下载caffe源码
可以从caffe的github主页下载源码。
下载地址:Caffe’s GitHub
解压文件,假设caffe源码所在目录为CAFFE_ROOT。
3.2 准备项目需要的依赖库和系统环境变量
经过上一阶段的准备,caffe项目所需的依赖库都已经准备好。
1.首先设置系统环境变量(以我的为例):
CUDA_PATH_V6_5 安装好cuda6.5之后,会自动添加环境变量CUDA_PATH_V6_5
OPENCV_2_49 D:/Tools/opencv2.49/build/
BOOST_1_56 D:/Tools/boost_1_56_0
2.将3rdparty文件夹放到CAFFE_ROOT
3.3 用vs建立caffe项目
1.用VS2013在CAFFE_ROOT下建立 win32 console application,选择空项目。
将项目的平台由32位改为64位
2.修改项目属性
项目——属性——C/C++——常规——附加包含目录
添加:
../include;
../src;
../3rdparty/include;
../3rdparty;
../3rdparty/include;
../3rdparty/include/openblas;
../3rdparty/include/hdf5;
../3rdparty/include/lmdb;
../3rdparty/include/leveldb;
../3rdparty/include/gflag;
../3rdparty/include/glog;
../3rdparty/include/google/protobuf;
项目——属相——VC++目录——包含目录
添加:
$(CUDA_PATH_V6_5)\include;
$(OPENCV_2_49)\include;
$(OPENCV_2_49)\include\opencv;
$(OPENCV_2_49)\include\opencv2;
$(BOOST_1_56)
项目——属性——链接器——常规——附加库目录
添加:
$(CUDA_PATH_V6_5)\lib\$(PlatformName);
$(OPENCV_2_49)\x64\vc12\lib;
$(BOOST_1_56)\lib64-msvc-12.0;
..\3rdparty\lib;
项目——属性——链接器——输入——附加依赖项
debug添加:
opencv_ml249d.lib
opencv_calib3d249d.lib
opencv_contrib249d.lib
opencv_core249d.lib
opencv_features2d249d.lib
opencv_flann249d.lib
opencv_gpu249d.lib
opencv_highgui249d.lib
opencv_imgproc249d.lib
opencv_legacy249d.lib
opencv_objdetect249d.lib
opencv_ts249d.lib
opencv_video249d.lib
opencv_nonfree249d.lib
opencv_ocl249d.lib
opencv_photo249d.lib
opencv_stitching249d.lib
opencv_superres249d.lib
opencv_videostab249d.lib
cudart.lib
cuda.lib
nppi.lib
cufft.lib
cublas.lib
curand.lib
gflagsd.lib
libglog.lib
libopenblas.dll.a
libprotobufd.lib
libprotoc.lib
leveldbd.lib
lmdbd.lib
libhdf5_D.lib
libhdf5_hl_D.lib
Shlwapi.lib
gflags.lib
libprotobuf.lib
leveldb.lib
lmdb.lib
libhdf5.lib
libhdf5_hl.lib
release添加:
opencv_ml249.lib
opencv_calib3d249.lib
opencv_contrib249.lib
opencv_core249.lib
opencv_features2d249.lib
opencv_flann249.lib
opencv_gpu249.lib
opencv_highgui249.lib
opencv_imgproc249.lib
opencv_legacy249.lib
opencv_objdetect249.lib
opencv_ts249.lib
opencv_video249.lib
opencv_nonfree249.lib
opencv_ocl249.lib
opencv_photo249.lib
opencv_stitching249.lib
opencv_superres249.lib
opencv_videostab249.lib
cudart.lib
cuda.lib
nppi.lib
cufft.lib
cublas.lib
curand.lib
gflags.lib
libglog.lib
libopenblas.dll.a
libprotobuf.lib
libprotoc.lib
leveldb.lib
lmdb.lib
libhdf5.lib
libhdf5_hl.lib
Shlwapi.lib
3.4 编译caffe
配置好caffe项目的属性之后,下面就可以一步一步的编译caffe了。
3.4.1 编译./src中的文件
首先,将../src文件夹中的*.cpp文件添加到工程中。

依次编译每一个*.cpp文件。
1.编译blob.cpp
直接编译时会报错,缺少文件”caffe\proto\caffe.pb.h”
这个时候需要将proto.exe放到../3rdparty/bin文件夹
将GernaratePB.bat放在../scripts文件夹

运行bat脚本文件即可生成caffe.pb.h
然后就可以成功编译。
2.编译common.cpp
直接编译这个文件,会出现关于getid和fopen_s的错误。可通过如下步骤修改:
在代码前面添加:#include <process.h>
修改项目属性:项目——属性——C/C++——预处理器——预处理器定义
添加:_CRT_SECURE_NO_WARNINGS
在代码中getid的位置进行如下修改:
#ifdef _MSC_VER
pid = getid();
#else
pid = _getid();
#endf
修改完毕之后,可以成功编译。
3.编译net.cpp
直接编译这个文件,会出现关于mkstep、close、mkdtemp的错误。需要进行如下修改:
在io.hpp头文件中添加:#include “mkstep.h”
在io.hpp头文件中,在close()的位置进行如下修改:
#ifdef _MSC_VER
close(fd);
#else
_close(fd);
#endif
在mkdtemp的位置进行如下修改:
#ifndef _MSC_VER
char* mkdtemp_result = mkdtemp(temp_dirname_cstr);
#else
errno_t mkdtemp_result = _mktemp_s(temp_dirname_cstr, sizeof(temp_dirname_cstr));
#endif
修改完毕,可以成功编译。
4.编译solver.cpp
直接编译会出现关于snprintf的错误,需要进行如下修改:
#ifdef _MSC_VER
#define snprinf sprintf_s
#endif
修改完毕,可以成功编译。
5.其他剩余的cpp文件也依次编译
3.4.2 编译./src/layers中的文件
将./src/layers中的所有的cpp和cu文件都添加到项目中。

右键点击cu文件,修改属性。

在bnll_layer.cu文件,进行如下修改:
float kBNLL_THRESHOLD = 50 ——> #define kBNLL_THRESHOLD 50.0
依次编译所有的文件。
3.4.3 编译./src/util中的文件
将./src/util中所有的文件添加到项目

1.在io.cpp中
修改ReadProtoFromBinaryFile函数
O_RDONLY ——> O_RDONLY | O_BINARY
在代码中进行如下修改:
#ifdef _MSC_VER
#define open _open
#endif
将close()改为_close()
2.在math_functions.cpp中
做如下修改:
#define __builtin_popcount __popcnt
#define __builtin_popcountl __popcnt
3.在db.cpp中
作如下修改:
#ifdef _MSC_VER
#include <direct.h>
#endif
修改CHECK_EQ
#ifdef _MSC_VER
CHECK_EQ(_mkdir(source.c_str()),0)<<”mkdir”<<source<<”failed”;
#else
CHECK_EQ(mkdir(source.c_str(),0744),0)<<”mkidr”<<source<<”failed”;
#endif
4.依次编译其他文件
3.4.4 编译./src/proto中的文件
参照上一步,将proto中的文件都添加到项目。
修改属性:
项目——属性——C/C++——预处理器——预处理器定义
添加:_SCL_SECURE_NO_WARNINGS
编译所有文件。
3.4.5 编译./tools中的文件
本文件夹下有多个cpp文件,通过它们的名字就可以知道相应的功能。添加不同的cpp文件到项目中,然后生成项目,就可以得到不同功能的exe文件。
将caffe.cpp添加到工程,生成项目,得到caffe.exe文件,可用于训练模型
将computer_image_mean.cpp添加到工程,生成项目,得到的exe文件可用于将训练样本转换为caffe使用的leveldb/lmdb数据集。
依次类推。
自此,caffe在Windows下的编译已经完毕,接下来就可以使用它来训练自己的模型了。

④ Oasis 乐队的《Supersonic》 的中文歌词

Supersonic 中文歌词
Wikipedia,自由的网络全书
收录专辑:Definitely Maybe

Supersonic 超音速

I need to be myself
我要做自己
I can't be no one else
我不要像其他人一样
I'm feeling supersonic
我正享受着超音速
Give me gin and tonic
请给我一杯gin and tonic
You can have it all but how much do you want it?
你可以一饮而尽但要喝多少杯才够

You make me laugh
你让我大笑
Give me your autograph
请给我你的签名
Can I ride with you in your BMW ?
我可以坐上你的BMW一起兜风吗?
You can sail with me in my yellow submarine
还是你可以坐上我的黄色潜水艇一同共游 (注1)

You need to find out
你得好好思索
'Cos no one's gonna tell you what I'm on about
因为不会有人告诉你我所言为何
You need to find a way for what you want to say
你得想办法让自己畅其所言
But before tomorrow
但得在天亮带慎之前

'Cos my friend said he'd take you home
因为我的朋友说他会带你蠢轮敬回家
He sits in a corner all alone
他坐在角落独自一个人
He lives under a waterfall
他住在瀑布底下
No body can see him
别人见不到他
No body can ever hear him call
也听不到他的呼唤桐誉

You need to be yourself
你得做你自己
You can't be no one else
不要像其他人一样
I know a girl called Elsa
我认识个叫做Elsa的女孩
She's into Alka Seltzer
她对Alka Seltzer很着迷(注2)
She sniffs it through a cane on a supersonic train
她在超音速火车里用根管子吸食它

She made me laugh
她曾让我大笑
I got her autograph
我也拿过她的签名
She done it with a doctor on a helicopter
她曾在直升机里和一位医生搞过
She's sniffin in her tissue
而如今她却拿卫生纸直打喷嚏
Sellin' the Big Issue
在大街上叫卖杂志 (注3)

And She finds out
而现在她终于了解
no one's gonna tell her what I'm on about
没有人要告诉她我所言为何
You need to find a way for what she wants to say
你得想办法听懂她要讲什么
But before tomorrow
但得在天亮之前

'Cos my friend said he'd take you home
因为我的朋友说他会带你回家
He sits in a corner all alone
他坐在角落独自一个人
He lives under a waterfall
他住在瀑布底下
No body can see him
别人见不到他
No body can ever hear him call
也听不到他的呼唤

⑤ 如何解决使用glog和gflags时遇到的错误

我们都知道在Visual Studio中使用OpenCV是非常方便的,只要配置好相关和启拍的路径,建立一个属性表就可以了。接触过Caffe的可能会知道,在Caffe的例程中并没有怎么说如何建立一个属性表,就能够使用Caffe提供的一些函数去构造程序。话说一旁碰个月前刚刚在Github上帮一个老外解决了这个问唤羡题,所以这里也写一下我的方法。
要用Caffe,就是 include 、lib 、dll,和OpenCV一样,搞好这三个即可,推荐大家配置Release版本的,所以在编译Caffe的时候,换成Release模式也编译一次。
实现
观察caffe-master的第三方程序包,毫无疑问,这个与caffe-master本文件夹都需要加上去的。

⑥ 如何解决使用glog和gflags时遇到的错误

错误是这样的:

/usr/local/lib/libgflags.a: error adding symbols: Bad value collect2: error: ld returned 1 exit status
glog是通过下面方式搏携安装毕银者的:
sudo apt-get install build-essential
sudo apt-get install vim cmake git
sudo apt-get install libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libboost-all-dev libhdf5-serial-dev libgflags-dev libgoogle-glog-dev liblmdb-dev protobuf-compiler
在上面的安装中同时安装了gflags,不仅如此,我还在git上下载了gflags的源码也进行了安装。
解决方法:
我对下载的gflags源码进行编译,在cmake时候加入了expor CXXFLAGS="-fPIC"、make VERBOSE=1就可以正常使用gflags和glog了。手薯
即:
export CXXFLAGS="-fPIC" && cmake .. && make VERBOSE=1
make && make install

⑦ VS2015 windows编程出现error C2062 意外的类型“int”

1、错误内容:
意外的类型“type”
编译器不需要类型名称。
2、错误示蠢银键例:
下面的例子生成 C2062:
// C2062.cpp
// compile with: /c
struct A { : int l; }; // C2062
struct B { private: int l; }; // OK
3、说明:
编译器处理构造函数的参数列表中未定义类型的方式也可能导致C2062。 如果编译器遇到未定义的(拼错了吗?)类型,则它假定构造函数是一个表达式,并发出 C2062。
若搏者要带巧解决此错误,请只使用构造函数参数列表中的定义类型。

热点内容
ftp命令批量下载文件 发布:2025-07-18 11:58:45 浏览:742
nba2k17文件夹 发布:2025-07-18 11:48:53 浏览:869
朔源码是什么 发布:2025-07-18 11:44:33 浏览:773
迷你世界解压剧场 发布:2025-07-18 11:43:48 浏览:153
linux安装opencv 发布:2025-07-18 11:42:10 浏览:445
编程游戏的软件有哪些 发布:2025-07-18 11:41:34 浏览:955
c程序设计语言电子书 发布:2025-07-18 11:35:58 浏览:641
lightning耳机如何在安卓手机上用 发布:2025-07-18 11:21:47 浏览:174
妄想山海新宿怎么配置好 发布:2025-07-18 11:07:43 浏览:615
androidsaxxml解析xml 发布:2025-07-18 10:57:58 浏览:386