Caffe tools/caffe的使用

本文详细介绍Caffe工具的使用方法,包括如何通过命令行调用Caffe进行模型训练、测试、设备查询及时间基准测试等操作。同时,文章还列举了各种参数设置,如GPU选择、迭代次数、模型定义、预训练权重加载等。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Caffe tools/caffe 的使用


当caffe编译之后会有在 /caffe/build/tools/ 路径下会有一个caffe可执行文件,我们在命令行输入 ./caffe/build/tools/caffe 会有caffe这个可执行文件的说明,如下图。

image_1cfs1erohu8hetn25111868029.png-131.3kB

看一看都有神马命令!

caffe: command line brew
usage: caffe <command> <args>

commands:
  train           train or finetune a model                    训练或者调整模型
  test            score a model                                给一个模型打分
  device_query    show GPU diagnostic information              显示GPU的诊断信息
  time            benchmark model execution time               检测一个模型的运行时间

  Flags from tools/caffe.cpp:
  
    控制你用哪一个GPU,如果全用则-gpu all:
    -gpu (Optional; run in GPU mode on given device IDs separated by ','.Use
      '-gpu all' to run on all available GPUs. The effective training batch
      size is multiplied by the number of devices.) type: string default: ""
      
    设置你训练和测试的迭代次数 
    -iterations (The number of iterations to run.) type: int32 default: 50
    
    -level (Optional; network level.) type: int32 default: 0
    
    -model 后接 net.prototxt 文件,此文件设置了网络的结构
    -model (The model definition protocol buffer text file.) type: string
      default: ""
      
    -phase (Optional; network phase (TRAIN or TEST). Only used for 'time'.)
      type: string default: ""
    -sighup_effect (Optional; action to take when a SIGHUP signal is received:
      snapshot, stop or none.) type: string default: "snapshot"
    -sigint_effect (Optional; action to take when a SIGINT signal is received:
      snapshot, stop or none.) type: string default: "stop"
    -snapshot (Optional; the snapshot solver state to resume training.)
      type: string default: ""
    
    -solver 后接你的solver.prototxt文件
    -solver (The solver definition protocol buffer text file.) type: string
      default: ""
      
    -stage (Optional; network stages (not to be confused with phase), separated
      by ','.) type: string default: ""
      
    -weights 后接你之前训练好的 .caffemodel文件,存储的是之前得到的参数们。
    -weights (Optional; the pretrained weights to initialize finetuning,
      separated by ','. Cannot be set simultaneously with snapshot.)
      type: string default: ""
/usr/include/boost/math/tools/config.hpp:23:6: warning: #warning "The minimum language standard to use Boost.Math will be C++14 starting in July 2023 (Boost 1.82 release)" [-Wcpp] 23 | # warning "The minimum language standard to use Boost.Math will be C++14 starting in July 2023 (Boost 1.82 release)" | ^~~~~~~ [ 86%] Building CXX object src/caffe/CMakeFiles/caffe.dir/util/signal_handler.cpp.o [ 86%] Building CXX object src/caffe/CMakeFiles/caffe.dir/util/upgrade_proto.cpp.o /root/docker/app/filebrowser/srv/GaussianHairCut/ext/openpose/3rdparty/caffe/src/caffe/util/io.cpp: In function ‘bool caffe::ReadProtoFromBinaryFile(const char*, google::protobuf::Message*)’: /root/docker/app/filebrowser/srv/GaussianHairCut/ext/openpose/3rdparty/caffe/src/caffe/util/io.cpp:57:66: error: no matching function for call to ‘google::protobuf::io::CodedInputStream::SetTotalBytesLimit(const int&, int)’ 57 | coded_input->SetTotalBytesLimit(kProtoReadBytesLimit, 536870912); | ^ In file included from /root/docker/app/filebrowser/srv/GaussianHairCut/ext/openpose/3rdparty/caffe/src/caffe/util/io.cpp:2: /usr/include/google/protobuf/io/coded_stream.h:384:8: note: candidate: ‘void google::protobuf::io::CodedInputStream::SetTotalBytesLimit(int)’ 384 | void SetTotalBytesLimit(int total_bytes_limit); | ^~~~~~~~~~~~~~~~~~ /usr/include/google/protobuf/io/coded_stream.h:384:8: note: candidate expects 1 argument, 2 provided make[5]: *** [src/caffe/CMakeFiles/caffe.dir/build.make:1906: src/caffe/CMakeFiles/caffe.dir/util/io.cpp.o] Error 1 make[5]: *** Waiting for unfinished jobs.... In file included from /usr/include/boost/bind/detail/requires_cxx11.hpp:9, from /usr/include/boost/bind/bind.hpp:24, from /usr/include/boost/bind.hpp:29, from /root/docker/app/filebrowser/srv/GaussianHairCut/ext/openpose/3rdparty/caffe/src/caffe/util/signal_handl
03-14
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值